Как отлаживать тесты на огурцы?

У меня есть:

When /^(?:|I )follow "([^"]*)"(?: within "([^"]*)")?$/ do |link, selector|  
  with_scope(selector) do
   click_link(link)
  end
end

Который я вызываю из:

Background:
  Given I am an existing admin user
  When I follow "CLIENTS"

мой HTML такой :

<a class="active" href="/companies"><h2>CLIENTS</h2></a>

, и я продолжаю получать эту ошибку:

.F-.F--U-----U

(::) failed steps (::)

no link with title, id or text 'CLIENTS' found (Capybara::ElementNotFound)
(eval):2:in `click_link'
./features/step_definitions/web_steps.rb:54:in `block (2 levels) in <top (required)>'
./features/step_definitions/web_steps.rb:14:in `with_scope'
./features/step_definitions/web_steps.rb:53:in `/^(?:|I )follow "([^"]*)"(?: within "([^"]*)")?$/'
features/client_add.feature:8:in `When I follow "CLIENTS"'

Я попробовал несколько вещей из:

When I follow "<h2>CLIENTS</h2>"

и даже попробовал save_and_open_page, который должен открыть браузер и получить те же результаты:

Given /^I am an existing admin user$/ do
  role_user = FactoryGirl.create(:role_user)
  admin_user = role_user.user
  sign_in(admin_user)
  save_and_open_page
end

Есть ли способ распечатать HTML или какой-то способ выяснить, почему мой тест провал?

5
задан the Tin Man 16 April 2012 в 17:01
поделиться