I'm having trouble getting a simple CSS selector match working in Cucumber/Webrat.
My step specification begins:
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
The result I'm getting is:
!!! 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'
Presumably the http://www.example.com part of what is being checked comes from Webrat - it's not mine. But my /login page contains:
<form accept-charset="UTF-8" action="/user_sessions" class="new_user_session" id="new_user_session" method="post"><div style="display:none">
I would have expected that to match the selector (it certainly matches a form.new_user_session selector in the stylesheet). So what am I missing?