我无法在Cucumber / Webrat中使用简单的CSS选择器匹配。
我的步骤规范开始了:
Then(/^I should see (.*)$/) do |outcome|
case outcome
when /^a login form$/
puts "!!! Checking #{current_url} for login form"
expect(response).to have_selector('form.new_user_session')
# and so on
我得到的结果是:
!!! Checking http://www.example.com/login for login form
RSpec::Expectations::ExpectationNotMetError: expected to find css "form.new_user_session" but there were no matches
./features/step_definitions/user_logs_in.rb:46:in `/^I should see (.*)$/'
features\user_logs_in.feature:10:in `Then I should see a login form'
据推测,被检查的http://www.example.com
部分来自Webrat - 它不是我的。但是我的/登录页面包含:
<form accept-charset="UTF-8" action="/user_sessions" class="new_user_session" id="new_user_session" method="post"><div style="display:none">
我希望期望匹配选择器(它肯定与样式表中的form.new_user_session
选择器匹配)。那我错过了什么?