cucumber-rails2 0.3.3

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 (64) hide show
  1. data/.gitignore +4 -0
  2. data/HACKING.rdoc +24 -0
  3. data/History.txt +145 -0
  4. data/LICENSE +22 -0
  5. data/README.rdoc +70 -0
  6. data/Rakefile +24 -0
  7. data/VERSION +1 -0
  8. data/config/.gitignore +1 -0
  9. data/cucumber-rails2.gemspec +111 -0
  10. data/dev_tasks/cucumber.rake +5 -0
  11. data/dev_tasks/rspec.rake +13 -0
  12. data/features/rails2.feature +64 -0
  13. data/features/rails3.feature +97 -0
  14. data/features/rerun_profile.feature +39 -0
  15. data/features/step_definitions/cucumber_rails_steps.rb +35 -0
  16. data/features/support/env.rb +4 -0
  17. data/features/support/matchers/files.rb +17 -0
  18. data/generators/cucumber/USAGE +13 -0
  19. data/generators/cucumber/cucumber_generator.rb +88 -0
  20. data/generators/feature/USAGE +12 -0
  21. data/generators/feature/feature_generator.rb +47 -0
  22. data/lib/cucumber/rails/action_controller.rb +65 -0
  23. data/lib/cucumber/rails/active_record.rb +34 -0
  24. data/lib/cucumber/rails/capybara_javascript_emulation.rb +81 -0
  25. data/lib/cucumber/rails/rspec.rb +22 -0
  26. data/lib/cucumber/rails/test_unit.rb +7 -0
  27. data/lib/cucumber/rails/world.rb +48 -0
  28. data/lib/cucumber/web/tableish.rb +118 -0
  29. data/lib/generators/cucumber/feature/USAGE +16 -0
  30. data/lib/generators/cucumber/feature/feature_base.rb +29 -0
  31. data/lib/generators/cucumber/feature/feature_generator.rb +37 -0
  32. data/lib/generators/cucumber/feature/named_arg.rb +17 -0
  33. data/lib/generators/cucumber/install/USAGE +15 -0
  34. data/lib/generators/cucumber/install/install_base.rb +202 -0
  35. data/lib/generators/cucumber/install/install_generator.rb +64 -0
  36. data/spec/cucumber/web/tableish_spec.rb +192 -0
  37. data/spec/generators/cucumber/install/install_base_spec.rb +84 -0
  38. data/spec/spec.opts +2 -0
  39. data/spec/spec_helper.rb +6 -0
  40. data/templates/feature/feature.erb +63 -0
  41. data/templates/feature/steps.erb +14 -0
  42. data/templates/install/config/cucumber.yml.erb +8 -0
  43. data/templates/install/environments/cucumber.rb.erb +37 -0
  44. data/templates/install/script/cucumber +10 -0
  45. data/templates/install/step_definitions/capybara_steps.rb.erb +214 -0
  46. data/templates/install/step_definitions/web_steps_cs.rb.erb +136 -0
  47. data/templates/install/step_definitions/web_steps_da.rb.erb +114 -0
  48. data/templates/install/step_definitions/web_steps_de.rb.erb +136 -0
  49. data/templates/install/step_definitions/web_steps_es.rb.erb +136 -0
  50. data/templates/install/step_definitions/web_steps_ja.rb.erb +139 -0
  51. data/templates/install/step_definitions/web_steps_ko.rb.erb +141 -0
  52. data/templates/install/step_definitions/web_steps_no.rb.erb +114 -0
  53. data/templates/install/step_definitions/web_steps_pt-BR.rb.erb +140 -0
  54. data/templates/install/step_definitions/webrat_steps.rb.erb +276 -0
  55. data/templates/install/support/_rails_each_run.rb.erb +35 -0
  56. data/templates/install/support/_rails_prefork.rb.erb +12 -0
  57. data/templates/install/support/capybara.rb +9 -0
  58. data/templates/install/support/edit_warning.txt +5 -0
  59. data/templates/install/support/paths.rb +33 -0
  60. data/templates/install/support/rails.rb.erb +4 -0
  61. data/templates/install/support/rails_spork.rb.erb +13 -0
  62. data/templates/install/support/webrat.rb +8 -0
  63. data/templates/install/tasks/cucumber.rake.erb +48 -0
  64. metadata +143 -0
