Skip to content

Commit 6f26978

Browse files
committed
ZOMG closer to passing cuke suite
1 parent ae7c956 commit 6f26978

File tree

10 files changed

+42
-84
lines changed

10 files changed

+42
-84
lines changed

Gemfile

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,2 @@
1-
source "http://rubygems.org"
1+
source :rubygems
22
gemspec
3-
4-
gem 'cucumber', :path => '../cucumber' if File.directory?(File.dirname(__FILE__) + '/../cucumber')
5-
gem 'gherkin', :path => '../gherkin' if File.directory?(File.dirname(__FILE__) + '/../gherkin')
6-
gem 'aruba', :path => '../aruba' if File.directory?(File.dirname(__FILE__) + '/../aruba')

Rakefile

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,6 @@
11
# encoding: utf-8
22
require 'rubygems'
3-
require 'bundler'
4-
Bundler.setup
5-
6-
begin
7-
require 'jeweler'
8-
Jeweler::Tasks.new do |gemspec|
9-
gemspec.name = "cucumber-rails"
10-
gemspec.summary = "Cucumber Generators and Runtime for Rails"
11-
gemspec.description = "Cucumber Generators and Runtime for Rails"
12-
gemspec.email = "[email protected]"
13-
gemspec.homepage = "http://cukes.info"
14-
gemspec.authors = ["Dennis Blöte", "Aslak Hellesøy", "Rob Holland"]
15-
gemspec.homepage = "http://github.com/aslakhellesoy/cucumber-rails"
16-
17-
gemspec.add_bundler_dependencies
18-
end
19-
Jeweler::GemcutterTasks.new
20-
rescue LoadError
21-
puts "Jeweler not available. Install it with: sudo gem install jeweler"
22-
end
3+
require 'bundler/setup'
234

245
$:.unshift(File.dirname(__FILE__) + '/lib')
256
Dir["#{File.dirname(__FILE__)}/dev_tasks/*.rake"].sort.each { |ext| load ext }

cucumber-rails.gemspec

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,23 @@
11
# -*- encoding: utf-8 -*-
22
$LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
3+
require 'cucumber/rails/version'
34

45
Gem::Specification.new do |s|
56
s.name = 'cucumber-rails'
6-
s.version = '0.3.3'
7+
s.version = Cucumber::Rails::VERSION
78
s.authors = ["Aslak Hellesøy", "Dennis Blöte", "Rob Holland"]
89
s.description = "Cucumber Generators and Runtime for Rails"
910
s.summary = "cucumber-rails-#{s.version}"
1011
s.email = '[email protected]'
1112
s.homepage = "http://cukes.info"
1213

13-
s.platform = Gem::Platform::RUBY
14-
15-
s.add_dependency('cucumber', '~> 0.9.0') unless File.directory?(File.expand_path(File.dirname(__FILE__) + '/../cucumber'))
16-
s.add_dependency 'aruba', '~> 0.2.2' unless File.directory?(File.expand_path(File.dirname(__FILE__) + '/../aruba'))
17-
s.add_development_dependency('rspec-rails', "~> 2.0.0.beta.22")
14+
s.add_dependency('cucumber', '~> 0.9.4')
15+
s.add_development_dependency('aruba', '~> 0.2.7')
16+
s.add_development_dependency('rails', '~> 3.0.3')
17+
s.add_development_dependency('sqlite3-ruby', '~> 1.3.2')
18+
s.add_development_dependency('rspec-rails', Cucumber::Rails::DEPS['rspec-rails'])
19+
s.add_development_dependency('capybara', Cucumber::Rails::DEPS['capybara'])
20+
s.add_development_dependency('webrat', Cucumber::Rails::DEPS['webrat'])
1821

1922
s.rubygems_version = "1.3.7"
2023
s.files = `git ls-files`.split("\n")

features/rails3.feature

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@ Feature: Rails 3
55
of Rails 3 and Ruby, with Capybara, Spork and DatabaseCleaner
66

77
Scenario: Install Cucumber-Rails
8-
Given I'm using a clean gemset "cucumber-rails-3.0.0"
9-
Given a Rails "3.0.0" project named "rails-3-app" with Cucumber-Rails generated with "--capybara --rspec"
10-
8+
Given I have created a new Rails 3 app "rails-3-app" with cucumber-rails support
119
Then the following files should exist:
1210
| config/cucumber.yml |
1311
| script/cucumber |
@@ -19,14 +17,8 @@ Feature: Rails 3
1917
And the file "features/support/env.rb" should contain "require 'capybara/rails'"
2018

