我试图让我的测试通过,但是黄瓜失败了一个非常令人困惑的错误,可能是模板相关的,我无法理解和解决。
这是我的Gemfile和Gemfile.lock:
https://gist.github.com/ngw/dada0c0658a9ef8b5573
您可以假设截至2015年3月28日的所有内容均为最新版本,包括rails,cucumber,ruby(2.2.0p0),database_cleaner等。
无法呈现的视图是一个设计视图,可以在浏览器上呈现。
以下是引发的例外情况:
Background: # features/users/sign_up.feature:6
Given I am not logged in # features/step_definitions/user_steps.rb:9
Scenario: User signs up with valid data # features/users/sign_up.feature:9
When I sign up with valid user data # features/step_definitions/user_steps.rb:13
undefined method `[]' for nil:NilClass
(in /Users/ngw/petswantpats/app/assets/stylesheets/application.css) (ActionView::Template::Error)
./app/views/layouts/application.html.haml:6:in `_app_views_layouts_application_html_haml___302582815389802583_70306431437360'
./features/step_definitions/user_steps.rb:6:in `sign_up'
./features/step_definitions/user_steps.rb:15:in `/^I sign up with valid user data$/'
./features/support/database_cleaner.rb:11:in `block in <top (required)>'
features/users/sign_up.feature:10:in `When I sign up with valid user data'
Then I should see a successful sign up message # features/step_definitions/user_steps.rb:18
以下是有罪的观点:
https://gist.github.com/ngw/95c0a0e6db86cfa0357f
以下是application.css.scss的内容:
https://gist.github.com/ngw/ab766e0cfb5167d2d76a
失败的步骤:
def sign_up
visit '/users/sign_up'
end
这与JS有关吗?我使用了与水豚的恶作剧,我的env.rb有:
require 'capybara/poltergeist'
Capybara.javascript_driver = :poltergeist
如果我使用launchy在浏览器中打开它,我有一个白页(???),而我的test.log中没有其他可用的信息......
有人可以帮我解决这个问题吗? TIA