Style Guide for Python Code 推荐的python代码风格
2008-05-03 18:34
519 查看
1. Install
2. Create rails project (ep. blog)
3. Generate rspec dirs
4. Generate rspec MVC files (ep. post)
5. DB
6. Use auto test
7. Test a file
8. Test models
9. Test controllers
10. Test all
11. more pls to see "rake -T spec"
Wrapped assertions
Tree
project
|
+—app
|
+—…
|
+—spec
|
+— spec_helper.rb
|
+— controllers
|
+— helpers
|
+— models
|
+— views
sudo gem install rspec sudo gem install rspec-rails
2. Create rails project (ep. blog)
rails blog cd blog
3. Generate rspec dirs
ruby script/generate rspec
4. Generate rspec MVC files (ep. post)
model: ruby script/generate rspec_mode Post title:string content:text controller: ruby script/generate rspec_controller Post title:string content:text scaffold: ruby script/generate rspec_scaffold Post title:string content:text
5. DB
rake db:migrate rake db:migrate RAILS_ENV=test
6. Use auto test
autospec
7. Test a file
ruby -S bundle exec rspec ./spec/helpers/users_helper_spec.rb
8. Test models
rake spec:models
9. Test controllers
rake spec:controllers
10. Test all
rake spec
11. more pls to see "rake -T spec"
Wrapped assertions
assert_equal 'aaa', 'aaa': 'aaa'.should equal('aaa'), 'aaa'.should == 'aaa' assert_not_equal 'aaa', 'bbb': 'bbb'.should_not equal('aaa'), 'bbb'.should_not == 'aaa' assert_same: should be() assert_not_same: should_not be() assert_nil: should be_nil assert_not_nil: should_not be_nil assert_in_delta: should be_close assert_match: should match(), should =~ assert_no_match: should_not match(), should.not =~ assert_instance_of: should be_an_instance_of() assert_kind_of: should be_a_kind_of assert_respond_to: should respond_to assert_raise: should raise assert_nothing_raised: should_not raise assert_throws: should throw assert_nothing_thrown: should_not throw assert_block: should satisfy
Tree
project
|
+—app
|
+—…
|
+—spec
|
+— spec_helper.rb
|
+— controllers
|
+— helpers
|
+— models
|
+— views
相关文章推荐
- PEP8: Style Guide for Python Code
- Style Guide for Python Code
- PEP 0008 -- Style Guide for Python Code
- Android开源项目-编码风格规范-Code Style Guidelines for Contributors
- Android开源项目-编码风格规范-Code Style Guidelines for Contributors
- Android开源项目-编码风格规范-Code Style Guidelines for Contributors[原创译文]
- Style Guide for wxPython code
- Code Style(代码的风格)
- FCKeditor基于SyntaxHighlighter 的代码语法高亮插件(Code Syntax Highlight Plugin for FCKeditor)
- 深度学习、tensorflow--神经风格迁移(neural style transfer)原理以及实现代码
- Python - for()循环 详解 及 代码
- Python实现模拟时钟代码推荐
- Google C++Style Guide【C++编程风格指南解读】——C++代码格式
- visual studio code 里调试运行 Python代码
- Poison Ivy 2.3.0 Shellcode for c 利用代码
- Python style guide
- python代码风格指南:pep8 中文翻译
- 推荐VS2008插件CodeRush Xpress for C#
- Google编码规范 C++ Style Guide, JavaScript Style Guide, Objective-C Style Guide, and Python Style Guide
- 推荐一款代码工具:CodeSMART G2 for Visual Studio(很喜欢它的格式化代码功能)