diff --git a/Gemfile.lock b/Gemfile.lock index cb890f0d..314a8a74 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - cucumber-rails (1.1.0) + cucumber-rails (1.1.1) capybara (>= 1.1.1) cucumber (>= 1.1.0) nokogiri (>= 1.5.0) diff --git a/History.md b/History.md index db14b322..7d1e88b7 100755 --- a/History.md +++ b/History.md @@ -1,3 +1,10 @@ +## [v1.1.0](https://github.com/cucumber/cucumber-rails/compare/v1.1.0...v1.1.1) + +### Removed features + +The `cucumber:feature` generator has been removed. The reasoning behind this is the same as for +removing `web_steps.rb`, `paths.rb` and `selectors.rb` in v1.1.0. + ## [v1.1.0](https://github.com/cucumber/cucumber-rails/compare/v1.0.6...v1.1.0) ### Removed features diff --git a/README.md b/README.md index 6d66e086..78c61216 100644 --- a/README.md +++ b/README.md @@ -4,12 +4,6 @@ Cucumber-Rails brings Cucumber to Rails 3.x. For Rails 2x support, see the [Cucumber Wiki](https://github.com/cucumber/cucumber/wiki/Ruby-on-Rails). -Cucumber-Rails contains 2 generators - one -for bootstrapping your Rails app for Cucumber, and a second one for generating features. - -Cucumber-Rails also contains Cucumber Step Definitions that wrap Capybara, -giving you a head start for writing Cucumber features against your Rails app. - ## Installation Before you can use the generator, add the gem to your project's Gemfile as follows: @@ -32,18 +26,6 @@ Finally, bootstrap your Rails app, for example: rails generate cucumber:install -## Generating a Cucumber feature - -IMPORTANT: Only do this if you are new to Cucumber. We recommend you write your -Cucumber features by hand once you get the hang of it. - -Example: - - rails generate cucumber:feature post title:string body:text published:boolean - rails generate scaffold post title:string body:text published:boolean - rake db:migrate - rake cucumber - ## Running Cucumber With Rake: diff --git a/cucumber-rails.gemspec b/cucumber-rails.gemspec index 07e79a9f..10c72591 100644 --- a/cucumber-rails.gemspec +++ b/cucumber-rails.gemspec @@ -3,7 +3,7 @@ $LOAD_PATH.unshift File.expand_path("../lib", __FILE__) Gem::Specification.new do |s| s.name = 'cucumber-rails' - s.version = '1.1.0' + s.version = '1.1.1' s.authors = ["Aslak Hellesøy", "Dennis Blöte", "Rob Holland"] s.description = "Cucumber Generators and Runtime for Rails" s.summary = "#{s.name}-#{s.version}" diff --git a/features/inspect_query_string.feature b/features/inspect_query_string.feature index 82cd3c15..71f0da77 100644 --- a/features/inspect_query_string.feature +++ b/features/inspect_query_string.feature @@ -2,8 +2,6 @@ Feature: Inspect query string Scenario: Inspect query string Given I have created a new Rails 3 app "rails-3-app" with cucumber-rails support - And I successfully run `rails generate cucumber:feature post title:string body:text number:integer published:boolean` - And I successfully run `rails generate scaffold post title:string body:text number:integer published:boolean` And I successfully run `rails generate scaffold cuke name:string` And I overwrite "app/controllers/cukes_controller.rb" with: """ @@ -31,7 +29,7 @@ Feature: Inspect query string And I run `bundle exec rake cucumber` Then it should pass with: """ - 3 scenarios (3 passed) - 16 steps (16 passed) + 1 scenario (1 passed) + 3 steps (3 passed) """ diff --git a/lib/generators/cucumber/feature/USAGE b/lib/generators/cucumber/feature/USAGE deleted file mode 100644 index d94af5a5..00000000 --- a/lib/generators/cucumber/feature/USAGE +++ /dev/null @@ -1,16 +0,0 @@ -Description: - Generates a skeleton for a new feature. Both a simple .feature file and - a steps.rb file is generated. This generator should be used with moderation. - See https://github.com/cucumber/cucumber/wiki/Feature-Coupled-Steps-(Antipattern) - for details about the dangers involved. - - This generator can take an optional list of attribute pairs similar to Rails' - built-in resource generator. - -Examples (Rails 3): - `script/rails generate cucumber:feature post` # no attributes - `script/rails generate cucumber:feature post title:string body:text published:boolean` - -Examples (Rails 2): - `script/generate feature post` # no attributes - `script/generate feature post title:string body:text published:boolean` diff --git a/lib/generators/cucumber/feature/feature_generator.rb b/lib/generators/cucumber/feature/feature_generator.rb deleted file mode 100644 index 3abf74f4..00000000 --- a/lib/generators/cucumber/feature/feature_generator.rb +++ /dev/null @@ -1,27 +0,0 @@ -require File.join(File.dirname(__FILE__), 'named_arg') - -module Cucumber - class FeatureGenerator < ::Rails::Generators::NamedBase - source_root File.expand_path("../templates", __FILE__) - - argument :fields, :optional => true, :type => :array, :banner => "[field:type, field:type]" - - attr_reader :named_args - - def parse_fields - @named_args = @fields.nil? ? [] : @fields.map { |arg| NamedArg.new(arg) } - end - - def generate - template 'feature.erb', "features/manage_#{plural_name}.feature" - template 'steps.erb', "features/step_definitions/#{singular_name}_steps.rb" - gsub_file 'features/support/paths.rb', /'\/'/mi do |match| - "#{match}\n when /the new #{singular_name} page/\n new_#{singular_name}_path\n" - end - end - - def self.banner - "#{$0} cucumber:feature ModelName [field:type, field:type]" - end - end -end diff --git a/lib/generators/cucumber/feature/named_arg.rb b/lib/generators/cucumber/feature/named_arg.rb deleted file mode 100644 index bf0c2ad8..00000000 --- a/lib/generators/cucumber/feature/named_arg.rb +++ /dev/null @@ -1,19 +0,0 @@ -class NamedArg - attr_reader :name - attr_reader :type - - def initialize(s) - @name, @type = *s.split(':') - end - - def value(n) - if @type == 'boolean' - (n % 2) == 0 - elsif @type == 'integer' - n - else - "#{@name} #{n}" - end - end -end - diff --git a/lib/generators/cucumber/feature/templates/feature.erb b/lib/generators/cucumber/feature/templates/feature.erb deleted file mode 100644 index 8bc10201..00000000 --- a/lib/generators/cucumber/feature/templates/feature.erb +++ /dev/null @@ -1,63 +0,0 @@ -Feature: Manage <%= plural_name %> - In order to [goal] - [stakeholder] - wants [behaviour] - - Scenario: Register new <%= singular_name %> - Given I am on the new <%= singular_name %> page -<% keyword = 'When' -%> -<% named_args.each do |arg| -%> -<% if arg.type == 'boolean' -%> - <%= keyword %> I uncheck "<%= arg.name.humanize %>" -<% else -%> - <%= keyword %> I fill in "<%= arg.name.humanize %>" with "<%= arg.value(1) %>" -<% end -%> -<% keyword = 'And' -%> -<% end -%> - And I press "Create" -<% keyword = 'Then' -%> -<% named_args.each do |arg| -%> - <%= keyword %> I should see "<%= arg.value(1) %>" -<% keyword = 'And' -%> -<% end -%> - -<% if IO.read('features/support/env.rb') =~ /capybara/n -%> - # Rails generates Delete links that use Javascript to pop up a confirmation - # dialog and then do a HTTP POST request (emulated DELETE request). - # - # Capybara must use Culerity/Celerity or Selenium2 (webdriver) when pages rely - # on Javascript events. Only Culerity/Celerity supports clicking on confirmation - # dialogs. - # - # Since Culerity/Celerity and Selenium2 has some overhead, Cucumber-Rails will - # detect the presence of Javascript behind Delete links and issue a DELETE request - # instead of a GET request. - # - # You can turn this emulation off by tagging your scenario with @no-js-emulation. - # Turning on browser testing with @selenium, @culerity, @celerity or @javascript - # will also turn off the emulation. (See the Capybara documentation for - # details about those tags). If any of the browser tags are present, Cucumber-Rails - # will also turn off transactions and clean the database with DatabaseCleaner - # after the scenario has finished. This is to prevent data from leaking into - # the next scenario. - # - # Another way to avoid Cucumber-Rails' javascript emulation without using any - # of the tags above is to modify your views to use