cucumber_rails3_gen 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. data/LICENSE +20 -0
  2. data/README +19 -0
  3. data/README.rdoc +19 -0
  4. data/USAGE +19 -0
  5. data/VERSION +1 -0
  6. data/bin/cucumber_skeleton +19 -0
  7. data/lib/generators/cucumber/skeleton/USAGE +19 -0
  8. data/lib/generators/cucumber/skeleton/skeleton_generator.rb +178 -0
  9. data/lib/generators/cucumber/skeleton/templates/config/cucumber.yml.erb +7 -0
  10. data/lib/generators/cucumber/skeleton/templates/environments/cucumber.rb.erb +37 -0
  11. data/lib/generators/cucumber/skeleton/templates/script/cucumber +10 -0
  12. data/lib/generators/cucumber/skeleton/templates/step_definitions/capybara_steps.rb.erb +187 -0
  13. data/lib/generators/cucumber/skeleton/templates/step_definitions/web_steps_cs.rb.erb +136 -0
  14. data/lib/generators/cucumber/skeleton/templates/step_definitions/web_steps_da.rb.erb +114 -0
  15. data/lib/generators/cucumber/skeleton/templates/step_definitions/web_steps_de.rb.erb +136 -0
  16. data/lib/generators/cucumber/skeleton/templates/step_definitions/web_steps_es.rb.erb +136 -0
  17. data/lib/generators/cucumber/skeleton/templates/step_definitions/web_steps_ja.rb.erb +136 -0
  18. data/lib/generators/cucumber/skeleton/templates/step_definitions/web_steps_no.rb.erb +114 -0
  19. data/lib/generators/cucumber/skeleton/templates/step_definitions/web_steps_pt-BR.rb.erb +140 -0
  20. data/lib/generators/cucumber/skeleton/templates/step_definitions/webrat_steps.rb.erb +258 -0
  21. data/lib/generators/cucumber/skeleton/templates/support/_rails_each_run.rb +29 -0
  22. data/lib/generators/cucumber/skeleton/templates/support/_rails_prefork.rb.erb +10 -0
  23. data/lib/generators/cucumber/skeleton/templates/support/capybara.rb +9 -0
  24. data/lib/generators/cucumber/skeleton/templates/support/edit_warning.txt +5 -0
  25. data/lib/generators/cucumber/skeleton/templates/support/paths.rb +27 -0
  26. data/lib/generators/cucumber/skeleton/templates/support/rails.rb.erb +5 -0
  27. data/lib/generators/cucumber/skeleton/templates/support/rails_spork.rb.erb +13 -0
  28. data/lib/generators/cucumber/skeleton/templates/support/webrat.rb +8 -0
  29. data/lib/generators/cucumber/skeleton/templates/tasks/cucumber.rake.erb +42 -0
  30. data/spec/cucumber_gen_spec.rb +7 -0
  31. data/spec/spec_helper.rb +9 -0
  32. metadata +95 -0
