2
votes

I would like to be able do something like the following:

@javascript @disallow_cookies
Scenario: Test Something that depends on cookies

How would I write the @disallow_cookies cucumber hook to achieve this?

I am using the following:

  • gem 'thin', '1.2.11'
  • gem 'cucumber-rails' , '1.0.4'
  • gem 'database_cleaner', '0.6.7'
  • gem 'capybara', '1.1.2'
  • gem 'capybara-firebug','0.0.10'
  • gem 'selenium-webdriver', '2.14.0'

Thanks!

1

1 Answers

0
votes

This is an old question but here goes. Create a before hook for the tag @disallow_cookies.

Before('@disallow_cookies') do
    profile = Selenium::WebDriver::Firefox::Profile.new
    profile['network.cookie.cookieBehavior'] = 2 # disables all kind of cookies

    Capybara::Selenium::Driver.new(app, :browser => :firefox, :profile => profile) 
end

Assuming that you are creating the driver in the general before hook you should be fine. I haven't run this code but it is where I would start the process.