JoseLuis Torres
JoseLuis Torres

Reputation: 416

How to start with rspec and cucumber with an old RoR project?

How can I start using Rspec with an existing Ruby on Rails 2.3.5 project without being able to start using the last versions of rspec and cucumber?

I'm reading The Rspec Book but it covers different versions of rspec and cucumber I have started with new features but I'm not sure how can I start with existing ones I've found info to test ajax request but it is poor and obscure

The documentation of rspec online it's confusing for me too. http://rubydoc.info/gems/rspec-rails/1.3.2

Has anyone has faced the same issue when starting with TDD?

Upvotes: 1

Views: 209

Answers (1)

Jesse Wolgamott
Jesse Wolgamott

Reputation: 40277

If you are using Ruby 1.8.7 and Rails 2.3, then to test javascript (including AJAX), you can use this set of gems in your Gemfile. This group of gems will run javascript.

group :cucumber do
  gem 'capybara', '0.3.9'
  gem 'capybara-envjs', '0.1.6'
  gem 'capybara-envjs-fixes', '0.0.5'
  gem 'cucumber', '0.9.2'
  gem 'cucumber-rails', '0.3.2'
  gem 'launchy', '0.3.7'
end

This work came from the johnson gem (ruby 1.8.7 only) and is no longer maintained, but worked (slowly'ish) in the 1.8.7/rails 2.3.x era.

You'll mark features you want to execute with javascript with:

Feature: View dashboards
  In order to see my data
  I want to view my dashboard view

  @javascript
  Scenario: View dashboard
    Given I am logged in
    ...

Upvotes: 1

Related Questions