我是黄瓜新手,在我的Rails 3应用程序中挣扎着。)
这是我的宝石文件中包含的宝石:黄瓜,黄瓜-rails,rspec,rspec-rails,capybara-envjs,database_cleaner,launchy
我设立了以下机构:
require 'capybara/envjs'
Capybara.javascript_driver = :envjs在我的网站上,任何人都可以订阅这封新闻信。它通过ajax很好地工作,并显示了一个很好的咆哮般的消息:
当我注释行:I should have 1 mail in my mailing list时,下面的场景运行良好。
对于这一行,我有以下错误消息:And I should have 1 mail in my mailing list # features/step_definitions/mailing_steps.rb:1 expected: 1, got: 0 (using ==) (RSpec::Expectations::ExpectationNotMetError)
@javascript
Scenario: Entering Valid Mail
Given I am on the about page
When I fill in "mailing[mail]" with "cucumber@cucumber.com"
And I press "REGISTER"
Then I should be on the about page
And I should have 1 mail in my mailing list
And I should see "Welcome" within "#gritter-notice-wrapper"下面是我添加的步骤:
Then /^I should have ([0-9]+) mail in my mailing list?$/ do |count|
Mailing.count.should == count.to_i
end可能是由于数据库清理,但我保留了默认配置:截断
有什么想法吗?
PS:我应该像白痴一样刷新我的数据库,我看到邮件先被添加,然后被删除。
发布于 2011-03-16 04:23:22
我会删除行调试器
Then /^I should have ([0-9]+) mail in my mailing list?$/ do |count|
debugger
Mailing.count.should == count.to_i
end看看有多少邮件。
调试器将需要安装gem‘ruby-调试’或‘ruby-调试器19’。
如果Mailing.count是0,我会将调试器行移到测试的前面,直到我找到它的位置1,然后分离出它要到0的点或代码。
https://stackoverflow.com/questions/4511881
复制相似问题