cucumber-rails 0.3.2 → 0.4.0.beta.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. data/.gitignore +2 -0
  2. data/.rspec +1 -0
  3. data/.rvmrc +1 -0
  4. data/Gemfile +2 -0
  5. data/History.txt +7 -0
  6. data/README.rdoc +2 -2
  7. data/Rakefile +3 -19
  8. data/cucumber-rails.gemspec +25 -106
  9. data/dev_tasks/rspec.rake +6 -11
  10. data/features/rails2.feature +5 -24
  11. data/features/rails3.feature +82 -56
  12. data/features/step_definitions/cucumber_rails_steps.rb +3 -25
  13. data/features/support/env.rb +3 -1
  14. data/generators/cucumber/cucumber_generator.rb +1 -17
  15. data/lib/cucumber/rails.rb +29 -0
  16. data/lib/cucumber/rails/capybara/javascript_emulation.rb +83 -0
  17. data/lib/cucumber/rails/capybara/select_dates_and_times.rb +43 -0
  18. data/lib/cucumber/rails/hooks/allow_rescue.rb +8 -0
  19. data/lib/cucumber/rails/hooks/database_cleaner.rb +25 -0
  20. data/lib/cucumber/rails/hooks/mail.rb +5 -0
  21. data/lib/cucumber/rails/rspec.rb +0 -3
  22. data/lib/cucumber/rails/version.rb +15 -0
  23. data/lib/cucumber/rails/world.rb +2 -36
  24. data/lib/cucumber/rails2.rb +16 -0
  25. data/lib/cucumber/rails2/action_controller.rb +29 -0
  26. data/lib/cucumber/rails3.rb +16 -0
  27. data/lib/cucumber/rails3/action_controller.rb +12 -0
  28. data/lib/cucumber/rails3/application.rb +17 -0
  29. data/lib/generators/cucumber/feature/feature_generator.rb +1 -1
  30. data/lib/generators/cucumber/install/install_base.rb +40 -53
  31. data/lib/generators/cucumber/install/install_generator.rb +10 -22
  32. data/spec/cucumber/web/tableish_spec.rb +47 -0
  33. data/spec/generators/cucumber/install/install_base_spec.rb +0 -9
  34. data/spec/spec_helper.rb +1 -4
  35. data/templates/install/step_definitions/capybara_steps.rb.erb +1 -1
  36. data/templates/install/step_definitions/web_steps_da.rb.erb +1 -1
  37. data/templates/install/step_definitions/web_steps_no.rb.erb +1 -1
  38. data/templates/install/step_definitions/web_steps_pt-BR.rb.erb +2 -1
  39. data/templates/install/support/_rails_each_run.rb.erb +16 -15
  40. data/templates/install/support/_rails_prefork.rb.erb +1 -12
  41. data/templates/install/support/capybara.rb +0 -4
  42. metadata +137 -30
  43. data/lib/cucumber/rails/action_controller.rb +0 -65
  44. data/lib/cucumber/rails/active_record.rb +0 -34
  45. data/lib/cucumber/rails/capybara_javascript_emulation.rb +0 -72
  46. data/lib/cucumber/rails/test_unit.rb +0 -7
  47. data/spec/spec.opts +0 -2
data/.gitignore CHANGED
@@ -2,3 +2,5 @@ pkg
2
2
  doc
3
3
  tmp
4
4
  coverage
