Permalink
Browse files

Removed the feature generator

  • Loading branch information...
1 parent f027440 commit b1698f1be6402c5da2377903b5132e743bfc1d83 @aslakhellesoy aslakhellesoy committed Oct 3, 2011
View
@@ -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)
View
@@ -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
View
@@ -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:
View
@@ -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}"
@@ -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)
"""
@@ -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`
@@ -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
@@ -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
-
@@ -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 <button> instead. You can
- # see how in http://github.com/jnicklas/capybara/issues#issue/12
- #
-<% if options[:capybara] -%>
- @<%= options[:capybara] %>
-<% end -%>
-<% end -%>
- Scenario: Delete <%= singular_name %>
- Given the following <%= plural_name %>:
- |<%= named_args.map(&:name).join('|') %>|
-<% (1..4).each do |n| -%>
- |<%= named_args.map{|arg| arg.value(n)}.join('|') %>|
-<% end -%>
- When I delete the 3rd <%= singular_name %>
- Then I should see the following <%= plural_name %>:
- |<%= named_args.map{|arg| arg.name.humanize}.join('|') %>|
-<% [1,2,4].each do |n| -%>
- |<%= named_args.map{|arg| arg.value(n)}.join('|') %>|
-<% end -%>
@@ -1,14 +0,0 @@
-Given /^the following <%= plural_name %>:$/ do |<%= plural_name %>|
- <%= class_name %>.create!(<%= plural_name %>.hashes)
-end
-
-When /^I delete the (\d+)(?:st|nd|rd|th) <%= singular_name %>$/ do |pos|
- visit <%= plural_name %>_path
- within("table tr:nth-child(#{pos.to_i+1})") do
- click_link "Destroy"
- end
-end
-
-Then /^I should see the following <%= plural_name %>:$/ do |expected_<%= plural_name %>_table|
- expected_<%= plural_name %>_table.diff!(tableish('table tr', 'td,th'))
-end
@@ -4,8 +4,6 @@ Description:
This also generates the necessary files in the features directory.
- Also see the cucumber:feature generator.
-
Examples:
`rails generate cucumber:install`

0 comments on commit b1698f1

Please sign in to comment.