cucumber-rails 1.4.0 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. checksums.yaml +7 -0
  2. data/.github/ISSUE_TEMPLATE.md +52 -0
  3. data/.github/PULL_REQUEST_TEMPLATE.md +42 -0
  4. data/.gitignore +3 -0
  5. data/.rspec +4 -1
  6. data/.rubocop.yml +68 -0
  7. data/.travis.yml +53 -26
  8. data/Appraisals +27 -63
  9. data/{History.md → CHANGELOG.md} +299 -19
  10. data/CONTRIBUTING.md +18 -27
  11. data/Gemfile +2 -4
  12. data/LICENSE +1 -1
  13. data/README.md +73 -29
  14. data/Rakefile +18 -14
  15. data/bin/install_geckodriver.sh +19 -0
  16. data/bin/install_webpacker.sh +9 -0
  17. data/config/cucumber.yml +5 -3
  18. data/cucumber-rails.gemspec +37 -25
  19. data/dev_tasks/cucumber.rake +3 -3
  20. data/dev_tasks/rspec.rake +3 -6
  21. data/dev_tasks/yard/default/layout/html/footer.erb +1 -1
  22. data/dev_tasks/yard/default/layout/html/layout.erb +5 -5
  23. data/dev_tasks/yard/default/layout/html/logo.erb +1 -1
  24. data/dev_tasks/yard/default/layout/html/setup.rb +6 -1
  25. data/dev_tasks/yard.rake +7 -14
  26. data/features/allow_rescue.feature +17 -12
  27. data/features/annotations.feature +20 -0
  28. data/features/capybara_javascript_drivers.feature +42 -32
  29. data/features/choose_javascript_database_strategy.feature +38 -57
  30. data/features/configuration.feature +48 -0
  31. data/features/database_cleaner.feature +20 -20
  32. data/features/disable_automatic_database_cleaning.feature +13 -19
  33. data/features/emulate_javascript.feature +65 -48
  34. data/features/install_cucumber_rails.feature +6 -5
  35. data/features/no_database.feature +8 -15
  36. data/features/raising_errors.feature +10 -4
  37. data/features/rerun_profile.feature +18 -8
  38. data/features/rest_api.feature +13 -13
  39. data/features/step_definitions/cucumber_rails_steps.rb +52 -66
  40. data/features/support/aruba.rb +5 -0
  41. data/features/support/cucumber_rails_helper.rb +85 -0
  42. data/features/support/env.rb +4 -35
  43. data/features/support/hooks.rb +8 -0
  44. data/gemfiles/rails_4_2.gemfile +10 -0
  45. data/gemfiles/rails_5_0.gemfile +10 -0
  46. data/gemfiles/rails_5_1.gemfile +10 -0
  47. data/gemfiles/rails_5_2.gemfile +10 -0
  48. data/gemfiles/rails_6_0.gemfile +9 -0
  49. data/lib/cucumber/rails/action_dispatch.rb +21 -0
  50. data/lib/cucumber/rails/application.rb +17 -8
  51. data/lib/cucumber/rails/capybara/javascript_emulation.rb +47 -39
  52. data/lib/cucumber/rails/capybara/select_dates_and_times.rb +8 -6
  53. data/lib/cucumber/rails/capybara.rb +2 -0
  54. data/lib/cucumber/rails/database.rb +36 -17
  55. data/lib/cucumber/rails/hooks/active_record.rb +14 -12
  56. data/lib/cucumber/rails/hooks/allow_rescue.rb +2 -0
  57. data/lib/cucumber/rails/hooks/database_cleaner.rb +6 -4
  58. data/lib/cucumber/rails/hooks/mail.rb +4 -4
  59. data/lib/cucumber/rails/hooks.rb +2 -0
  60. data/lib/cucumber/rails/rspec.rb +5 -3
  61. data/lib/cucumber/rails/world.rb +26 -9
  62. data/lib/cucumber/rails.rb +21 -18
  63. data/lib/generators/cucumber/{install/USAGE → USAGE} +2 -2
  64. data/lib/generators/cucumber/{install/install_generator.rb → install_generator.rb} +28 -15
  65. data/lib/generators/cucumber/{install/templates → templates}/config/cucumber.yml.erb +4 -3
  66. data/lib/generators/cucumber/{install/templates → templates}/script/cucumber +1 -0
  67. data/lib/generators/cucumber/{install/templates → templates}/support/_rails_each_run.rb.erb +4 -4
  68. data/lib/generators/cucumber/{install/templates → templates}/support/_rails_prefork.rb.erb +0 -0
  69. data/lib/generators/cucumber/{install/templates → templates}/support/capybara.rb +2 -0
  70. data/lib/generators/cucumber/{install/templates → templates}/support/edit_warning.txt +0 -0
  71. data/lib/generators/cucumber/{install/templates → templates}/support/rails.rb.erb +0 -0
  72. data/lib/generators/cucumber/{install/templates → templates}/support/rails_spork.rb.erb +2 -2
  73. data/lib/generators/cucumber/{install/templates → templates}/tasks/cucumber.rake.erb +19 -8
  74. data/spec/cucumber/rails/database_spec.rb +46 -33
  75. data/spec/generators/cucumber/install_generator_spec.rb +55 -0
  76. data/spec/spec_helper.rb +14 -2
  77. metadata +228 -142
  78. data/Gemfile.appraisal +0 -3
  79. data/features/step_definitions/mongo_steps.rb +0 -3
  80. data/features/support/bundler_pre_support.rb +0 -28
  81. data/features/support/fixtures/bundler-1.0.21.gem +0 -0
  82. data/features/support/fixtures/bundler-1.1.rc.gem +0 -0
  83. data/features/support/legacy_web_steps_support.rb +0 -290
  84. data/gemfiles/capybara_1_1.gemfile +0 -17
  85. data/gemfiles/rails_3_0.gemfile +0 -16
  86. data/gemfiles/rails_3_1.gemfile +0 -17
  87. data/gemfiles/rails_3_2.gemfile +0 -17
  88. data/gemfiles/rails_4_0.gemfile +0 -20
  89. data/lib/cucumber/rails/action_controller.rb +0 -12
  90. data/spec/generators/cucumber/install/install_generator_spec.rb +0 -47