@@ -0,0 +1,29 @@
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
+ # If you set this to true, each scenario will run in a database transaction.
13
+ # You can still turn off transactions on a per-scenario basis, simply tagging
14
+ # a feature or scenario with the @no-txn tag. If you are using Capybara,
15
+ # tagging with @culerity or @javascript will also turn transactions off.
16
+ #
17
+ # If you set this to false, transactions will be off for all scenarios,
18
+ # regardless of whether you use @no-txn or not.
19
+ #
20
+ # Beware that turning transactions off will leave data in your database
21
+ # after each scenario, which can lead to hard-to-debug failures in
22
+ # subsequent scenarios. If you do this, we recommend you create a Before
23
+ # block that will explicitly put your database in a known state.
24
+ Cucumber::Rails::World.use_transactional_fixtures = true
25
+
26
+ # How to clean your database when transactions are turned off. See
27
+ # http://github.com/bmabey/database_cleaner for more info.
28
+ require 'database_cleaner'
29
+ DatabaseCleaner.strategy = :truncation
@@ -0,0 +1,10 @@
1
+ ENV["RAILS_ENV"] ||= "cucumber"
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
+ require 'cucumber/rails/active_record'
10
+ 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,27 @@
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
+ raise "Can't find mapping from \"#{page_name}\" to a path.\n" +
22
+ "Now, go and add a mapping in #{__FILE__}"
23
+ end
24
+ end
25
+ end
26
+
27
+ World(NavigationHelpers)
@@ -0,0 +1,5 @@
1
+ <%= Cucumber::Helper.embed_file('support/edit_warning.txt') %>
2
+ <% Cucumber::Helper.framework = framework %>
3
+ <%= Cucumber::Helper.embed_template('support/_rails_prefork.rb.erb') %>
4
+ <%= Cucumber::Helper.embed_file("support/#{driver}.rb") %>
5
+ <%= Cucumber::Helper.embed_file('support/_rails_each_run.rb') %>
@@ -0,0 +1,13 @@
1
+ <%= Cucumber::Helper.embed_file('support/edit_warning.txt') %>
2
+ require 'rubygems'
3
+ require 'spork'
4
+
5
+ Spork.prefork do
6
+ <%= Cucumber::Helper.embed_template('support/_rails_prefork.rb.erb', ' ') %>
7
+
8
+ <%= Cucumber::Helper.embed_file("support/#{driver}.rb", ' ') %>
9
+ end
10
+
11
+ Spork.each_run do
12
+ <%= Cucumber::Helper.embed_file('support/_rails_each_run.rb', ' ') %>
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,42 @@
1
+ <%= Cucumber::Helper.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["#{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
+ desc 'Run all features'
25
+ task :all => [:ok, :wip]
26
+ end
27
+ desc 'Alias for cucumber:ok'
28
+ task :cucumber => 'cucumber:ok'
29
+
30
+ task :default => :cucumber
31
+
32
+ task :features => :cucumber do
33
+ STDERR.puts "*** The 'features' task is deprecated. See rake -T cucumber ***"
34
+ end
35
+ rescue LoadError
36
+ desc 'cucumber rake task not available (cucumber not installed)'
37
+ task :cucumber do
38
+ abort 'Cucumber rake task is not available. Be sure to install cucumber as a gem or plugin'
39
+ end
40
+ end
41
+
42
+ end
@@ -0,0 +1,7 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe "Cucumber Rails 3 generator" do
4
+ it "fails" do
5
+ fail "hey buddy, you should probably rename this file and start specing for real"
6
+ end
7
+ end
@@ -0,0 +1,9 @@
1
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
2
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
3
+ require 'mongo_modl'
4
+ require 'spec'
5
+ require 'spec/autorun'
6
+
7
+ Spec::Runner.configure do |config|
8
+
9
+ end
metadata ADDED
@@ -0,0 +1,95 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cucumber_rails3_gen
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ platform: ruby
6
+ authors:
7
+ - Kristian Mandrup
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2010-02-05 00:00:00 +01:00
13
+ default_executable: cucumber_skeleton
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: rspec
17
+ type: :development
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 1.2.9
24
+ version:
25
+ description: Cucumber Rails 3 generators
26
+ email: kmandrup@gmail.com
27
+ executables:
28
+ - cucumber_skeleton
29
+ extensions: []
30
+
31
+ extra_rdoc_files:
32
+ - LICENSE
33
+ - README
34
+ - README.rdoc
35
+ files:
36
+ - USAGE
37
+ - VERSION
38
+ - bin/cucumber_skeleton
39
+ - lib/generators/cucumber/skeleton/USAGE
40
+ - lib/generators/cucumber/skeleton/skeleton_generator.rb
41
+ - lib/generators/cucumber/skeleton/templates/config/cucumber.yml.erb
42
+ - lib/generators/cucumber/skeleton/templates/environments/cucumber.rb.erb
43
+ - lib/generators/cucumber/skeleton/templates/script/cucumber
44
+ - lib/generators/cucumber/skeleton/templates/step_definitions/capybara_steps.rb.erb
45
+ - lib/generators/cucumber/skeleton/templates/step_definitions/web_steps_cs.rb.erb
46
+ - lib/generators/cucumber/skeleton/templates/step_definitions/web_steps_da.rb.erb
47
+ - lib/generators/cucumber/skeleton/templates/step_definitions/web_steps_de.rb.erb
48
+ - lib/generators/cucumber/skeleton/templates/step_definitions/web_steps_es.rb.erb
49
+ - lib/generators/cucumber/skeleton/templates/step_definitions/web_steps_ja.rb.erb
50
+ - lib/generators/cucumber/skeleton/templates/step_definitions/web_steps_no.rb.erb
51
+ - lib/generators/cucumber/skeleton/templates/step_definitions/web_steps_pt-BR.rb.erb
52
+ - lib/generators/cucumber/skeleton/templates/step_definitions/webrat_steps.rb.erb
53
+ - lib/generators/cucumber/skeleton/templates/support/_rails_each_run.rb
54
+ - lib/generators/cucumber/skeleton/templates/support/_rails_prefork.rb.erb
55
+ - lib/generators/cucumber/skeleton/templates/support/capybara.rb
56
+ - lib/generators/cucumber/skeleton/templates/support/edit_warning.txt
57
+ - lib/generators/cucumber/skeleton/templates/support/paths.rb
58
+ - lib/generators/cucumber/skeleton/templates/support/rails.rb.erb
59
+ - lib/generators/cucumber/skeleton/templates/support/rails_spork.rb.erb
60
+ - lib/generators/cucumber/skeleton/templates/support/webrat.rb
61
+ - lib/generators/cucumber/skeleton/templates/tasks/cucumber.rake.erb
62
+ - LICENSE
63
+ - README
64
+ - README.rdoc
65
+ has_rdoc: true
66
+ homepage: http://github.com/kristianmandrup/cucumber_rails3_gen
67
+ licenses: []
68
+
69
+ post_install_message:
70
+ rdoc_options:
71
+ - --charset=UTF-8
72
+ require_paths:
73
+ - lib
74
+ required_ruby_version: !ruby/object:Gem::Requirement
75
+ requirements:
76
+ - - ">="
77
+ - !ruby/object:Gem::Version
78
+ version: "0"
79
+ version:
80
+ required_rubygems_version: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ version: "0"
85
+ version:
86
+ requirements: []
87
+
88
+ rubyforge_project:
89
+ rubygems_version: 1.3.5
90
+ signing_key:
91
+ specification_version: 3
92
+ summary: Cucumber Rails 3 generators
93
+ test_files:
94
+ - spec/cucumber_gen_spec.rb
95
+ - spec/spec_helper.rb