cucumber

Can't get Cucumber script to pass when trying to follow a link in a table

I am using Rails 3 with Cucumber, Capybara and Factory_Girl. I am trying to test following the "Show" link for just one of the rows on an HTML table. I am using the syntax: And I follow "Show" within "Net 30" I gives me the following error: unexpected '30' after 'DESCENDANT_SELECTOR' (Nokogiri::CSS::SyntaxError) /System/Library/Fra...

Run cucumber tests on heroku

I am thinking of running my cucumber tests on my rails app when it is running on heroku. Is this a sane way to check for differences between development environment and deployment environment? Does anybody have any experience of this kind of scenario? Rake -T tells me "cucumber rake task not available (cucumber not installed)" even thou...

How to verify the page title

I am using cucumber and capybara along with rails 2.3.9. How do I verify the page title. I try to have a good page title for every GET request and would like to verify that in my tests. ...

A better way to build factory using factory_girl in cucumber

I am using cucumber and factory_girl in a rails 2.3.9 project. Here is one of the givens in one of my features. Given a user with first_name "Mary" and last_name "Jane" I started building the regex where I could capture following items. model = user first_name = "Mary" last_name = "Jane" Factory(:user, :first_name => 'Mary', :last_...

How to verify number of records using capybara

I am using capybara along with cucumber on a Rails 2.3.9 project. I have users index page and I have two records there. Using capybara how do I assert that there are only two records in the page. HTML structure is like this <div class='records'> <li>record 1<li> <li>record 2 </li> </div> ...

Initialize cucumber folder structure?

Is there an easy way to initialize a cucumber folder structure like rails generators? ...

Rails: Cucumber forgetting CanCan Authorisations

Hi folks, I'm trying to write up some cucumber tests to ensure cancan permissions are set correctly, and I'm having an odd problem: When I log in through the following code, capybara says I've logged in as expected. However, when I then go to a resource which requires the given login, I get CanCan's "not authorized" message. Capybara p...

How to verify an link points to the right image and has the right target and title

I am using capybara with cucumber in rails 2.3.9 application. Here is my html code <a href="http://twitter.com/dorelal" target="_blank" title="twitter"> <img alt="twitter" src="/images/social/twitter.png?1284129939" /> </a> I want to verify following items image should be ending with twitter.png image alt should be "twitter" link ...

Cucumber: Testing multiple different multi-line scenarios with a single scenario outline

So, I'm writing a tool, that, as one of its core features, needs to be able to ingest a specific vertical-bar delimited format. I'm using cucumber, and I want to be able to have a Scenario saying "If the file doesn't have this, then it should reject the file." The trick is that there's a couple ways to "not have this", and each way req...

Textmate cucumber bundle issues - 'Run Feature' producing errors.

From a cucumber feature file when I go to 'Run features' Im getting the error below in the popup box that appears. How do I fix this? /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in gem_original_require': no such file to load -- /Users/richie/Projects/i9/Tornelo/.bundle/environment (LoadError) from /Library/Ruby/Site/1.8/ru...

How do I simulate clicking on a link when the link is an image

I am using capybara with cucumber on a rails 2.3.9 project. This is my markup <a href='/pemail/new/21' title='send email'> <img alt='email' src='/images/email.png?1286474'> </a> How do I simulate clicking on the above link. ...

webrat + nokogiri + css selectors + whitespaces = Nightmare

I need to test with Cucumber/Webrat the presence of this button: <%=submit_tag 'Get it'%> But when I use this custom step: And I should see a button with a value of "Get it" that is: Then /^I should see a button with a value of "([^\"]*)"$/ do |value| response.should have_selector("form input[value=#{value}]") end I get: ...

Rails3, Cucumber, Capybara, File upload => bad content body (EOFError) ?

I'm having a hard time getting a simple file upload test working. I'm using Rails 3.0.0 on ruby 1.9.2 with Cucumber and Capybara. View: <%= form_tag "/upload/create", :multipart => true do %> <label for="file">File to Upload:</label> <%= file_field_tag "file" %> <%= submit_tag "Upload" %> <% end %> Cucumber Step: When /^I upl...

SimpleCov rspec and cucumber separately

Could you tell me how to setup simplecov to test models with rspec and controller with cucumber only? I don't like it that rspec and cucumber coverage are mixed together... ...

Using cucumber with jruby

I'm working on my company's intranet with cucumber 0.8.5 gherkin 2.1.5 And I'm trying to switch from using ruby 1.8.7 to jruby 1.5.1 However, whenever I try to run cucumber from jruby, I get an error: % jruby -S cucumber /usr/local/src/jruby-1.5.1/lib/ruby/site_rub/1.8/rubygems/custom_require.rb:31:in `require': no such file to lo...

BDD with Cucumber and rspec - when is this redundant?

A Rails/tool specific version of: How deep are your unit tests? Right now, I currently write: Cucumber features (integration tests) - these test against the HTML/JS that is returned by our app, but sometimes also tests other things, like calls to third-party services. RSpec controller tests (functional tests), originally only if the c...

Ruby on Rails. Bundler. Cucumber. rake aborted! Command failed with status (1)

Hi. I have a problem using Bundler and Cucumber with Rails 3. When I run $ rake cucumber I get the following output: bundle exec /usr/local/bin/ruby -I "/usr/local/lib/ruby/gems/1.9.1/gems/cucumber- 0.8.5/lib:lib" "/usr/local/lib/ruby/gems/1.9.1/gems/cucumber-0.8.5/bin/cucumber" --profile default (in /home/<username>/practice/rails/...

Rails, Cucumber and localized messages.

I'm writing an application and I'm using localization everywhere I can. The problem is that I would like to test it using cucumber. I don't want to update the tests everytime the translation is changed. Is it possible to make cucumber understand something like that: When I am logged in Then I should see t(:login_ok) ...

Cucumber: how to switch sessions in Rails (multi-session)

I need to change session during one cucumber scenario. For example Given session name is "1st unauthenticated user" And make some things Given session name is "2st unauthenticated user" And make some other things I found a solution, but it doesn't work with Rails 3, Cucumber and Capybara. Are there any other solutions? ...

Selenium can't launch firefox without sudo in Rails cucumber testing

I have a weird bug when trying to run selenium with cucumber testing in Rails 3. (This is under an RVM running 1.8.7) My colleague's dev environment works just fine but when I try and run "AUTOFEATURE=true autotest" or "rake features" I get the following error: unable to start Firefox cleanly, args: [] (Selenium::WebDriver::Error::WebD...