Cucumber + Capybara + Selenium firefox открывает example.com, а не мое приложение

Я использовал cucumber + webrat, но мне потребовалась дополнительная совместимость с Rails 3 и тестирование javascript, поэтому я заменил его на capybara + selenium. В настоящее время я использую Rails 3.0.7, Cucumber 0.10.2, caybara 1.0.0.beta1.

Проблема: когда я запускаю сценарий javascript, firefox открывает "http://www.iana.org/domains/example/ "или" www.example.com "вместо моего приложения rails.

Я уверен, что мне не хватает небольшой настройки, но я могу ' Я не нашел его, и это поставило меня в тупик уже пару дней.

В любом случае, мой гем-файл гласит:

group :development, :test do
  gem 'cucumber'
  gem 'cucumber-rails', ">= 0.3.2"
  gem 'pickle'
  gem "launchy"
  gem "rspec-rails"
  gem "Selenium"
  gem "selenium-client"
  gem "selenium-webdriver"
  gem "database_cleaner"
  gem "factory_girl_rails"
  gem "capybara"
  gem "escape_utils"
end

Функция:

  @wip
  @javascript
  Scenario: Calculate 1 recipe and be deducted a credit
    Given the following page records
      | name | permalink |
      | home | home      |
    And the following role records
      | name       |
      | SuperAdmin |
      | Admin      |
      | Customer   |
    When  I register "adam" with password "password"
    And I go to the index
    Then I should see "5 credits"

Шаг, который открывает окно firefox:

    When /^I am logged in as "([^"]*)" with password "([^"]*)"$/ do |username, password|
  unless username.blank?
    visit(root_path)
    fill_in "user_session_username", :with => username
    fill_in "user_session_password", :with => password
    click_button "login"
    page.should have_content("Successfully logged in!")
  end
end

my features / support / env.rb:

   require 'cucumber/rails'
    require 'factory_girl'
    require 'ruby-debug'
    require 'selenium/client'
    # require 'capybara/cucumber' commented out because it doesn't want to work with it in
    Capybara.default_driver = :selenium

    Capybara.server_boot_timeout = 50
    Capybara.default_selector = :css

    begin
      DatabaseCleaner.strategy = :truncation
    rescue NameError
      raise "You need to add database_cleaner to your Gemfile (in the :test group) if you wish to use it."
    end

командная строка говорит:

    When I register "adam" with password "password"     # features/step_definiti
ons/web_steps.rb:229
      no link with title, id or text 'register' found (Capybara::ElementNotFound
)
      (eval):2:in `click_link'
      ./features/step_definitions/web_steps.rb:232:in `/^I register "([^"]*)" wi
th password "([^"]*)"$/'
      features\credit_behaviour.feature:30:in `When I register "adam" with passw
ord "password"'

Я новичок в Rails и Ruby, поэтому будьте спокойны с любыми предложениями, сказав, что ЛЮБАЯ помощь будет принята с благодарностью.

5
задан RickyD 26 May 2011 в 08:38
поделиться