2119
Scenario: Run Cucumber
22-
Given a Rails "3.0.0" project named "rails-3-app" with Cucumber-Rails generated with "--capybara --rspec"
23-
And I append to "Gemfile" with:
24-
"""
25-
gem "cucumber", :path => '../../../../cucumber', :group => :test
26-
gem "gherkin", :path => '../../../../gherkin', :group => :test
27-
28-
"""
29-
And I successfully run "bundle install"
20+
Given I have created a new Rails 3 app "rails-3-app" with cucumber-rails support
21+
When I successfully run "bundle install"
3022
And I successfully run "rails generate cucumber:feature post title:string body:text published:boolean"
3123
And I successfully run "rails generate scaffold post title:string body:text published:boolean"
3224

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,13 @@
1-
Given /^I symlink "([^"]*)" to "([^"]*)"$/ do |source, target|
2-
source = File.expand_path(source, __FILE__)
3-
in_current_dir do
4-
target = File.expand_path(target)
5-
FileUtils.ln_s(source, target)
6-
end
7-
end
8-
91
Given /^I have created a new Rails 3 app "([^"]*)" with cucumber\-rails support$/ do |app_name|
102
steps %Q{
11-
Given I am using rvm "ruby-1.8.7-p249"
12-
And I am using rvm gemset "cucumber-rails-3.0.0.beta-gemset-1" with Gemfile:
13-
"""
14-
source :gemcutter
15-
gem 'rails', '3.0.0.rc'
16-
gem 'sqlite3-ruby', '1.2.5'
17-
gem 'capybara', '0.3.9'
18-
"""
193
When I successfully run "rails new rails-3-app"
204
Then it should pass with:
215
"""
226
README
237
"""
248
And I cd to "#{app_name}"
25-
And I symlink "../../.." to "vendor/plugins/cucumber-rails"
26-
And I append to "Gemfile" with:
27-
"""
28-
gem 'capybara', '0.3.9'
29-
gem 'cucumber', :path => '../../../../cucumber'
30-
31-
"""
32-
And I successfully run "rails generate cucumber:install --capybara"
9+
And I successfully run "rails generate cucumber:install"
3310
And I successfully run "bundle install"
34-
And I successfully run "bundle lock"
3511
And I successfully run "rake db:migrate"
3612
}
3713
end

features/support/env.rb

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
$:.unshift(File.dirname(__FILE__) + '/../../lib')
22
require 'rubygems'
3-
require 'bundler'
4-
Bundler.setup
3+
require 'bundler/setup'
54
require 'rspec/expectations'
6-
require 'aruba'
7-
require 'aruba/rails3'
8-
require 'aruba/rails2'
5+
require 'aruba/cucumber'

lib/cucumber/rails/version.rb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
module Cucumber
2+
module Rails
3+
VERSION = '0.4.0'
4+
DEPS = {
5+
'cucumber' => '~> 0.9.4',
6+
'rails' => '~> 3.0.3',
7+
'capybara' => '~> 0.4.0',
8+
'webrat' => '~> 0.7.2',
9+
'rspec-rails' => '~> 2.2.0',
10+
'sqlite3-ruby' => '~> 1.3.2',
11+
'aruba' => '~> 0.2.7'
12+
}
13+
end
14+
end

lib/generators/cucumber/feature/feature_generator.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
require File.join(File.dirname(__FILE__), 'feature_base')
33

44
module Cucumber
5-
class FeatureGenerator < Rails::Generators::NamedBase
5+
class FeatureGenerator < ::Rails::Generators::NamedBase
66

77
include Cucumber::Generators::FeatureBase
88

lib/generators/cucumber/install/install_base.rb

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
11
require 'rbconfig'
2+
#require 'cucumber/rails/version'
23

34
module Cucumber
45
module Generators
56
module InstallBase
6-
77
DEFAULT_SHEBANG = File.join(Config::CONFIG['bindir'], Config::CONFIG['ruby_install_name'])
8-
GEMS = {
9-
'capybara' => '0.3.9',
10-
'webrat' => '0.7.1',
11-
'rspec-rails' => '2.0.0.beta.22'
12-
}
138

149
def install_cucumber_rails(m)
1510
check_upgrade_limitations
@@ -19,8 +14,12 @@ def install_cucumber_rails(m)
1914
create_feature_support(m)
2015
create_tasks(m)
2116
create_database(m) unless options[:skip_database]
22-
add_gem(driver_from_options.to_s, GEMS[driver_from_options], :group => :test)
23-
add_gem(framework_from_options.to_s, GEMS[framework_from_options], :group => :test)
17+
18+
cucumber_rails_options = {:group => :test}
19+
cucumber_rails_options[:path] = '../../..'
20+
add_gem('cucumber-rails', Cucumber::Rails::VERSION, cucumber_rails_options)
21+
add_gem(driver_from_options.to_s, Cucumber::Rails::DEPS[driver_from_options.to_s], :group => :test)
22+
add_gem(framework_from_options.to_s, Cucumber::Rails::DEPS[framework_from_options.to_s], :group => :test)
2423
end
2524

2625
# Checks and prints the limitations

lib/generators/cucumber/install/install_generator.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
require File.join(File.dirname(__FILE__), 'install_base')
33

44
module Cucumber
5-
class InstallGenerator < Rails::Generators::Base
5+
class InstallGenerator < ::Rails::Generators::Base
66
include Cucumber::Generators::InstallBase
77

88
argument :language, :type => :string, :banner => "LANG", :optional => true
@@ -43,13 +43,13 @@ def cucumber_rails_env
4343
def framework_from_options
4444
return 'rspec-rails' if options[:rspec]
4545
return 'testunit' if options[:testunit]
46-
return nil
46+
return 'rspec-rails'
4747
end
4848

4949
def driver_from_options
5050
return 'webrat' if options[:webrat]
5151
return 'capybara' if options[:capybara]
52-
return nil
52+
return 'capybara'
5353
end
5454

5555
end

0 commit comments

Comments
 (0)