data/README.md CHANGED
@@ -1,18 +1,23 @@
1
1
  # Cucumber-Rails
2
2
 
3
- [![Build Status](https://secure.travis-ci.org/cucumber/cucumber-rails.png?branch=master)](http://travis-ci.org/cucumber/cucumber-rails)
3
+ [![Gem Version](https://badge.fury.io/rb/cucumber-rails.svg)](http://badge.fury.io/rb/cucumber-rails)
4
+ [![Build Status](https://secure.travis-ci.org/cucumber/cucumber-rails.svg?branch=master)](http://travis-ci.org/cucumber/cucumber-rails)
5
+ [![Code Climate](https://codeclimate.com/github/cucumber/cucumber-rails.svg)](https://codeclimate.com/github/cucumber/cucumber-rails)
6
+ [![Open Source Helpers](https://www.codetriage.com/cucumber/cucumber-rails/badges/users.svg)](https://www.codetriage.com/cucumber/cucumber-rails)
4
7
 
5
- Cucumber-Rails brings Cucumber to Rails 3.x and 4.x. For Rails 2.3.x support, see the [rails-2.3.x branch](https://github.com/cucumber/cucumber-rails/tree/rails-2.3.x).
8
+ Cucumber-Rails brings Cucumber to Rails 4.2, 5.x and 6.x.
6
9
 
7
10
  ## Installation
8
11
 
9
12
  Before you can use the generator, add the gem to your project's Gemfile as follows:
10
13
 
11
- group :test do
12
- gem 'cucumber-rails', :require => false
13
- # database_cleaner is not required, but highly recommended
14
- gem 'database_cleaner'
15
- end
14
+ ```ruby
15
+ group :test do
16
+ gem 'cucumber-rails', require: false
17
+ # database_cleaner is not required, but highly recommended
18
+ gem 'database_cleaner'
19
+ end
20
+ ```
16
21
 
17
22
  Then install it by running:
18
23
 
@@ -35,15 +40,24 @@ With Rake:
35
40
  Without Rake:
36
41
 
37
42
  [bundle exec] cucumber
38
-
43
+
39
44
  ## Configuration options
40
45
 
41
- By default, cucumber-rails runs `DatabaseCleaner.start` and `DatabaseCleaner.clean` before and after your scenarios. You can disable this behaviour like so:
46
+ By default, cucumber-rails runs `DatabaseCleaner.start` and `DatabaseCleaner.clean`
47
+ before and after your scenarios. You can disable this behaviour like so:
48
+
49
+ ```ruby
50
+ # features/support/env.rb
51
+ # ...
52
+ Cucumber::Rails::Database.autorun_database_cleaner = false
53
+ ```
54
+
55
+ By default, cucumber-rails will auto mix-in the helpers from `Rack::Test` into your default Cucumber World instance. You can prevent this behaviour like so:
56
+ ```ruby
57
+ # features/support/env.rb
58
+ ENV['CR_REMOVE_RACK_TEST_HELPERS'] = 'true'
59
+ ```
42
60
 
43
- # features/support/env.rb
44
- # ...
45
- Cucumber::Rails::Database.autorun_database_cleaner = false
46
-
47
61
  ## Upgrading from a previous version
48
62
 
49
63
  When upgrading from a previous version it is recommended that you rerun:
@@ -52,44 +66,59 @@ When upgrading from a previous version it is recommended that you rerun:
52
66
 
53
67
  ## Bugs and feature requests
54
68
 
55
- The *only* way to have a bug fixed or a new feature accepted is to describe it with a Cucumber feature. Let's say you think you have found a bug in the cucumber:install generator. Fork this project, clone it to your workstation and check out a branch with a descriptive name:
69
+ The *only* way to have a bug fixed or a new feature accepted is to describe it with a
70
+ Cucumber feature. Let's say you think you have found a bug in the cucumber:install generator.
71
+ Fork this project, clone it to your workstation and check out a branch with a descriptive name:
56
72
 
57
73
  git clone git@github.com:you/cucumber-rails.git
58
- git checkout -b bug-install-generator
74
+ git checkout -b bugfix/generator-fails-on-ruby-25
59
75
 
60
- Start by making sure you can run the existing features. Now, create a feature that demonstrates what's wrong. See the existing features for examples. When you have a failing feature that reproduces the bug, commit, push and send a pull request. Someone from the Cucumber-Rails team will review it and hopefully create a fix.
76
+ Start by making sure you can run the existing features. Now, create a feature that demonstrates
77
+ what's wrong. See the existing features for examples. When you have a failing feature that
78
+ reproduces the bug, commit, push and send a pull request. Someone from the Cucumber-Rails team
79
+ will review it and hopefully create a fix.
61
80
 
62
- If you know how to fix the bug yourself, make a second commit (after committing the failing feature) before you send the pull request.
81
+ If you know how to fix the bug yourself, make a second commit (after committing the failing
82
+ feature) before you send the pull request.
63
83
 
64
84
  ### Setting up your environment
65
85
 
66
- I strongly recommend rvm and ruby 1.9.3. When you have that, cd into your cucumber-rails repository and:
86
+ Make sure you have a supported ruby installed, cd into your cucumber-rails repository and:
67
87
 
68
88
  gem install bundler
69
89
  bundle install
90
+ bin/install_geckodriver.sh
91
+ bin/install_webpacker.sh
70
92
 
71
93
  ### Running all tests
72
94
 
73
95
  With all dependencies installed, all specs and features should pass:
74
96
 
75
- rake
76
-
77
- One of the features uses MongoDB, which needs to be running in order to make features/mongoid.feature to pass.
97
+ [bundle exec] rake
78
98
 
79
99
  ### Running Appraisal suite
80
100
 
81
- In order to test against multiple versions of key dependencies, the [Appraisal](https://github.com/thoughtbot/appraisal) is used to generate multiple gemfiles, stored in the `gemfiles/` directory. Normally these will only run on Travis; however, if you want to run the full test suite against all gemfiles, run the following commands:
101
+ In order to test against multiple versions of key dependencies, the [Appraisal](https://github.com/thoughtbot/appraisal)
102
+ gem is used to generate multiple gemfiles, stored in the `gemfiles/` directory.
103
+ Normally these will only run on Travis; however, if you want to run the full test suite against
104
+ all gemfiles, run the following commands:
82
105
 
83
- rake gemfiles:install
84
- rake test:all
106
+ [bundle exec] appraisal install
107
+ [bundle exec] appraisal rake test
85
108
 
86
109
  To run the suite against a named gemfile, use the following:
87
110
 
88
- rake test:gemfile[rails_3_0]
111
+ [bundle exec] appraisal rails_4_2 rake test
112
+
113
+ To remove and rebuild the different gemfiles (for example, to update a rails version or its
114
+ dependencies), use the following:
115
+
116
+ [bundle exec] appraisal update
89
117
 
90
- To remove and rebuild the different gemfiles (for example, to update a rails version or its dependencies), use the following:
118
+ If you've changed versions of the dependencies, you may find it helpful to forcefully clean
119
+ each appraisal's gem lock file in `gemfiles/`. You can do this using:
91
120
 
92
- rake gemfiles:rebuild
121
+ [bundle exec] rake clean
93
122
 
94
123
  ### Adding dependencies
95
124
 
@@ -97,6 +126,21 @@ To support the multiple-gemfile testing, when adding a new dependency the follow
97
126
 
98
127
  1. If it's a runtime dependency of the gem, add it to the gemspec
99
128
  2. If it's a primary development dependency, add it to the gemspec
100
- 3. If it's a dependency of a generated rails app in a test, add it to the Gemfile (for local test runs) and each appraisal section (if necessary).
129
+ 3. If it's a dependency of a generated rails app in a test, add it to [the helper] that
130
+ modifies the `Gemfile`.
131
+
132
+ For example, rspec is a primary development dependency, so it lives in the gemspec.
133
+
134
+ [the helper]: https://github.com/cucumber/cucumber-rails/blob/5e37c530560ae1c1a79521c38a54bae0be94242b/features/step_definitions/cucumber_rails_steps.rb#L15
135
+
136
+ ### NOTE
137
+
138
+ If you get an error while trying to run the tests locally, similar to the one below:
139
+
140
+ Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable)
141
+
142
+ You need to install a javascript runtime.
143
+
144
+ You can do that in ubuntu by using:
101
145
 
102
- For example, rspec is a primary development dependency, so it lives in the gemspec. By contrast, coffee-rails is a dependency of apps generated with rails 3.1 and 3.2, so lives in the main Gemfile and the rails 3.1 and 3.2 appraisal sections.
146
+ sudo apt-get install nodejs
data/Rakefile CHANGED
@@ -1,5 +1,7 @@
1
- # encoding: utf-8
2
- CUCUMBER_RAILS_VERSION = Gem::Specification.load(File.dirname(__FILE__) + '/cucumber-rails.gemspec').version.version
1
+ # frozen_string_literal: true
2
+
3
+ CUCUMBER_RAILS_VERSION =
4
+ Gem::Specification.load(File.dirname(__FILE__) + '/cucumber-rails.gemspec').version.version
3
5
  require 'rubygems'
4
6
  require 'bundler'
5
7
  require 'bundler/setup'
@@ -9,41 +11,43 @@ require 'rake/clean'
9
11
  require 'pathname'
10
12
  Bundler::GemHelper.install_tasks
11
13
 
12
- $:.unshift(File.dirname(__FILE__) + '/lib')
14
+ $LOAD_PATH.unshift(File.dirname(__FILE__) + '/lib')
13
15
  Dir["#{File.dirname(__FILE__)}/dev_tasks/*.rake"].sort.each { |ext| load ext }
14
16
 
15
17
  CLEAN.include('doc', 'tmp')
16
18
 
17
- task :default => :test
19
+ task default: :test
18
20
 
19
- task :test => [:spec, :cucumber]
21
+ task test: %i[spec cucumber]
20
22
 
21
23
  namespace :test do
22
- desc "Run tests against all gemfiles"
24
+ desc 'Run tests against all gemfiles'
23
25
  task :all do
24
26
  Rake::Task['appraisal'].invoke('test')
25
27
  end
26
28
 
27
- desc "Run tests against specified gemfile, e.g. rake test:gemfile[rails_3_0]"
28
- task :gemfile, :name do |task, args|
29
+ desc 'Run tests against specified gemfile, e.g. rake test:gemfile[rails_3_0]'
30
+ task :gemfile, :name do |_task, args|
29
31
  unless args.name && Pathname.new("gemfiles/#{args.name}.gemfile").exist?
30
- raise ArgumentError "You must provide the name of an existing Appraisal gemfile, e.g. 'rake test:gemfile[rails_3_2]'"
32
+ raise ArgumentError, "You must provide the name of an existing Appraisal gemfile,
33
+ e.g. 'rake test:gemfile[rails_4_2]'"
31
34
  end
35
+
32
36
  Rake::Task["appraisal:#{args.name}"].invoke('test')
33
37
  end
34
38
  end
35
39
 
36
40
  namespace :gemfiles do
37
- desc "Install dependencies for all gemfiles"
41
+ desc 'Install dependencies for all gemfiles'
38
42
  task :install do
39
- ENV['BUNDLE_GEMFILE'] = "Gemfile.appraisal"
43
+ ENV['BUNDLE_GEMFILE'] = 'Gemfile.appraisal'
40
44
  Rake::Task['appraisal:install'].invoke
41
45
  end
42
46
 
43
47
  task :clean do
44
- FileUtils.rm_rf("gemfiles/*")
48
+ FileUtils.rm_rf('gemfiles/*')
45
49
  end
46
50
 
47
- desc "Rebuild generated gemfiles and install dependencies"
48
- task :rebuild => [:clean, :install]
51
+ desc 'Rebuild generated gemfiles and install dependencies'
52
+ task rebuild: %i[clean install]
49
53
  end
@@ -0,0 +1,19 @@
1
+ #!/bin/bash
2
+
3
+ set -xeuo pipefail
4
+
5
+ curl --silent \
6
+ --show-error \
7
+ --location \
8
+ --fail \
9
+ --retry 3 \
10
+ --output /tmp/geckodriver_linux64.tar.gz \
11
+ https://github.com/mozilla/geckodriver/releases/download/v0.24.0/geckodriver-v0.24.0-linux64.tar.gz
12
+
13
+ sudo tar -C /usr/local/bin -xvzf /tmp/geckodriver_linux64.tar.gz geckodriver
14
+
15
+ rm /tmp/geckodriver_linux64.tar.gz
16
+
17
+ geckodriver --version
18
+
19
+ set +x
@@ -0,0 +1,9 @@
1
+ #!/bin/bash
2
+
3
+ set -xeuo pipefail
4
+
5
+ curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
6
+ echo 'deb https://dl.yarnpkg.com/debian/ stable main' | sudo tee /etc/apt/sources.list.d/yarn.list
7
+ sudo apt update && sudo apt install --yes yarn
8
+
9
+ set +x
data/config/cucumber.yml CHANGED
@@ -5,11 +5,13 @@ path = if failing_scenarios.empty?
5
5
  'features'
6
6
  else
7
7
  puts "Running failed scenarios"
8
- failing_scenarios
8
+ failing_scenarios.gsub /\s/, ' '
9
9
  end
10
10
  opts = [
11
11
  "--format #{path == 'features' ? 'progress' : 'pretty'}",
12
12
  "--format rerun -o #{rerun_file}"
13
- ].join(' ')
13
+ ]
14
+ rails_version = `bundle exec rails --version`.match(/[\d.]+$/).to_s
15
+ optlist = opts.join(' ')
14
16
  %>
15
- default: <%= path %> <%= opts %> --tags ~@broken
17
+ default: <%= path %> <%= optlist %> --tags 'not @broken'
@@ -1,39 +1,51 @@
1
- # -*- encoding: utf-8 -*-
2
- $LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
1
+ # frozen_string_literal: true
2
+
3
+ $LOAD_PATH.unshift File.expand_path('lib', __dir__)
3
4
 
4
5
  Gem::Specification.new do |s|
5
6
  s.name = 'cucumber-rails'
6
- s.version = '1.4.0'
7
- s.authors = ["Aslak Hellesøy", "Dennis Blöte", "Rob Holland"]
8
- s.description = "Cucumber Generator and Runtime for Rails"
7
+ s.version = '2.1.0'
8
+ s.authors = ['Aslak Hellesøy', 'Dennis Blöte', 'Rob Holland']
9
+ s.description = 'Cucumber Generator and Runtime for Rails'
9
10
  s.summary = "#{s.name}-#{s.version}"
10
11
  s.email = 'cukes@googlegroups.com'
11
- s.homepage = "http://cukes.info"
12
+ s.homepage = 'https://cucumber.io'
13
+
14
+ s.license = 'MIT'
15
+
16
+ s.metadata = {
17
+ 'bug_tracker_uri' => 'https://github.com/cucumber/cucumber-rails/issues',
18
+ 'changelog_uri' => "https://github.com/cucumber/cucumber-rails/blob/v#{s.version}/CHANGELOG.md",
19
+ 'documentation_uri' => 'https://cucumber.io/docs',
20
+ 'mailing_list_uri' => 'https://groups.google.com/forum/#!forum/cukes',
21
+ 'source_code_uri' => "https://github.com/cucumber/cucumber-rails/tree/v#{s.version}"
22
+ }
12
23
 
13
- s.add_runtime_dependency('cucumber', '>= 1.2.0')
14
- s.add_runtime_dependency('nokogiri', '>= 1.5.0')
15
- s.add_runtime_dependency('capybara', '>= 1.1.2')
16
- s.add_runtime_dependency('rails', '>= 3.0.0')
24
+ s.add_runtime_dependency('capybara', ['>= 2.12', '< 4'])
25
+ s.add_runtime_dependency('cucumber', ['>= 3.0.2', '< 5'])
26
+ s.add_runtime_dependency('mime-types', ['>= 2.0', '< 4'])
27
+ s.add_runtime_dependency('nokogiri', '~> 1.8')
28
+ s.add_runtime_dependency('rails', ['>= 4.2', '< 7'])
17
29
 
18
30
  # Main development dependencies
19
- s.add_development_dependency('rake', '>= 0.9.2.2')
20
- s.add_development_dependency('bundler', '~> 1.3.5')
21
- s.add_development_dependency('aruba', '>= 0.4.11')
22
- s.add_development_dependency('rspec', '>= 2.2')
23
- s.add_development_dependency('ammeter', '>= 0.2.9')
24
- s.add_development_dependency('factory_girl', '>= 3.2.0')
25
- s.add_development_dependency('database_cleaner', '>= 0.7.2')
26
- s.add_development_dependency('appraisal', '~> 0.5.1')
31
+ s.add_development_dependency('ammeter', '>= 1.1.4')
32
+ s.add_development_dependency('appraisal', '~> 2.2')
33
+ s.add_development_dependency('aruba', '~> 1.0')
34
+ s.add_development_dependency('bundler', '>= 1.17')
35
+ s.add_development_dependency('rake', '>= 12.0')
36
+ s.add_development_dependency('rspec', '~> 3.6')
37
+ s.add_development_dependency('rubocop', '~> 0.85.0')
38
+ s.add_development_dependency('rubocop-performance', '~> 1.6.1')
39
+ s.add_development_dependency('rubocop-rspec', '~> 1.39.0')
40
+ s.add_development_dependency('sqlite3', '~> 1.3')
27
41
 
28
42
  # For Documentation:
29
- s.add_development_dependency('yard', '~> 0.8.5.2')
30
- s.add_development_dependency('rdoc', '~> 3.12.2')
31
- s.add_development_dependency('rdiscount', '~> 2.0.7')
32
- s.add_development_dependency('bcat', '~> 0.6.2')
43
+ s.add_development_dependency('rdoc', '>= 6.0')
44
+ s.add_development_dependency('yard', '~> 0.9.10')
33
45
 
34
- s.rubygems_version = ">= 1.6.1"
46
+ s.required_ruby_version = '>= 2.4.0'
47
+ s.rubygems_version = '>= 1.6.1'
35
48
  s.files = `git ls-files`.split("\n")
36
49
  s.test_files = `git ls-files -- {spec,features}/*`.split("\n")
37
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
38
- s.require_path = "lib"
50
+ s.require_path = 'lib'
39
51
  end
@@ -1,5 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'cucumber/rake/task'
2
4
 
3
- Cucumber::Rake::Task.new do |t|
4
- t.rcov = false
5
- end
5
+ Cucumber::Rake::Task.new
data/dev_tasks/rspec.rake CHANGED
@@ -1,8 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'rspec/core/rake_task'
2
4
 
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
8
- end
5
+ RSpec::Core::RakeTask.new
@@ -1,5 +1,5 @@
1
1
  <div id="footer">
2
- Generated on <%= Time.now.strftime("%c") %> by
2
+ Generated on <%= Time.now.strftime("%c") %> by
3
3
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
4
4
  <%= YARD::VERSION %> (ruby-<%= RUBY_VERSION %>).
5
5
  </div>
@@ -8,18 +8,18 @@
8
8
  <script type="text/javascript" charset="utf-8">
9
9
  if (window.top.frames.main) document.body.className = 'frames';
10
10
  </script>
11
-
11
+
12
12
  <div id="header">
13
13
  <%= erb(:logo) %>
14
14
  <%= erb(:breadcrumb) %>
15
15
  <%= erb(:search) %>
16
16
  <div class="clear"></div>
17
17
  </div>
18
-
18
+
19
19
  <iframe id="search_frame"></iframe>
20
-
20
+
21
21
  <div id="content"><%= yieldall %></div>
22
-
22
+
23
23
  <%= erb(:footer) %>
24
24
  </body>
25
- </html>
25
+ </html>
@@ -1 +1 @@
1
- <h3><img src="<%= url_for('images/bubble_32x32.png') %>"></img> Cucumber-Rails <%= CUCUMBER_RAILS_VERSION %></h3>
1
+ <h3><img src="<%= url_for('images/bubble_32x32.png') %>"></img> Cucumber-Rails <%= CUCUMBER_RAILS_VERSION %></h3>
@@ -1,4 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  def init
2
4
  super
3
- options[:serializer].serialize('/images/bubble_32x32.png', IO.read(File.dirname(__FILE__) + '/bubble_32x32.png'))
5
+ options[:serializer].serialize(
6
+ '/images/bubble_32x32.png',
7
+ IO.read(File.dirname(__FILE__) + '/bubble_32x32.png')
8
+ )
4
9
  end
data/dev_tasks/yard.rake CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'yard'
2
4
  require 'yard/rake/yardoc_task'
3
5
 
@@ -6,9 +8,8 @@ API_DIR = File.join(SITE_DIR, 'api', 'cucumber-rails', 'ruby', 'yardoc')
6
8
 
7
9
  namespace :api do
8
10
  file :dir do
9
- unless File.directory?(SITE_DIR)
10
- raise "You need to git clone git@github.com:cucumber/cucumber.github.com.git #{SITE_DIR}"
11
- end
11
+ raise "You need to git clone git@github.com:cucumber/cucumber.github.com.git #{SITE_DIR}" unless File.directory?(SITE_DIR)
12
+
12
13
  sh('git pull origin master')
13
14
  mkdir_p API_DIR
14
15
  end
@@ -18,18 +19,10 @@ namespace :api do
18
19
  YARD::Rake::YardocTask.new(:yard) do |yard|
19
20
  dir = API_DIR
20
21
  mkdir_p dir
21
- yard.options = ["--out", dir]
22
- end
23
- task :yard => :dir
24
-
25
- task :release do
26
- Dir.chdir(SITE_DIR) do
27
- sh('git add .')
28
- sh("git commit -m 'Update API docs for cucumber-rails v#{cucumber-rails::VERSION}'")
29
- sh('git push origin master')
30
- end
22
+ yard.options = ['--out', dir]
31
23
  end
24
+ task yard: :dir
32
25
 
33
26
  desc "Generate YARD docs for Cucumber-Rails' API"
34
- task :doc => [:yard, :release]
27
+ task doc: :yard
35
28
  end
@@ -1,54 +1,59 @@
1
1
  Feature: Allow Cucumber to rescue exceptions
2
2
 
3
3
  Background: A controller that raises an exception
4
- Given I have created a new Rails app "rails-3-app" and installed cucumber-rails
5
- And I write to "app/controllers/posts_controller.rb" with:
4
+ Given I have created a new Rails app and installed cucumber-rails
5
+ When I write to "app/controllers/posts_controller.rb" with:
6
6
  """
7
7
  class PostsController < ApplicationController
8
8
  def index
9
- raise "There is an error in index"
9
+ raise 'There is an error in index'
10
10
  end
11
11
  end
12
12
  """
13
13
  And I write to "config/routes.rb" with:
14
14
  """
15
- Rails3App::Application.routes.draw do
15
+ TestApp::Application.routes.draw do
16
16
  resources :posts
17
17
  end
18
18
  """
19
19
 
20
20
  Scenario: Allow rescue
21
- Given I write to "features/posts.feature" with:
21
+ When I write to "features/posts.feature" with:
22
22
  """
23
- Feature: posts
23
+ Feature: Posts
24
24
  @allow-rescue
25
25
  Scenario: See posts
26
26
  When I look at the posts
27
+ Then I should see the public error page
27
28
  """
28
29
  And I write to "features/step_definitions/posts_steps.rb" with:
29
30
  """
30
- When /^I look at the posts$/ do
31
+ When('I look at the posts') do
31
32
  visit '/posts'
32
33
  end
34
+
35
+ Then('I should see the public error page') do
36
+ expect(page).to have_content "We're sorry, but something went wrong."
37
+ end
33
38
  """
34
39
  And I run `bundle exec rake db:migrate`
35
40
  And I run `bundle exec cucumber`
36
- Then it should pass with:
41
+ Then the feature run should pass with:
37
42
  """
38
43
  1 scenario (1 passed)
39
- 1 step (1 passed)
44
+ 2 steps (2 passed)
40
45
  """
41
46
 
42
47
  Scenario: Don't allow rescue
43
- Given I write to "features/posts.feature" with:
48
+ When I write to "features/posts.feature" with:
44
49
  """
45
- Feature: posts
50
+ Feature: Posts
46
51
  Scenario: See them
47
52
  When I look at the posts
48
53
  """
49
54
  And I write to "features/step_definitions/posts_steps.rb" with:
50
55
  """
51
- When /^I look at the posts$/ do
56
+ When('I look at the posts') do
52
57
  visit '/posts'
53
58
  end
54
59
  """
@@ -0,0 +1,20 @@
1
+ Feature: Annotations
2
+
3
+ In order to track my development progress
4
+ As a developer
5
+ I should be able to list annotations in my features
6
+
7
+ Scenario: See annotations in feature file
8
+ Given I have created a new Rails app with no database and installed cucumber-rails
9
+ When I write to "features/products.feature" with:
10
+ """
11
+ Feature: Products
12
+ Scenario: Test a Product
13
+ # TODO: When I go to the products page
14
+ """
15
+ When I run `bundle exec rake notes`
16
+ Then it should pass with:
17
+ """
18
+ features/products.feature:
19
+ * [3] [TODO] When I go to the products page
20
+ """