5
+ .bundle
6
+ Gemfile.lock
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --format progress --colour
data/.rvmrc ADDED
@@ -0,0 +1 @@
1
+ rvm @cucumber
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source :rubygems
2
+ gemspec
@@ -1,3 +1,10 @@
1
+ == In Git
2
+
3
+ No more Cucumber::Rails::World.use_transactional_fixtures = false. Use DatabaseCleaner.strategy = :none instead
4
+
5
+ === Bugfixes
6
+ * Gem dependency on Nokogiri (for #tableish). (#53 Aslak Hellesøy)
7
+
1
8
  == 0.3.2 2010-06-06
2
9
 
3
10
  == Changed features
@@ -15,8 +15,8 @@ Before you can use the generator, add the necessary gems to your project's Gemfi
15
15
  gem 'capybara'
16
16
  gem 'database_cleaner'
17
17
  gem 'cucumber-rails'
18
- gem 'cucumber', '0.7.2'
19
- gem 'rspec-rails', '2.0.0.beta.8'
18
+ gem 'cucumber'
19
+ gem 'rspec-rails'
20
20
  gem 'spork'
21
21
  gem 'launchy' # So you can do Then show me the page
22
22
 
data/Rakefile CHANGED
@@ -1,23 +1,7 @@
1
1
  # encoding: utf-8
2
-
3
- begin
4
- require 'jeweler'
5
- Jeweler::Tasks.new do |gemspec|
6
- gemspec.name = "cucumber-rails"
7
- gemspec.summary = "Cucumber Generators and Runtime for Rails"
8
- gemspec.description = "Cucumber Generators and Runtime for Rails"
9
- gemspec.email = "cukes@googlegroups.com"
10
- gemspec.homepage = "http://cukes.info"
11
- gemspec.authors = ["Dennis Blöte", "Aslak Hellesøy", "Rob Holland"]
12
- gemspec.homepage = "http://github.com/aslakhellesoy/cucumber-rails"
13
-
14
- gemspec.add_dependency 'cucumber', '>= 0.8.0'
15
- gemspec.add_development_dependency 'aruba', '>= 0.1.9'
16
- end
17
- Jeweler::GemcutterTasks.new
18
- rescue LoadError
19
- puts "Jeweler not available. Install it with: sudo gem install jeweler"
20
- end
2
+ require 'rubygems'
3
+ require 'bundler/setup'
4
+ Bundler::GemHelper.install_tasks
21
5
 
22
6
  $:.unshift(File.dirname(__FILE__) + '/lib')
23
7
  Dir["#{File.dirname(__FILE__)}/dev_tasks/*.rake"].sort.each { |ext| load ext }
@@ -1,111 +1,30 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
1
  # -*- encoding: utf-8 -*-
2
+ $LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
3
+ require 'cucumber/rails/version'
5
4
 
6
5
  Gem::Specification.new do |s|
7
- s.name = %q{cucumber-rails}
8
- s.version = "0.3.2"
6
+ s.name = 'cucumber-rails'
7
+ s.version = Cucumber::Rails::VERSION
8
+ s.authors = ["Aslak Hellesøy", "Dennis Blöte", "Rob Holland"]
9
+ s.description = "Cucumber Generators and Runtime for Rails"
10
+ s.summary = "cucumber-rails-#{s.version}"
11
+ s.email = 'cukes@googlegroups.com'
12
+ s.homepage = "http://cukes.info"
9
13
 
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Dennis Bl\303\266te", "Aslak Helles\303\270y", "Rob Holland"]
12
- s.date = %q{2010-06-06}
13
- s.description = %q{Cucumber Generators and Runtime for Rails}
14
- s.email = %q{cukes@googlegroups.com}
15
- s.extra_rdoc_files = [
16
- "LICENSE",
17
- "README.rdoc"
18
- ]
19
- s.files = [
20
- ".gitignore",
21
- "HACKING.rdoc",
22
- "History.txt",
23
- "LICENSE",
24
- "README.rdoc",
25
- "Rakefile",
26
- "VERSION",
27
- "config/.gitignore",
28
- "cucumber-rails.gemspec",
29
- "dev_tasks/cucumber.rake",
30
- "dev_tasks/rspec.rake",
31
- "features/rails2.feature",
32
- "features/rails3.feature",
33
- "features/rerun_profile.feature",
34
- "features/step_definitions/cucumber_rails_steps.rb",
35
- "features/support/env.rb",
36
- "features/support/matchers/files.rb",
37
- "generators/cucumber/USAGE",
38
- "generators/cucumber/cucumber_generator.rb",
39
- "generators/feature/USAGE",
40
- "generators/feature/feature_generator.rb",
41
- "lib/cucumber/rails/action_controller.rb",
42
- "lib/cucumber/rails/active_record.rb",
43
- "lib/cucumber/rails/capybara_javascript_emulation.rb",
44
- "lib/cucumber/rails/rspec.rb",
45
- "lib/cucumber/rails/test_unit.rb",
46
- "lib/cucumber/rails/world.rb",
47
- "lib/cucumber/web/tableish.rb",
48
- "lib/generators/cucumber/feature/USAGE",
49
- "lib/generators/cucumber/feature/feature_base.rb",
50
- "lib/generators/cucumber/feature/feature_generator.rb",
51
- "lib/generators/cucumber/feature/named_arg.rb",
52
- "lib/generators/cucumber/install/USAGE",
53
- "lib/generators/cucumber/install/install_base.rb",
54
- "lib/generators/cucumber/install/install_generator.rb",
55
- "spec/cucumber/web/tableish_spec.rb",
56
- "spec/generators/cucumber/install/install_base_spec.rb",
57
- "spec/spec.opts",
58
- "spec/spec_helper.rb",
59
- "templates/feature/feature.erb",
60
- "templates/feature/steps.erb",
61
- "templates/install/config/cucumber.yml.erb",
62
- "templates/install/environments/cucumber.rb.erb",
63
- "templates/install/script/cucumber",
64
- "templates/install/step_definitions/capybara_steps.rb.erb",
65
- "templates/install/step_definitions/web_steps_cs.rb.erb",
66
- "templates/install/step_definitions/web_steps_da.rb.erb",
67
- "templates/install/step_definitions/web_steps_de.rb.erb",
68
- "templates/install/step_definitions/web_steps_es.rb.erb",
69
- "templates/install/step_definitions/web_steps_ja.rb.erb",
70
- "templates/install/step_definitions/web_steps_ko.rb.erb",
71
- "templates/install/step_definitions/web_steps_no.rb.erb",
72
- "templates/install/step_definitions/web_steps_pt-BR.rb.erb",
73
- "templates/install/step_definitions/webrat_steps.rb.erb",
74
- "templates/install/support/_rails_each_run.rb.erb",
75
- "templates/install/support/_rails_prefork.rb.erb",
76
- "templates/install/support/capybara.rb",
77
- "templates/install/support/edit_warning.txt",
78
- "templates/install/support/paths.rb",
79
- "templates/install/support/rails.rb.erb",
80
- "templates/install/support/rails_spork.rb.erb",
81
- "templates/install/support/webrat.rb",
82
- "templates/install/tasks/cucumber.rake.erb"
83
- ]
84
- s.homepage = %q{http://github.com/aslakhellesoy/cucumber-rails}
85
- s.rdoc_options = ["--charset=UTF-8"]
86
- s.require_paths = ["lib"]
87
- s.rubygems_version = %q{1.3.7}
88
- s.summary = %q{Cucumber Generators and Runtime for Rails}
89
- s.test_files = [
90
- "spec/cucumber/web/tableish_spec.rb",
91
- "spec/generators/cucumber/install/install_base_spec.rb",
92
- "spec/spec_helper.rb"
93
- ]
94
-
95
- if s.respond_to? :specification_version then
96
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
97
- s.specification_version = 3
98
-
99
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
100
- s.add_runtime_dependency(%q<cucumber>, [">= 0.8.0"])
101
- s.add_development_dependency(%q<aruba>, [">= 0.1.9"])
102
- else
103
- s.add_dependency(%q<cucumber>, [">= 0.8.0"])
104
- s.add_dependency(%q<aruba>, [">= 0.1.9"])
105
- end
106
- else
107
- s.add_dependency(%q<cucumber>, [">= 0.8.0"])
108
- s.add_dependency(%q<aruba>, [">= 0.1.9"])
109
- end
14
+ s.add_dependency('cucumber', '~> 0.10.0')
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'])
21
+ s.add_development_dependency('database_cleaner', Cucumber::Rails::DEPS['database_cleaner'])
22
+
23
+ s.rubygems_version = "1.3.7"
24
+ s.files = `git ls-files`.split("\n")
25
+ s.test_files = `git ls-files -- {spec,features}/*`.split("\n")
26
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
27
+ s.extra_rdoc_files = ["LICENSE", "README.rdoc", "History.txt"]
28
+ s.rdoc_options = ["--charset=UTF-8"]
29
+ s.require_path = "lib"
110
30
  end
111
-
@@ -1,13 +1,8 @@
1
- begin
2
- require 'spec/rake/spectask'
1
+ require 'rspec/core/rake_task'
3
2
 
4
- desc "Run RSpec"
5
- Spec::Rake::SpecTask.new do |t|
6
- t.spec_opts = %w{--color --diff --format profile}
7
- t.spec_files = FileList['spec/**/*_spec.rb']
8
- t.rcov = ENV['RCOV']
9
- t.rcov_opts = %w{--exclude osx\/objc,gems\/,spec\/}
10
- end
11
- rescue LoadError
12
- task :spec
3
+ desc "Run RSpec"
4
+ RSpec::Core::RakeTask.new do |t|
5
+ t.rcov = ENV['RCOV']
6
+ t.rcov_opts = %w{--exclude osx\/objc,gems\/,spec\/}
7
+ t.verbose = true
13
8
  end
@@ -1,27 +1,13 @@
1
+ @announce
1
2
  Feature: Rails 2
2
3
  In order to take over the world
3
4
  Cucumber-Rails should work on major versions
4
5
  of Rails2 and Ruby, with Capybara, Webrat, Spork and DatabaseCleaner
5
6
 
6
- @announce @puts
7
- Scenario Outline: Run Cucumber
8
- Given I am using rvm "<ruby_version>"
9
- And I am using rvm gemset "cucumber-rails-<rails_version>" with Gemfile:
10
- """
11
- source :gemcutter
12
- gem 'rails', '<rails_version>'
13
- gem 'sqlite3-ruby', '1.2.5'
14
- gem 'capybara', '0.3.8'
15
- gem 'webrat', '0.7.1'
16
- gem 'rspec-rails', '1.3.2'
17
- #gem 'cucumber', '0.8.0'
18
- gem 'cucumber', :path => '../../../cucumber'
19
- gem 'database_cleaner', '0.5.2'
20
- gem 'culerity', '0.2.10'
21
- gem 'celerity', '0.7.9'
22
- """
23
- And I successfully run "rails rails-2-app"
24
- And I cd to "rails-2-app"
7
+ Scenario: Run Cucumber
8
+ Given a Rails "2.3.5" project named "rails-2-app" with Cucumber-Rails generated with "--capybara --rspec"
9
+
10
+ Given break
25
11
  And I symlink "../../../../cucumber" to "vendor/plugins/cucumber"
26
12
  And I symlink "../../.." to "vendor/plugins/cucumber-rails"
27
13
  And I successfully run "ruby script/generate cucumber --capybara"
@@ -57,8 +43,3 @@ Feature: Rails 2
57
43
  3 scenarios (3 passed)
58
44
  14 steps (14 passed)
59
45
  """
60
-
61
- Examples:
62
- | generator_args | feature_args | ruby_version | rails_version |
63
- | --webrat --testunit | | 1.8.6 | 2.3.5 |
64
- | --capybara --rspec | --capybara culerity | 1.8.7 | 2.3.8 |
@@ -1,27 +1,11 @@
1
- @announce-cmd
2
- @announce @puts
1
+ @announce
3
2
  Feature: Rails 3
4
3
  In order to take over the world
5
4
  Cucumber-Rails should work on major versions
6
- of Rails2 and Ruby, with Capybara, Spork and DatabaseCleaner
5
+ of Rails 3 and Ruby, with Capybara, Spork and DatabaseCleaner
7
6
 
8
7
  Scenario: Install Cucumber-Rails
9
- Given I am using rvm "ruby-1.8.7-p249"
10
- And I am using rvm gemset "cucumber-rails-3.0.0.beta" with Gemfile:
11
- """
12
- source :gemcutter
13
- gem 'rails', '3.0.0.beta'
14
- gem 'sqlite3-ruby', '1.2.5'
15
- gem 'capybara', '0.3.8'
16
- """
17
- When I successfully run "rails rails-3-app"
18
- Then it should pass with:
19
- """
20
- README
21
- """
22
- And I cd to "rails-3-app"
23
- And I symlink "../../.." to "vendor/plugins/cucumber-rails"
24
- When I successfully run "rails generate cucumber:install --capybara"
8
+ Given I have created a new Rails 3 app "rails-3-app" with cucumber-rails support
25
9
  Then the following files should exist:
26
10
  | config/cucumber.yml |
27
11
  | script/cucumber |
@@ -29,40 +13,18 @@ Feature: Rails 3
29
13
  | features/support/env.rb |
30
14
  | features/support/paths.rb |
31
15
  | lib/tasks/cucumber.rake |
32
- And the file "features/support/env.rb" should contain "require 'cucumber/rails/world'"
33
- And the file "features/support/env.rb" should contain "require 'capybara/rails'"
34
-
35
- Scenario Outline: Run Cucumber
36
- Given I am using rvm "<ruby_version>"
37
- And I am using rvm gemset "cucumber-rails-3.0.0.beta-gemset-<gemset>" with Gemfile:
38
- """
39
- source :gemcutter
40
- gem 'rails', '3.0.0.beta'
41
- gem 'sqlite3-ruby', '1.2.5'
42
- gem 'capybara', '0.3.8'
43
- gem 'gherkin', '1.0.30'
44
- gem 'term-ansicolor', '1.0.4'
45
- gem 'diff-lcs', '1.1.2'
46
- gem 'rspec-rails', '<rspec_version>'
47
- """
48
- And I successfully run "rails rails-3-app"
49
- And I cd to "rails-3-app"
50
- And I symlink "../../.." to "vendor/plugins/cucumber-rails"
51
- And I append to "Gemfile" with:
52
- """
53
- gem 'capybara', '0.3.8'
54
- gem 'cucumber', :path => '../../../../cucumber'
16
+ And the file "features/support/env.rb" should contain "require 'cucumber/rails'"
55
17
 
56
- """
57
- And I successfully run "rails generate cucumber:install --capybara"
18
+ Scenario: Inspect query string
19
+ Given I have created a new Rails 3 app "rails-3-app" with cucumber-rails support
58
20
  And I successfully run "rails generate cucumber:feature post title:string body:text published:boolean"
59
21
  And I successfully run "rails generate scaffold post title:string body:text published:boolean"
60
22
  And I successfully run "rails generate scaffold cukes name:string"
61
- And I write to "app/controllers/cukes_controller.rb" with:
23
+ And I overwrite "app/controllers/cukes_controller.rb" with:
62
24
  """
63
25
  class CukesController < ApplicationController
64
26
  def index
65
- redirect_to cuke_path(10, :overwrite_params => {:name => 'cucumber', :what => 'vegetable'})
27
+ redirect_to cuke_path(10, {:name => 'cucumber', :what => 'vegetable'})
66
28
  end
67
29
 
68
30
  def show
@@ -76,13 +38,10 @@ Feature: Rails 3
76
38
  Scenario: Tests
77
39
  When I go to the cukes page
78
40
  Then I should have the following query string:
79
- |name|cucumber|
80
- |what|vegetable|
81
- |controller|cukes|
82
- |action|index|
41
+ | name | cucumber |
42
+ | what | vegetable |
83
43
  And I should see "Cuke 10"
84
44
  """
85
- And I successfully run "bundle lock"
86
45
  And I successfully run "rake db:migrate"
87
46
  And I successfully run "rake cucumber"
88
47
  Then it should pass with:
@@ -90,8 +49,75 @@ Feature: Rails 3
90
49
  3 scenarios (3 passed)
91
50
  14 steps (14 passed)
92
51
  """
93
-
94
- Examples:
95
- | ruby_version | rspec_version | gemset |
96
- | ruby-1.8.7-p249 | 1.3.2 | 1 |
97
- | ruby-1.9.1-p378 | 2.0.0.beta.10 | 2 |
52
+
53
+ Scenario: Allow rescue
54
+ Given I have created a new Rails 3 app "rails-3-app" with cucumber-rails support
55
+ And I write to "app/controllers/posts_controller.rb" with:
56
+ """
57
+ class PostsController < ApplicationController
58
+ def index
59
+ raise "There is an error in index"
60
+ end
61
+ end
62
+ """
63
+ And I write to "config/routes.rb" with:
64
+ """
65
+ Rails3App::Application.routes.draw do
66
+ resources :posts
67
+ end
68
+ """
69
+ And I write to "features/posts.feature" with:
70
+ """
71
+ Feature: posts
72
+ @allow-rescue
73
+ Scenario: See them
74
+ When I do it
75
+ """
76
+ And I write to "features/step_definitions/posts_steps.rb" with:
77
+ """
78
+ When /^I do it$/ do
79
+ visit '/posts'
80
+ puts page.body
81
+ end
82
+ """
83
+ And I run "rake cucumber"
84
+ Then it should pass with:
85
+ """
86
+ 1 scenario (1 passed)
87
+ 1 step (1 passed)
88
+ """
89
+
90
+ Scenario: Don't allow rescue
91
+ Given I have created a new Rails 3 app "rails-3-app" with cucumber-rails support
92
+ And I write to "app/controllers/posts_controller.rb" with:
93
+ """
94
+ class PostsController < ApplicationController
95
+ def index
96
+ raise "There is an error in index"
97
+ end
98
+ end
99
+ """
100
+ And I write to "config/routes.rb" with:
101
+ """
102
+ Rails3App::Application.routes.draw do
103
+ resources :posts
104
+ end
105
+ """
106
+ And I write to "features/posts.feature" with:
107
+ """
108
+ Feature: posts
109
+ Scenario: See them
110
+ When I do it
111
+ """
112
+ And I write to "features/step_definitions/posts_steps.rb" with:
113
+ """
114
+ When /^I do it$/ do
115
+ visit '/posts'
116
+ end
117
+ """
118
+ And I run "rake cucumber"
119
+ Then it should fail with:
120
+ """
121
+ 1 scenario (1 failed)
122
+ 1 step (1 failed)
123
+ """
@@ -1,35 +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
-
9
1
  Given /^I have created a new Rails 3 app "([^"]*)" with cucumber\-rails support$/ do |app_name|
10
2
  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
- gem 'rails', '3.0.0.beta'
15
- gem 'sqlite3-ruby', '1.2.5'
16
- gem 'capybara', '0.3.8'
17
- """
18
- When I successfully run "rails rails-3-app"
3
+ When I successfully run "rails new rails-3-app"
19
4
  Then it should pass with:
20
5
  """
21
6
  README
22
7
  """
23
8
  And I cd to "#{app_name}"
24
- And I symlink "../../.." to "vendor/plugins/cucumber-rails"
25
- And I append to "Gemfile" with:
26
- """
27
- gem 'capybara', '0.3.8'
28
- gem 'cucumber', :path => '../../../../cucumber'
29
-
30
- """
31
- And I successfully run "rails generate cucumber:install --capybara"
32
- And I successfully run "bundle lock"
9
+ And I successfully run "rails generate cucumber:install"
10
+ And I successfully run "bundle install"
33
11
  And I successfully run "rake db:migrate"
34
12
  }
35
13
  end