webrat

Session variables with Cucumber Stories

丶灬走出姿态 提交于 2019-11-29 21:05:11
I am working on some Cucumber stories for a 'sign up' application which has a number of steps. Rather then writing a Huuuuuuuge story to cover all the steps at once, which would be bad , I'd rather work through each action in the controller like a regular user. My problem here is that I am storing the account ID which is created in the first step as a session variable, so when step 2, step 3 etc are visited the existing registration data is loaded. I'm aware of being able to access controller.session[..] within RSpec specifications however when I try to do this in Cucumber stories it fails

Cucumber + Webrat + Selenium guide

橙三吉。 提交于 2019-11-28 23:04:55
问题 I have been using Cucumber and Webrat for a while. I now need to start writing behaviour that involve AJAX interactions so I was thinking to use the Selenium adapter for Webrat. Can anyone point out a easy and updated step-by-step guide for installing and configuring selenium+webrat+cucumber? I would like to be able to mix javascript scenario with non-javascript scenarios. 回答1: I'm using Selenium with rspec on my project and generate code from a custom formatter for Selenium IDE. There is

HTTP basic auth for Capybara

夙愿已清 提交于 2019-11-28 04:55:05
I'm writing some RSpec tests for my Rails 3 application and trying to switch from Webrat to Capybara . So far so good but the application uses HTTP basic auth to authorize my admin user, any idea how I can test that with Capybara? Here is my current Webrat step: it 'should authenticate for admin' do basic_auth('user', 'secret') visit '/admin' response.status.should eql 200 response.status.should_not eql 401 end How do I do this with Capybara? Thanks! I got it to work using page.driver.basic_authorize(name, password) instead Update : At the moment, after a Capybara upgrade, I'm using this pile

HTTP basic auth for Capybara

北城以北 提交于 2019-11-27 00:42:48
问题 I'm writing some RSpec tests for my Rails 3 application and trying to switch from Webrat to Capybara. So far so good but the application uses HTTP basic auth to authorize my admin user, any idea how I can test that with Capybara? Here is my current Webrat step: it 'should authenticate for admin' do basic_auth('user', 'secret') visit '/admin' response.status.should eql 200 response.status.should_not eql 401 end How do I do this with Capybara? Thanks! 回答1: I got it to work using page.driver

How do you POST to a URL in Capybara?

不羁的心 提交于 2019-11-26 09:09:26
问题 Just switched from Cucumber+Webrat to Cucumber+Capybara and I am wondering how you can POST content to a URL in Capybara. In Cucumber+Webrat I was able to have a step: When /^I send \"([^\\\"]*)\" to \"([^\\\"]*)\"$/ do |file, project| proj = Project.find(:first, :conditions => \"name=\'#{project}\'\") f = File.new(File.join(::Rails.root.to_s, file)) visit \"project/\" + proj.id.to_s + \"/upload\", :post, {:upload_path => File.join(::Rails.root.to_s, file)} end However, the Capybara