cucumber

Trouble Running Cucumber with Stephen Celis config app

I'm trying to get cucumber up and running with a config app I use in Rails. The config app is used to set various config options in Rails, for example the site value for ActiveResource: self.site = "http://#{App['domain']}#{App['path']}" When I run "cucumber features", I can get an error bad URI(absolute but no path): http:// (URI::...

Using webrat's contain(text) matcher with haml

I'm using the following webrat matcher: response.should contain(text) With the following haml: %p You have = current_user.credits credits I've written the cucumber step 'Then I should see "You have 10 credits"', which uses the webrat matcher above. The step fails, webrat does not find the text in the response because the ham...

WatiN pressTab doesn't press tab

Has anyone found a means to press tab with watiN in Internet explorer? ...

Testing Pagination Features with Cucumber

I am learning and liking cucumber, and now have a feature I'm not sure of the best way to proceed on via BDD: pagination. I have scenarios (in my mind) where there are zero pages, one page, several pages, etc. and where I want to make sure certain records are on certain pages, make sure the "next" button is not a link when on the last pa...

How do I have a negative scenario with Cucumber in Rails?

I have a negative scenario to test with Cucumber. Specifically, I want to make sure that when someone posts a URL with an invalid handle then the site returns an error. My scenario looks like: Scenario: create person with too short a handle When person named "Fred" with handle "tooshort" updates Then I should get a 500 ...

Cucumber on IronRuby incredibly slow to start?

I'm using IronRuby 0.9.1 and cucumber 0.4.0. I also have MRI 1.8 installed. I've created the following wrapper script (icucumber.bat) to run cucumber on IronRuby @ECHO OFF REM This is to tell IronRuby where to find gems. SET GEM_PATH=c:\ruby\lib\ruby\gems\1.8 @"C:\ironruby\bin\ir.exe" "c:\ruby\bin\cucumber" %* Navigating to cucumber-...

Practicing BDD with integration tests -- do I need unit tests too?

At present, my development process flows like this: I describe the expected behaviour as an integration test using using WebRat I write the Ruby on Rails code to provide that behaviour, so passing the test I refactor, ensuring the tests still pass at the end of the process I write the next integration test It seems to me that by defi...

Unobtrusive way testing JavaScript with Cucumber?

Hi, what do you prefer for testing JavaScript apps using Cucumber? I never did it before - I only used Webrat for testing plain html. I have tried Selenium, but it frustrated me and I didn't find any good documentation about Cucumber in combination with Selenium. Best regards ...

Cucumber with Rails on Windows

Hi, I am trying to use Cucumber for a Rails project on Windows. Unfortunately the time it takes to run a scenario is making BDD impossible. I understand this is largely due to the time taken by Rails to load up under windows. Does anyone have any ideas about how I can speed things up. e.g Is it possible to call Cucumber inside a Rails c...

Cucumber/Webrat: follow link by CSS class?

Hello there, is it possible to follow a link by it's class name instead of the id, text or title? Given I have (haha, cucumber insider he?) the following html code: <div id="some_information_container"> <a href="edit" class="edit_button">Translation here</a> </div> I do not want to match by text because I'd have to care about the ...

FixtureReplacement with Cucumber

Hi, I am using Cucumber with Selenium, FixtureReplacement and DatabaseCleaner. Funnily enough, my data I created with FixtureReplacement is not accessible from my tests. I have added an own rails environment for selenium and I am using an own profile for my enhanced selenium features. My cucumber setup for the selenium profile is: We...

Testing associations with cucumber

Hi there, I'm new to rails and cucumber and I'm trying to test the following scenario Background: Given I have a Group named Group 1 And I go to the list of groups And I have the following users records | name | description | group_id | | user 1 | | 1 | | user 2 | | 1 | When...

BDD with Cucumber and MySQL — auto increment issues

I am writing some Cucumber features for my RoR app that insert records into the database then send a query to my XML API. Because of the nature of my requests (hardcoded XML) I need to know what the ID of a row is going to be. Here is my Scenario: Scenario: Client requests call info Given There is a call like: | id | calle...

Rake stats and Cucumber

Hello, I'm using Cucumber with RSpec in a Rails project. When I use the "rake stats" task, I get the following : +----------------------+-------+-------+---------+---------+-----+-------+ | Name | Lines | LOC | Classes | Methods | M/C | LOC/M | +----------------------+-------+-------+---------+---------+-----+-------+...

Cucumber new paths

The answer for this question should be trivial. Is there any way to get in to the show action path to a given AR object within cucumber paths.(I am using factories to set up test AR objects). I can refer in paths.rb new, edit and index paths but when it comes to show action it needs to specify the object and is there a way to refer that...

Dynamic data in Cucumber tables

I have a Cucumber table, one of the fields is a date which I would like to have populated with todays date. Is there a way of doing this without having to hard code todays date into the table? Basically I would like to enter Time.now.strftime("%Y-%m-%d") into the table and not have it break. ...

Checking an element is absent using WebRat

The following works just fine: Then /^I should see a button called "([^\"]*)"$/ do |name| response.should have_selector("li") do |li| li.should have_selector("a") do |a| a.should contain(name) end end end Now I need to complement it with a step like this: Then /^I should not see a button called "([^\"]*)"$/ do |name...

should redirect to not working

redirect_to is failing for me in my cucumber tests. The step_definition method is Then /^I should be redirected to "(.*)"$/ do |url| response.should redirect_to(url) end In Rails 2.3.3 I'm doing: redirect_to some_url, :status => 301 and return false I'm running that from the application_controller.rb and returning false. When I...

What's the best practice for setting up associations with factory_girl in cucumber?

I normally use this step to set up records with factory_girl: Given /^the following (.+) records?:$/ do |factory, table| table.hashes.each do |hash| Factory(factory, hash) end end And here's my work-around when setting up associations: Given the following group record: | id | name | | 1 | foo | And the following item re...

Annoying Webrat/Selenium Warning when changing domain names

When I'm working with AJAX + Webrat in Selenium mode, I'll often have to specify real domains and subdomains. Consequentially I'll get this message a lot: 14:00:45.222 WARN - you appear to be changing domains from http://test.host:3001 to http://elabs.test.host:3001/dashboard this may lead to a 'Permission denied' from the...