@@ -0,0 +1,35 @@
1
+ # If you set this to false, any error raised from within your app will bubble
2
+ # up to your step definition and out to cucumber unless you catch it somewhere
3
+ # on the way. You can make Rails rescue errors and render error pages on a
4
+ # per-scenario basis by tagging a scenario or feature with the @allow-rescue tag.
5
+ #
6
+ # If you set this to true, Rails will rescue all errors and render error
7
+ # pages, more or less in the same way your application would behave in the
8
+ # default production environment. It's not recommended to do this for all
9
+ # of your scenarios, as this makes it hard to discover errors in your application.
10
+ ActionController::Base.allow_rescue = false
11
+
12
+ <% unless options[:skip_database] -%>
13
+ # If you set this to true, each scenario will run in a database transaction.
14
+ # You can still turn off transactions on a per-scenario basis, simply tagging
15
+ # a feature or scenario with the @no-txn tag. If you are using Capybara,
16
+ # tagging with @culerity or @javascript will also turn transactions off.
17
+ #
18
+ # If you set this to false, transactions will be off for all scenarios,
19
+ # regardless of whether you use @no-txn or not.
20
+ #
21
+ # Beware that turning transactions off will leave data in your database
22
+ # after each scenario, which can lead to hard-to-debug failures in
23
+ # subsequent scenarios. If you do this, we recommend you create a Before
24
+ # block that will explicitly put your database in a known state.
25
+ Cucumber::Rails::World.use_transactional_fixtures = true
26
+ <% end -%>
27
+ # How to clean your database when transactions are turned off. See
28
+ # http://github.com/bmabey/database_cleaner for more info.
29
+ if defined?(ActiveRecord::Base)
30
+ begin
31
+ require 'database_cleaner'
32
+ DatabaseCleaner.strategy = :truncation
33
+ rescue LoadError => ignore_if_database_cleaner_not_present
34
+ end
35
+ end
@@ -0,0 +1,12 @@
1
+ ENV["RAILS_ENV"] ||= "<%= cucumber_rails_env %>"
2
+ require File.expand_path(File.dirname(__FILE__) + '/../../config/environment')
3
+
4
+ require 'cucumber/formatter/unicode' # Remove this line if you don't want Cucumber Unicode support
5
+ <% if framework == :rspec -%>
6
+ require 'cucumber/rails/rspec'
7
+ <% end -%>
8
+ require 'cucumber/rails/world'
9
+ <% unless options[:skip_database] -%>
10
+ require 'cucumber/rails/active_record'
11
+ <% end -%>
12
+ require 'cucumber/web/tableish'
@@ -0,0 +1,9 @@
1
+ require 'capybara/rails'
2
+ require 'capybara/cucumber'
3
+ require 'capybara/session'
4
+ require 'cucumber/rails/capybara_javascript_emulation' # Lets you click links with onclick javascript handlers without using @culerity or @javascript
5
+ # Capybara defaults to XPath selectors rather than Webrat's default of CSS3. In
6
+ # order to ease the transition to Capybara we set the default here. If you'd
7
+ # prefer to use XPath just remove this line and adjust any selectors in your
8
+ # steps to use the XPath syntax.
9
+ Capybara.default_selector = :css
@@ -0,0 +1,5 @@
1
+ # IMPORTANT: This file is generated by cucumber-rails - edit at your own peril.
2
+ # It is recommended to regenerate this file in the future when you upgrade to a
3
+ # newer version of cucumber-rails. Consider adding your own code to a new file
4
+ # instead of editing this one. Cucumber will automatically load all features/**/*.rb
5
+ # files.
@@ -0,0 +1,33 @@
1
+ module NavigationHelpers
2
+ # Maps a name to a path. Used by the
3
+ #
4
+ # When /^I go to (.+)$/ do |page_name|
5
+ #
6
+ # step definition in web_steps.rb
7
+ #
8
+ def path_to(page_name)
9
+ case page_name
10
+
11
+ when /the home\s?page/
12
+ '/'
13
+
14
+ # Add more mappings here.
15
+ # Here is an example that pulls values out of the Regexp:
16
+ #
17
+ # when /^(.*)'s profile page$/i
18
+ # user_profile_path(User.find_by_login($1))
19
+
20
+ else
21
+ begin
22
+ page_name =~ /the (.*) page/
23
+ path_components = $1.split(/\s+/)
24
+ self.send(path_components.push('path').join('_').to_sym)
25
+ rescue Object => e
26
+ raise "Can't find mapping from \"#{page_name}\" to a path.\n" +
27
+ "Now, go and add a mapping in #{__FILE__}"
28
+ end
29
+ end
30
+ end
31
+ end
32
+
33
+ World(NavigationHelpers)
@@ -0,0 +1,4 @@
1
+ <%= embed_file('support/edit_warning.txt') %>
2
+ <%= embed_template('support/_rails_prefork.rb.erb') %>
3
+ <%= embed_file("support/#{driver}.rb") %>
4
+ <%= embed_template('support/_rails_each_run.rb.erb') %>
@@ -0,0 +1,13 @@
1
+ <%= embed_file('support/edit_warning.txt') %>
2
+ require 'rubygems'
3
+ require 'spork'
4
+
5
+ Spork.prefork do
6
+ <%= embed_template('support/_rails_prefork.rb.erb', ' ') %>
7
+
8
+ <%= embed_file("support/#{driver}.rb", ' ') %>
9
+ end
10
+
11
+ Spork.each_run do
12
+ <%= embed_template('support/_rails_each_run.rb.erb', ' ') %>
13
+ end
@@ -0,0 +1,8 @@
1
+ require 'webrat'
2
+ require 'webrat/core/matchers'
3
+
4
+ Webrat.configure do |config|
5
+ config.mode = :rails
6
+ config.open_error_files = false # Set to true if you want error pages to pop up in the browser
7
+ end
8
+
@@ -0,0 +1,48 @@
1
+ <%= embed_file('support/edit_warning.txt') %>
2
+
3
+ unless ARGV.any? {|a| a =~ /^gems/} # Don't load anything when running the gems:* tasks
4
+
5
+ vendored_cucumber_bin = Dir["#{<%= defined?(Rails.root) ? 'Rails.root' : 'RAILS_ROOT' %>}/vendor/{gems,plugins}/cucumber*/bin/cucumber"].first
6
+ $LOAD_PATH.unshift(File.dirname(vendored_cucumber_bin) + '/../lib') unless vendored_cucumber_bin.nil?
7
+
8
+ begin
9
+ require 'cucumber/rake/task'
10
+
11
+ namespace :cucumber do
12
+ Cucumber::Rake::Task.new({:ok => 'db:test:prepare'}, 'Run features that should pass') do |t|
13
+ t.binary = vendored_cucumber_bin # If nil, the gem's binary is used.
14
+ t.fork = true # You may get faster startup if you set this to false
15
+ t.profile = 'default'
16
+ end
17
+
18
+ Cucumber::Rake::Task.new({:wip => 'db:test:prepare'}, 'Run features that are being worked on') do |t|
19
+ t.binary = vendored_cucumber_bin
20
+ t.fork = true # You may get faster startup if you set this to false
21
+ t.profile = 'wip'
22
+ end
23
+
24
+ Cucumber::Rake::Task.new({:rerun => 'db:test:prepare'}, 'Record failing features and run only them if any exist') do |t|
25
+ t.binary = vendored_cucumber_bin
26
+ t.fork = true # You may get faster startup if you set this to false
27
+ t.profile = 'rerun'
28
+ end
29
+
30
+ desc 'Run all features'
31
+ task :all => [:ok, :wip]
32
+ end
33
+ desc 'Alias for cucumber:ok'
34
+ task :cucumber => 'cucumber:ok'
35
+
36
+ task :default => :cucumber
37
+
38
+ task :features => :cucumber do
39
+ STDERR.puts "*** The 'features' task is deprecated. See rake -T cucumber ***"
40
+ end
41
+ rescue LoadError
42
+ desc 'cucumber rake task not available (cucumber not installed)'
43
+ task :cucumber do
44
+ abort 'Cucumber rake task is not available. Be sure to install cucumber as a gem or plugin'
45
+ end
46
+ end
47
+
48
+ end
metadata ADDED
@@ -0,0 +1,143 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cucumber-rails2
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.3.3
6
+ platform: ruby
7
+ authors:
8
+ - "Dennis Bl\xC3\xB6te"
9
+ - "Aslak Helles\xC3\xB8y"
10
+ - Rob Holland
11
+ autorequire:
12
+ bindir: bin
13
+ cert_chain: []
14
+
15
+ date: 2010-06-06 00:00:00 Z
16
+ dependencies:
17
+ - !ruby/object:Gem::Dependency
18
+ name: cucumber
19
+ prerelease: false
20
+ requirement: &id001 !ruby/object:Gem::Requirement
21
+ none: false
22
+ requirements:
23
+ - - ~>
24
+ - !ruby/object:Gem::Version
25
+ version: 1.1.0
26
+ type: :runtime
27
+ version_requirements: *id001
28
+ - !ruby/object:Gem::Dependency
29
+ name: aruba
30
+ prerelease: false
31
+ requirement: &id002 !ruby/object:Gem::Requirement
32
+ none: false
33
+ requirements:
34
+ - - ">="
35
+ - !ruby/object:Gem::Version
36
+ version: 0.1.9
37
+ type: :development
38
+ version_requirements: *id002
39
+ description: Cucumber Generators and Runtime for Rails
40
+ email: cukes@googlegroups.com
41
+ executables: []
42
+
43
+ extensions: []
44
+
45
+ extra_rdoc_files:
46
+ - LICENSE
47
+ - README.rdoc
48
+ files:
49
+ - .gitignore
50
+ - HACKING.rdoc
51
+ - History.txt
52
+ - LICENSE
53
+ - README.rdoc
54
+ - Rakefile
55
+ - VERSION
56
+ - config/.gitignore
57
+ - cucumber-rails2.gemspec
58
+ - dev_tasks/cucumber.rake
59
+ - dev_tasks/rspec.rake
60
+ - features/rails2.feature
61
+ - features/rails3.feature
62
+ - features/rerun_profile.feature
63
+ - features/step_definitions/cucumber_rails_steps.rb
64
+ - features/support/env.rb
65
+ - features/support/matchers/files.rb
66
+ - generators/cucumber/USAGE
67
+ - generators/cucumber/cucumber_generator.rb
68
+ - generators/feature/USAGE
69
+ - generators/feature/feature_generator.rb
70
+ - lib/cucumber/rails/action_controller.rb
71
+ - lib/cucumber/rails/active_record.rb
72
+ - lib/cucumber/rails/capybara_javascript_emulation.rb
73
+ - lib/cucumber/rails/rspec.rb
74
+ - lib/cucumber/rails/test_unit.rb
75
+ - lib/cucumber/rails/world.rb
76
+ - lib/cucumber/web/tableish.rb
77
+ - lib/generators/cucumber/feature/USAGE
78
+ - lib/generators/cucumber/feature/feature_base.rb
79
+ - lib/generators/cucumber/feature/feature_generator.rb
80
+ - lib/generators/cucumber/feature/named_arg.rb
81
+ - lib/generators/cucumber/install/USAGE
82
+ - lib/generators/cucumber/install/install_base.rb
83
+ - lib/generators/cucumber/install/install_generator.rb
84
+ - spec/cucumber/web/tableish_spec.rb
85
+ - spec/generators/cucumber/install/install_base_spec.rb
86
+ - spec/spec.opts
87
+ - spec/spec_helper.rb
88
+ - templates/feature/feature.erb
89
+ - templates/feature/steps.erb
90
+ - templates/install/config/cucumber.yml.erb
91
+ - templates/install/environments/cucumber.rb.erb
92
+ - templates/install/script/cucumber
93
+ - templates/install/step_definitions/capybara_steps.rb.erb
94
+ - templates/install/step_definitions/web_steps_cs.rb.erb
95
+ - templates/install/step_definitions/web_steps_da.rb.erb
96
+ - templates/install/step_definitions/web_steps_de.rb.erb
97
+ - templates/install/step_definitions/web_steps_es.rb.erb
98
+ - templates/install/step_definitions/web_steps_ja.rb.erb
99
+ - templates/install/step_definitions/web_steps_ko.rb.erb
100
+ - templates/install/step_definitions/web_steps_no.rb.erb
101
+ - templates/install/step_definitions/web_steps_pt-BR.rb.erb
102
+ - templates/install/step_definitions/webrat_steps.rb.erb
103
+ - templates/install/support/_rails_each_run.rb.erb
104
+ - templates/install/support/_rails_prefork.rb.erb
105
+ - templates/install/support/capybara.rb
106
+ - templates/install/support/edit_warning.txt
107
+ - templates/install/support/paths.rb
108
+ - templates/install/support/rails.rb.erb
109
+ - templates/install/support/rails_spork.rb.erb
110
+ - templates/install/support/webrat.rb
111
+ - templates/install/tasks/cucumber.rake.erb
112
+ homepage: http://github.com/aslakhellesoy/cucumber-rails
113
+ licenses: []
114
+
115
+ post_install_message:
116
+ rdoc_options:
117
+ - --charset=UTF-8
118
+ require_paths:
119
+ - lib
120
+ required_ruby_version: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ">="
124
+ - !ruby/object:Gem::Version
125
+ version: "0"
126
+ required_rubygems_version: !ruby/object:Gem::Requirement
127
+ none: false
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: "0"
132
+ requirements: []
133
+
134
+ rubyforge_project:
135
+ rubygems_version: 1.8.23
136
+ signing_key:
137
+ specification_version: 3
138
+ summary: Cucumber Generators and Runtime for Rails
139
+ test_files:
140
+ - spec/cucumber/web/tableish_spec.rb
141
+ - spec/generators/cucumber/install/install_base_spec.rb
142
+ - spec/spec_helper.rb
143
+ has_rdoc: