Skip to content

Commit

Permalink
Rails2 features getting there with Aruba
Browse files Browse the repository at this point in the history
  • Loading branch information
aslakhellesoy committed Feb 25, 2010
1 parent 82f1722 commit a625331
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 91 deletions.
1 change: 1 addition & 0 deletions config/.gitignore
@@ -0,0 +1 @@
aruba-rvm.yml
1 change: 1 addition & 0 deletions cucumber-rails.gemspec
Expand Up @@ -23,6 +23,7 @@ Gem::Specification.new do |s|
"Rakefile",
"VERSION",
"cucumber-rails.gemspec",
"features/run_rails2.feature",
"features/skeleton_rails2.feature",
"features/skeleton_rails3.feature",
"features/step_definitions/cucumber_rails_steps.rb",
Expand Down
2 changes: 1 addition & 1 deletion dev_tasks/cucumber.rake
Expand Up @@ -11,7 +11,7 @@ namespace :cucumber do

desc "Prepare RVM environments for Cucumber"
task :prepare do
Cucumber::Rails::Rvm.each do |rvm|
Cucumber::Rails::RvmXX.each do |rvm|
rvm.rvm('-S rake install')
end
end
Expand Down
22 changes: 13 additions & 9 deletions features/run_rails2.feature
Expand Up @@ -3,13 +3,17 @@ Feature: Run rails2
Cucumber-Rails should work on major versions
of Rails2 and Ruby

Background: A full Rails app
Given I'm using Ruby 1.8.7 and Rails 2.3.5
And a Rails app "rails-2-app"
And I run "script/generate cucumber" in the app

Scenario: Generate a simple feature
When I run "script/generate feature post title:string body:text published:boolean" in the app
And I run "script/generate scaffold post title:string body:text published:boolean" in the app
And I run "rake db:migrate" in the app
And I run "rake cucumber" in the app
Given I am using rvm "1.8.7"
And I am using rvm gemset "cucumber-rails-2.3.5"
And I run "rails rails-2-app"
And I cd to "rails-2-app"
And I run "ruby script/generate cucumber --capybara"
And I run "script/generate feature post title:string body:text published:boolean"
And I run "script/generate scaffold post title:string body:text published:boolean"
And I run "rake db:migrate"
When I run "rake cucumber"
Then it should pass with:
"""
Jalla
"""
69 changes: 19 additions & 50 deletions features/skeleton_rails2.feature
Expand Up @@ -3,61 +3,30 @@ Feature: Rails 2 script/generate cucumber
As a Rails developer
I want to have the Cucumber skeleton generated automatically

Scenario: Rails 2
Given I'm using Ruby 1.8.7 and Rails 2.3.5
And a Rails app "rails-2-app"
When I run "script/generate cucumber" in the app
Then I get the following new files and directories
| name |
Scenario Outline: Rails 2 with webrat
Given I am using rvm "1.8.7"
And I am using rvm gemset "cucumber-rails-2.3.5"
When I run "rails rails-2-app"
Then it should pass with:
"""
create README
"""
And I cd to "rails-2-app"
When I run "ruby script/generate cucumber <webtesting> <assertions> <spork>"
Then the following files should exist:
| config/cucumber.yml |
| config/environments/cucumber.rb |
| script/cucumber |
| features/step_definitions |
| features/step_definitions/web_steps.rb |
| features/support |
| features/support/env.rb |
| features/support/paths.rb |
| lib/tasks |
| lib/tasks/cucumber.rake |
And the file "features/support/env.rb" should contain "<env_rb_1>"
And the file "features/support/env.rb" should contain "<env_rb_2>"
And the file "config/environments/cucumber.rb" should contain "<cucumber_rb_1>"
And the file "config/environments/cucumber.rb" should contain "<cucumber_rb_2>"

Scenario: Rails 2 with Webrat
Given I'm using Ruby 1.8.7 and Rails 2.3.5
And a Rails app "rails-2-app"
When I run "script/generate cucumber --webrat" in the app
Then the files are configured for Webrat
| name | contents |
| config/environments/cucumber.rb | config.gem 'webrat' |
| features/support/env.rb | require 'webrat' |
| features/support/env.rb | require 'webrat/core/matchers' |

Scenario: Rails 2 with Capybara
Given I'm using Ruby 1.8.7 and Rails 2.3.5
And a Rails app "rails-2-app"
When I run "script/generate cucumber --capybara" in the app
Then the files are configured for Capybara
| name | contents |
| config/environments/cucumber.rb | config.gem 'capybara' |
| features/support/env.rb | require 'capybara/rails' |
| features/support/env.rb | require 'capybara/cucumber' |
| features/support/env.rb | require 'capybara/session' |
| features/support/env.rb | require 'cucumber/rails/capybara_javascript_emulation' |

# I can't actually find any identifying behaviour here -
# maybe spec that it doesn't have RSpec references?
# or add something into the generator?
Scenario: Rails 2 with Test::Unit
Given I'm using Ruby 1.8.7 and Rails 2.3.5
And a Rails app "rails-2-app"
When I run "script/generate cucumber --testunit" in the app
Then the files are configured for Capybara
| name | contents |

Scenario: Rails 2 with Test::Unit
Given I'm using Ruby 1.8.7 and Rails 2.3.5
And a Rails app "rails-2-app"
When I run "script/generate cucumber --rspec" in the app
Then the files are configured for Capybara
| name | contents |
| config/environments/cucumber.rb | config.gem 'rspec' |
| config/environments/cucumber.rb | config.gem 'rspec-rails' |
| features/support/env.rb | require 'cucumber/rails/rspec' |
Examples:
| webtesting | assertions | spork | env_rb_1 | env_rb_2 | cucumber_rb_1 | cucumber_rb_2 |
| --webrat | --rspec | | require 'cucumber/rails/rspec' | require 'webrat' | config.gem 'webrat' | config.gem 'rspec-rails' |
| --capybara | --testunit | | require 'cucumber/rails/world' | require 'capybara/rails' | config.gem 'capybara' | config.gem 'database_cleaner' |
24 changes: 0 additions & 24 deletions features/step_definitions/cucumber_rails_steps.rb

This file was deleted.

7 changes: 1 addition & 6 deletions features/support/env.rb
@@ -1,9 +1,4 @@
$:.unshift(File.dirname(__FILE__) + '/../../lib')
require 'fileutils'
require 'rubygems'
require 'spec'

Before do
FileUtils.rm_rf("tmp") if File.directory?("tmp")
Dir.mkdir("tmp")
end
require 'aruba'
2 changes: 1 addition & 1 deletion lib/cucumber/rails/rvm.rb
@@ -1,7 +1,7 @@
module Cucumber
module Rails
# This class is only used for testing Cucumber-Rails
class Rvm #:nodoc:
class RvmXX #:nodoc:
RVMS = YAML.load_file(File.dirname(__FILE__) + '/../../../rvm.yml')

class << self
Expand Down

0 comments on commit a625331

Please sign in to comment.