http://delynnberry.com/projects/acts-as-dropdown/
安装RSpec http://rspec.info/documentation/rails/install.html
ruby script/plugin install http://rspec.rubyforge.org/svn/tags/CURRENT/rspec
ruby script/plugin install http://rspec.rubyforge.org/svn/tags/CURRENT/rspec_on_rails
gem install rspec
arbitrary predicate.
the magic of method_missing
target.should be_true
target.should be_false
target.should be_nil
target.should_not be_nil
collection.should be_empty #passes if target.empty?
target.should_not be_empty # passes unless target.empty?
target.should_not be_under_age(13) # passes unless target.under_age?(13)
“a string”.should be_an_instance_of(String)
3.should be_a_kind_of(Fixnum)
3.should be_a_kind_of(Numeric)
3.should be_an_instance_of(Fixnum)
3.should_not be_instance_of(Numeric) #fails
describe “people in general”, :shared => true do
it “should have a name” do
@person.name.should_not be_nil
end
it “should have an age” do
@person.age.should_not be_nil
end
end
describe Teacher do
before(:each) do
@person = Teacher.new(“Ms. Smith”, 30, 50000)
end
it_should_behave_like “people in general”
it “should have a salary” do
@person.salary.should == 50000
end
end
:each :all
运行方式
ruby script/generate rspec
ruby script/generate rspec_model LeaveNumberLog(ruby script/generate rspec
_scaffold User name:string age:integer
)
编写
ruby script\spec_server
spec --drb spec\models\leave_number_log_spec.rb
或者
ruby script/spec spec
group controller examples by action and HTTP method.
rake db:fixtures:load FIXTURE=table1,table2
把夹具里面的数据导到dev环境中。
ruby script/plugin install http://www.realityforge.org/svn/public/code/debug-view-helper/trunk/
分享到:
相关推荐
rspec-mocks 是一个 rspec 的 test-double 框架,支持 method stubs, fakes 和生成 test-doubls 和类似真的对象的预期消息。 标签:rspec
RSpec supports Test Driven Development in Ruby through the BDD lens, keeping your focus on design and documentation while also supporting thorough testing and quick fault isolation. Cucumber, RSpec's...
安装gem install rspec # for rspec-core, rspec-expectations, rspec-mocksgem install rspec-mocks # for rspec-mocks only想要与main分支对抗吗? 您还需要包括相关的RSpec存储库。 将以下内容添加到您的Gemfile ...
Rails test described by RSpec
db-query-matchers, 用于数据库查询的RSpec匹配器 db-query-matchers 用于数据库查询的RSpec匹配器。安装在你的应用程序中添加这一行,最好在你的test 组中:gem 'db-query-matchers'然后执行:bundle
添加rspec-rails ,以两个:development和:test组的应用程式中Gemfile : # Run against the latest stable releasegroup :development , :test do gem 'rspec-rails' , '~> 4.0.2'end# Or, run
旧的自述文件Testbot是一个测试分发工具,可与Rails,RSpec,RSpec2,Test :: Unit和Cucumber一起使用。 基本思想是让testbot将测试的负载分散到多台计算机上,以使测试运行更快。 在11台机器(25个内核)上使用...
使用 RSpec 开发 Rails 应用程序 本教程适用于想要使用 RSpec 开发 rails 应用程序的用户。 参考这个 使用 导轨 4.0.4 Ruby 2.0.0 mysql2 0.3.18 文件 group :development , :test do gem 'rspec-rails' gem '...
将此添加到您的Gemfile中: gem 'rspec_api_helpers'然后执行: $ bundle或将其自己安装为: $ gem install rspec_api_helpers将其包含在您的spec_helper中 RSpec . configure do | config | # ... config . ...
自述文件 该自述文件通常会记录启动和运行应用程序所需的所有步骤。 您可能要讲的内容: Ruby版本 系统依赖 配置 数据库创建 数据库初始化 如何运行测试套件 服务(作业队列,缓存服务器,搜索引擎等) ...
将此行添加到您的应用程序的Gemfile中: group :test do gem 'ngrok-rspec'end 然后执行: $ bundle 或将其自己安装为: $ gem install ngrok-rspec用法配置rspec RSpec . configure do | config | # any port can ...
这本书特别的棒,里面不仅仅介绍如何使用Rspec,同时最关键的还是告诉你如何去做BDD,TDD开发。
您也可以将其与其他结合使用: rspec --format progress --format RspecJunitFormatter --out rspec.xml与Bundler一起在项目中使用如果您使用的是 ,请将其添加到Gemfile中。 将其与rspec放在同一组中。 group :...
RSpec Rails昂首阔步 该gem通过使用RSpec记录路径来帮助您生成Swagger文档。 你执行一个命令来运行测试并生成.yaml或.json输出。 运行测试可确保您的API和文档一致,并生成可保存为响应示例的输出。 它的设计在很大...
如果需要在Rails 2.x或RSpec 1.x中使用rspec-prof,请使用版本“ 0.0.3”。 宝石文件: group :test do gem 'rspec-prof' end 用法 使用rspec-prof的最简单方法是导出`RSPEC_PROFILE`环境变量: $ rake ...
Your Ruby on Rails ...This new edition has been updated to Rails 5.2 and RSpec 3.7 and contains full coverage of new Rails features, including system tests and the Webpack-based JavaScript setup.
用法将gem添加到您的Gemfile并运行bundle : group :test do gem "rspec_overview"end 您可以单独使用概述格式化程序,也可以与其他格式化程序混合使用: # With the progress formatter:bundle exec rspec --format...
##在 Rails 中快速设置 RSpec,使用 Capybara、Factory Girl、Database Cleaner、Shoulda-matchers 等... 在命令行中,运行rails new app_name -T (关闭默认测试单元) 将 Gems 添加到 gemfile,然后捆绑。 gem '...
相反,如果你喜欢RSpec的的方式来宣告例如组和实例( describe和it ),但更喜欢测试::单位断言和, 或的嘲笑,你就可以做到这一点,而无需安装或加载组件您未使用的RSpec。 文献资料 有关所有gem的文档链接,请...
RSpec控制台 RSpec控制台允许您在Rails控制台中运行RSpec测试。 最好与搭配使用。 在使用,它特别有用,因为它将为您保持活动的JVM运行。 这极大地减少了在jRuby中...使用Rails,使用rails c test启动控制台。 4)