cucumber

Testing HABTM associations with rails/cucumber.

How am I supposed to test the typical User <-habtm-> Groups story. My Users and groups are created with factory_girl, it means I don't know the group id so I cannot ask webrat to check the checkbox. Thank you for any webrat steps hints ...

BDD and API calls you don't want to make during tests

I am working on a Rails app that allows you to create a configuration and then launch a server at EC2 with this configuration. So far I've been using cucumber for BDD and was very happy with that. However, now I want to pick a configuration and actually launch the server. Due to cost and performance issues I don't want to actually launch...

How can I check with cucumber & webrat & selenium that a selector/tag exists exactly two times in a response?

I used following step-definition with cucumber and webrat and everything worked fine: Then /^I should see "([^\"]*)" worker in the workerlist/ do |number| response.should have_selector("td.worker_name", :count=>number) end I have moved now to selenium and "somehow" the have_selector doesn't take a :count parameter anymore. I get fo...

Cucumber and WebRat in Selenium mode: Can't start mongrel_rails when using gem bundle

I'm using gem bundler (v.0.9.6) and Rails 2.3.5, rubygems 1.3.6 and ruby 1.8.7 (On Snow Leopard). My Gemfile looks like this: source :rubyforge source "http://gems.github.com" gem "rails", "2.3.5" gem "ruby-debug" gem "activemerchant", :require => 'active_merchant' gem "hpricot" gem "nokogiri" gem "state_machine" gem "fastercsv" gem "y...

How to use Cucumber in forms with custom labels

I'm trying to learn how to use cucumber and got this issue: I have a form that as: <p> <%= f.label :name, "Nome" %><br /> <%= f.text_field :name %> </p> And in my cucumber feature I have: And I fill in "name" with "Reitoria do Porto" This make the test fail with: And I fill in "name" with "Reitoria do Porto" ...

Requiring authentication file from lib with cucumber

I am trying out Cucumber for the first time and I've come accross an issue. I am try to use RyanB's nifty authentication generator, but it seems I can't use the helper methods when running my Cucumber features. Part of my feature giving me problems: when I am on the new book page # features/step_defin...

How can I see what capybara found in a failing cucumber step?

I started migrating from cucumber + webrat to cucumber + capybara. Now the behavior of "I should see " seems to be somewhat different. Most of these fail now, although I didn't change anything on the page. I replaced the snippet that should be found with some stuff that is on every page and for some text it works and for other text it do...

cucumber debugger not stopping

Hi there! I'm trying to debug a simple BDD test using cucumber. In order to do that, I inserted a debugger statement where I would like to break the control flow. But it seems that cucumber ignores this statement. I'm running the tests executing: rake cucumber:wip It's rather simple, so I think the code isn' t worth pasting here. T...

Undefined method `add' on a cucumber step that usually works.

I have a path defined: when /the admin home\s?page/ "/admin/" I have scenario that is passing: Scenario: Let admins see the admin homepage Given "pojo" is logged in And "pojo" is an "admin" And I am on the admin home page Then I should see "Hi there." And I have a scenario that is failing: Scenario: Review fl...

Cucumber Textmate Highlighting

I am trying to get highlighting for Cucumber to work with Textmate. I already installed the Cucumber Textmate Bundle (which is supposed to include the highlighting). I am working with Ryan Bates' Railscasts theme (description for it is in the about page) for textmate, but for some reason In order to, As a, I want, etc do not get highligh...

Rack::Test not able to find web app cookie

While testing a Sinatra app with Cucumber, Rack::Test was not able to find the cookie that my app created, even though I could clearly see that it was in the Rack::Test::CookieJar object by dumping it with "p". ...

Record id with cucumber and pickle [Rails]

I am using Cucumber, Webrat, and Pickle in conjunction. When I write a scenario, I can do something like this: Given a product exists with title: "Bread" When I go to the edit page for that product And I fill in "Title" with "Milk" And I press "Save changes" Then I should see "Successfully edited product." And I should be on that car's ...

Running Webrat with Selenium

I set up Cucumber+Webrat+Selenium according to this article. Whenever I run my server, though, I keep getting: ERROR Server Exception: sessionId should not be null; has this session been started yet? (Selenium::CommandError) Two hours on Google haven't done much for me. Could you please help out? Thanks! I am working on Ruby 1.8.7 and R...

Where to find documentation for Capybara? [Rails]

I am working with Cucumber and Capybara and am looking to test a basic javascript confirmation box. I am aware Capybara uses Selenium 2.0 (not RC) for its javascript testing. Where can I find the documentation for testing a simple confirm js dialog and other features of capybara + selenium? Thanks! ...

How to test a confirm dialog with Cucumber?

I am using Ruby on Rails with Cucumber and Capybara. How would I go about testing a simple confirm command ("Are you sure?")? Also, where could I find further documentation on this issue? Thank you! ...

Having trouble getting cucumber 6.3 to run on rails 2.3.4

Hi, I am trying to to get cucumber to run with no luck. Here is the error I am seeing: cucumber features Using the default profile... no such file to load -- test/ (MissingSourceFile) /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in gem_original_require' /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in poly...

Cucumber Record ID

Given the following in Cucumber: Given a car exists with title: "Toyota" And I go to path "/cars" And I follow "Toyota Page" And I should be on path "/cars/CAR_ID" Where CAR_ID is the ID of the car titled "Toyota". How do I figure out that ID? Thanks! ...

Testing Rails Metal With Cucumber/rSpec

Hi, I'm trying to stub a third party service that my metal talks to. It seems rspec mocks/stubs don't extend all the way to the Metal. When I call stubbed methods on objects, it calls the original one and not the stubbed one. Any idea of how I can have rSpec doubles extend all the way to the metal? Thanks. -Nash ...

SpeckFlow vs Cuke4Nuke vs Cucumber+IR

Hi all: Having a look at BDD frmaeworks and I can't help but wonder which one would suit us better. I like cucumber because, they have been there doing bdd for a good while(since early 2008) and I like ruby, however, we are a .net shop and although I find Ruby very friendly, other people doesn't; and I think that is fair enough (to a p...

Cucumber can't find installed gems

environment/cucumber.rb: ... # gem dependencies config.gem 'cucumber-rails', :lib => false, :version => '>=0.3.0' unless File.directory?(File.join(Rails.root, 'vend config.gem 'database_cleaner', :lib => false, :version => '>=0.5.0' unless File.directory?(File.join(Rails.root, 'vend config.gem 'webrat', :lib => false, :versi...