steak 1.1.0 → 2.0.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (149) hide show
  1. data/{MIT-LICENSE → LICENSE} +1 -1
  2. data/README.md +110 -0
  3. data/lib/generators/steak/install_generator.rb +12 -0
  4. data/lib/generators/steak/spec_generator.rb +11 -0
  5. data/lib/generators/steak/templates/acceptance_spec.rb +13 -0
  6. data/lib/generators/steak/templates/spec/acceptance/acceptance_helper.rb +4 -0
  7. data/lib/generators/steak/templates/spec/acceptance/support/helpers.rb +6 -0
  8. data/lib/{rspec-2/rails/generators/templates → generators/steak/templates/spec/acceptance/support}/paths.rb +1 -1
  9. data/lib/steak.rb +4 -10
  10. data/lib/steak/acceptance_example_group.rb +12 -0
  11. data/lib/steak/railtie.rb +7 -0
  12. data/lib/steak/version.rb +3 -0
  13. data/lib/tasks/steak_tasks.rake +14 -0
  14. data/spec/acceptance/creating_specs_spec.rb +75 -0
  15. data/spec/acceptance/getting_started_spec.rb +33 -0
  16. data/spec/acceptance/rake_support_spec.rb +40 -0
  17. data/spec/fixtures/rails_project/.gitignore +5 -0
  18. data/spec/fixtures/rails_project/Gemfile +55 -0
  19. data/spec/fixtures/rails_project/README +261 -0
  20. data/spec/fixtures/rails_project/Rakefile +7 -0
  21. data/spec/fixtures/rails_project/app/assets/images/rails.png +0 -0
  22. data/spec/fixtures/rails_project/app/assets/javascripts/application.js +9 -0
  23. data/spec/fixtures/rails_project/app/assets/stylesheets/application.css +7 -0
  24. data/spec/fixtures/rails_project/app/controllers/application_controller.rb +3 -0
  25. data/spec/fixtures/rails_project/app/helpers/application_helper.rb +2 -0
  26. data/spec/fixtures/rails_project/app/mailers/.gitkeep +0 -0
  27. data/spec/fixtures/rails_project/app/models/.gitkeep +0 -0
  28. data/spec/fixtures/rails_project/app/views/layouts/application.html.erb +14 -0
  29. data/spec/fixtures/rails_project/config.ru +4 -0
  30. data/spec/fixtures/rails_project/config/application.rb +49 -0
  31. data/spec/fixtures/rails_project/config/boot.rb +6 -0
  32. data/spec/fixtures/rails_project/config/database.yml +48 -0
  33. data/spec/fixtures/rails_project/config/environment.rb +5 -0
  34. data/spec/fixtures/rails_project/config/environments/development.rb +24 -0
  35. data/spec/fixtures/rails_project/config/environments/production.rb +52 -0
  36. data/spec/fixtures/rails_project/config/environments/test.rb +39 -0
  37. data/spec/fixtures/rails_project/config/initializers/backtrace_silencers.rb +7 -0
  38. data/spec/fixtures/rails_project/config/initializers/inflections.rb +10 -0
  39. data/spec/fixtures/rails_project/config/initializers/mime_types.rb +5 -0
  40. data/spec/fixtures/rails_project/config/initializers/secret_token.rb +7 -0
  41. data/spec/fixtures/rails_project/config/initializers/session_store.rb +8 -0
  42. data/spec/fixtures/rails_project/config/initializers/wrap_parameters.rb +12 -0
  43. data/spec/fixtures/rails_project/config/locales/en.yml +5 -0
  44. data/spec/fixtures/rails_project/config/routes.rb +58 -0
  45. data/spec/fixtures/rails_project/db/seeds.rb +7 -0
  46. data/spec/fixtures/rails_project/doc/README_FOR_APP +2 -0
  47. data/spec/fixtures/rails_project/lib/tasks/.gitkeep +0 -0
  48. data/spec/fixtures/rails_project/log/.gitkeep +0 -0
  49. data/spec/fixtures/rails_project/public/404.html +26 -0
  50. data/spec/fixtures/rails_project/public/422.html +26 -0
  51. data/spec/fixtures/rails_project/public/500.html +26 -0
  52. data/spec/fixtures/rails_project/public/favicon.ico +0 -0
  53. data/spec/fixtures/rails_project/public/index.html +241 -0
  54. data/spec/fixtures/rails_project/public/robots.txt +5 -0
  55. data/spec/fixtures/rails_project/script/rails +6 -0
  56. data/spec/fixtures/rails_project/test/fixtures/.gitkeep +0 -0
  57. data/spec/fixtures/rails_project/test/functional/.gitkeep +0 -0
  58. data/spec/fixtures/rails_project/test/integration/.gitkeep +0 -0
  59. data/spec/fixtures/rails_project/test/performance/browsing_test.rb +12 -0
  60. data/spec/fixtures/rails_project/test/test_helper.rb +13 -0
  61. data/spec/fixtures/rails_project/test/unit/.gitkeep +0 -0
  62. data/spec/fixtures/rails_project/vendor/assets/stylesheets/.gitkeep +0 -0
  63. data/spec/fixtures/rails_project/vendor/plugins/.gitkeep +0 -0
  64. data/spec/fixtures/rails_project_with_steak/.gitignore +5 -0
  65. data/spec/fixtures/rails_project_with_steak/.rspec +1 -0
  66. data/spec/fixtures/rails_project_with_steak/Gemfile +58 -0
  67. data/spec/fixtures/rails_project_with_steak/README +261 -0
  68. data/spec/fixtures/rails_project_with_steak/Rakefile +7 -0
  69. data/spec/fixtures/rails_project_with_steak/app/assets/images/rails.png +0 -0
  70. data/spec/fixtures/rails_project_with_steak/app/assets/javascripts/application.js +9 -0
  71. data/spec/fixtures/rails_project_with_steak/app/assets/stylesheets/application.css +7 -0
  72. data/spec/fixtures/rails_project_with_steak/app/controllers/application_controller.rb +3 -0
  73. data/spec/fixtures/rails_project_with_steak/app/helpers/application_helper.rb +2 -0
  74. data/spec/fixtures/rails_project_with_steak/app/mailers/.gitkeep +0 -0
  75. data/spec/fixtures/rails_project_with_steak/app/models/.gitkeep +0 -0
  76. data/spec/fixtures/rails_project_with_steak/app/views/layouts/application.html.erb +14 -0
  77. data/spec/fixtures/rails_project_with_steak/config.ru +4 -0
  78. data/spec/fixtures/rails_project_with_steak/config/application.rb +49 -0
  79. data/spec/fixtures/rails_project_with_steak/config/boot.rb +6 -0
  80. data/spec/fixtures/rails_project_with_steak/config/database.yml +48 -0
  81. data/spec/fixtures/rails_project_with_steak/config/environment.rb +5 -0
  82. data/spec/fixtures/rails_project_with_steak/config/environments/development.rb +24 -0
  83. data/spec/fixtures/rails_project_with_steak/config/environments/production.rb +52 -0
  84. data/spec/fixtures/rails_project_with_steak/config/environments/test.rb +39 -0
  85. data/spec/fixtures/rails_project_with_steak/config/initializers/backtrace_silencers.rb +7 -0
  86. data/spec/fixtures/rails_project_with_steak/config/initializers/inflections.rb +10 -0
  87. data/spec/fixtures/rails_project_with_steak/config/initializers/mime_types.rb +5 -0
  88. data/spec/fixtures/rails_project_with_steak/config/initializers/secret_token.rb +7 -0
  89. data/spec/fixtures/rails_project_with_steak/config/initializers/session_store.rb +8 -0
  90. data/spec/fixtures/rails_project_with_steak/config/initializers/wrap_parameters.rb +12 -0
  91. data/spec/fixtures/rails_project_with_steak/config/locales/en.yml +5 -0
  92. data/spec/fixtures/rails_project_with_steak/config/routes.rb +58 -0
  93. data/spec/fixtures/rails_project_with_steak/db/schema.rb +15 -0
  94. data/spec/fixtures/rails_project_with_steak/db/seeds.rb +7 -0
  95. data/spec/fixtures/rails_project_with_steak/doc/README_FOR_APP +2 -0
  96. data/spec/fixtures/rails_project_with_steak/lib/tasks/.gitkeep +0 -0
  97. data/spec/fixtures/rails_project_with_steak/log/.gitkeep +0 -0
  98. data/spec/fixtures/rails_project_with_steak/public/404.html +26 -0
  99. data/spec/fixtures/rails_project_with_steak/public/422.html +26 -0
  100. data/spec/fixtures/rails_project_with_steak/public/500.html +26 -0
  101. data/spec/fixtures/rails_project_with_steak/public/favicon.ico +0 -0
  102. data/spec/fixtures/rails_project_with_steak/public/index.html +241 -0
  103. data/spec/fixtures/rails_project_with_steak/public/robots.txt +5 -0
  104. data/spec/fixtures/rails_project_with_steak/script/rails +6 -0
  105. data/spec/fixtures/rails_project_with_steak/spec/acceptance/acceptance_helper.rb +4 -0
  106. data/spec/fixtures/rails_project_with_steak/spec/acceptance/support/.gitignore +0 -0
  107. data/spec/fixtures/rails_project_with_steak/spec/acceptance/support/helpers.rb +6 -0
  108. data/{generators/steak/templates → spec/fixtures/rails_project_with_steak/spec/acceptance/support}/paths.rb +1 -1
  109. data/spec/fixtures/rails_project_with_steak/spec/spec_helper.rb +27 -0
  110. data/spec/fixtures/rails_project_with_steak/test/fixtures/.gitkeep +0 -0
  111. data/spec/fixtures/rails_project_with_steak/test/functional/.gitkeep +0 -0
  112. data/spec/fixtures/rails_project_with_steak/test/integration/.gitkeep +0 -0
  113. data/spec/fixtures/rails_project_with_steak/test/performance/browsing_test.rb +12 -0
  114. data/spec/fixtures/rails_project_with_steak/test/test_helper.rb +13 -0
  115. data/spec/fixtures/rails_project_with_steak/test/unit/.gitkeep +0 -0
  116. data/spec/fixtures/rails_project_with_steak/vendor/assets/stylesheets/.gitkeep +0 -0
  117. data/spec/fixtures/rails_project_with_steak/vendor/plugins/.gitkeep +0 -0
  118. data/spec/support/helpers.rb +73 -0
  119. data/spec/support/refresh_fixtures_task.rb +30 -0
  120. metadata +255 -117
  121. data/README.rdoc +0 -193
  122. data/Rakefile +0 -23
  123. data/generators/acceptance_spec/USAGE +0 -1
  124. data/generators/acceptance_spec/acceptance_spec_generator.rb +0 -9
  125. data/generators/acceptance_spec/templates/acceptance_spec.rb +0 -12
  126. data/generators/steak/USAGE +0 -8
  127. data/generators/steak/steak_generator.rb +0 -26
  128. data/generators/steak/templates/acceptance_helper.rb +0 -18
  129. data/generators/steak/templates/helpers.rb +0 -5
  130. data/generators/steak/templates/steak.rake +0 -44
  131. data/lib/rspec-1/steak.rb +0 -17
  132. data/lib/rspec-2/rails/generators/install_generator.rb +0 -31
  133. data/lib/rspec-2/rails/generators/spec_generator.rb +0 -36
  134. data/lib/rspec-2/rails/generators/templates/acceptance_helper.rb +0 -5
  135. data/lib/rspec-2/rails/generators/templates/acceptance_spec.rb +0 -12
  136. data/lib/rspec-2/rails/generators/templates/helpers.rb +0 -5
  137. data/lib/rspec-2/rails/railtie.rb +0 -14
  138. data/lib/rspec-2/rails/tasks/steak.rake +0 -14
  139. data/lib/rspec-2/steak.rb +0 -31
  140. data/spec/acceptance/rspec-1/acceptance_helper.rb +0 -98
  141. data/spec/acceptance/rspec-1/acceptance_spec_generator_spec.rb +0 -44
  142. data/spec/acceptance/rspec-1/basic_spec.rb +0 -76
  143. data/spec/acceptance/rspec-1/rails_spec.rb +0 -39
  144. data/spec/acceptance/rspec-1/steak_generator_spec.rb +0 -96
  145. data/spec/acceptance/rspec-2/acceptance_helper.rb +0 -81
  146. data/spec/acceptance/rspec-2/basic_spec.rb +0 -121
  147. data/spec/acceptance/rspec-2/rails_spec.rb +0 -88
  148. data/spec/acceptance/rspec-2/steak_install_generator_spec.rb +0 -62
  149. data/spec/acceptance/rspec-2/steak_spec_generator_spec.rb +0 -77
@@ -1,193 +0,0 @@
1
- = Steak
2
-
3
- Minimalist acceptance testing on top of RSpec
4
-
5
- http://dl.dropbox.com/u/645329/steak_small.jpg
6
-
7
- == What is Steak?
8
-
9
- Steak is an Acceptance BDD solution (like Cucumber) but in plain Ruby. This
10
- is how an acceptance spec looks like in Steak:
11
-
12
- feature "Main page" do
13
-
14
- background do
15
- create_user :login => "jdoe"
16
- login_as "jdoe"
17
- end
18
-
19
- scenario "should show existing quotes" do
20
- create_quote :text => "The language of friendship is not words, but meanings",
21
- :author => "Henry David Thoreau"
22
-
23
- visit "/"
24
-
25
- page.should have_css(".quote", :count => 1)
26
- within(:css, ".quote") do
27
- page.should have_css(".text", :text => "The language of friendship is not words, but meanings")
28
- page.should have_css(".author", :text => "Henry David Thoreau")
29
- end
30
- end
31
-
32
- end
33
-
34
- No explicit givens, whens or thens. No steps, no english, just Ruby: RSpec,
35
- Steak and, in this example, some factories and Capybara. That's all.
36
-
37
- If you are not in Rails but use RSpec, then Steak is just some aliases
38
- providing you with the language of acceptance testing (+feature+, +scenario+,
39
- +background+). If you are in Rails, you also have a couple of generators, a
40
- rake task and full Rails integration testing (meaning Webrat support, for
41
- instance)
42
-
43
- == Getting started
44
-
45
- === Not in Rails
46
-
47
- Just install and require the damned gem!
48
-
49
- $ gem install steak
50
-
51
- Then in your spec or spec helper:
52
-
53
- require 'steak'
54
-
55
- That's all. You don't really need to require RSpec.
56
-
57
- === In Rails 3
58
-
59
- Add this to your project's <tt>Gemfile</tt>:
60
-
61
- group :development, :test do
62
- gem 'rspec-rails'
63
- gem 'steak'
64
- gem 'capybara'
65
-
66
- # Other usual suspects:
67
- # gem 'delorean'
68
- # gem 'database_cleaner'
69
- # gem 'spork'
70
- end
71
-
72
- And install:
73
-
74
- $ bundle install
75
-
76
- Run the generators:
77
-
78
- $ rails g rspec:install
79
- $ rails g steak:install
80
-
81
- That will create some basic helper files and directory structure under the
82
- <tt>spec/acceptance</tt> directory, already configured for +Capybara+.
83
-
84
- Spend one minute on getting familiar with the structure and files you've got.
85
-
86
- Now you may want to create your first acceptance spec:
87
-
88
- $ rails generate steak:spec this_is_my_first_feature
89
-
90
- You run your acceptance specs just like your regular specs. Individually...
91
-
92
- $ rspec spec/acceptance/this_is_my_first_feature_spec.rb
93
-
94
- ...or all together:
95
-
96
- $ rspec spec/acceptance
97
-
98
- ...you can also do:
99
-
100
- $ rake spec:acceptance
101
-
102
- === In Rails 2.x
103
-
104
- You need to setup rspec-rails before installing Steak. Make sure you use rspec(-rails) 1.x versions and not 2.x which don't work with Rails 2.3. You may want to use bundler and/or rvm to make sure the right versions of the gems are used.
105
-
106
- Assuming you have already setup rspec-rails 1.x, add this to your project's
107
- <tt>config/environments/test.rb</tt>:
108
-
109
- config.gem "steak", :lib => false
110
-
111
- Install the gem from the command line:
112
-
113
- $ RAILS_ENV=test rake gems:install
114
-
115
- Run the generator:
116
-
117
- $ script/generate steak
118
-
119
- That will create some basic helper files and directory structure under the
120
- <tt>spec/acceptance</tt> directory, already configured for +Capybara+. If you want to
121
- use +Webrat+, just pass it to the generator:
122
-
123
- $ script/generate steak --webrat
124
-
125
- Spend one minute on getting familiar with the structure and files you've got.
126
-
127
- Now you may want to create your first acceptance spec:
128
-
129
- $ script/generate acceptance_spec this_is_my_first_feature
130
-
131
- You run your acceptance specs just like your regular specs. Individually...
132
-
133
- $ spec spec/acceptance/this_is_my_first_feature_spec.rb
134
-
135
- ...or all together:
136
-
137
- $ spec spec/acceptance
138
-
139
- ...you can also do:
140
-
141
- $ rake spec:acceptance
142
-
143
- == RSpec & Metadata
144
-
145
- Steak scenarios are just regular RSpec examples with their metadata attribute
146
- <tt>:type</tt> set to <tt>:acceptance</tt>. That's useful if you want to make sure you
147
- include helpers or set hooks only for your acceptance specs and not for the
148
- rest of the specs in your suite.
149
-
150
- You'd do it this way:
151
-
152
- RSpec.configure do |config|
153
- # include MyHelpers module in every acceptance spec
154
- config.include MyHelpers, :type => :acceptance
155
-
156
- config.before(:each, :type => :acceptance) do
157
- # Some code to run before any acceptance spec
158
- end
159
- end
160
-
161
- == Resources
162
-
163
- - Source: http://github.com/cavalle/steak
164
- - Issues: http://github.com/cavalle/steak/issues
165
- - Group: http://groups.google.com/group/steakrb
166
- - IRC channel: #steakrb on freenode
167
- - Twitter: http://twitter.com/steakrb
168
- - Tutorial: http://jeffkreeftmeijer.com/2010/steak-because-cucumber-is-for-vegetarians/
169
- - Hashtag: #steakrb
170
- - More resources: http://wiki.github.com/cavalle/steak/resources
171
-
172
- == Credits
173
-
174
- Steak was created by Luismi Cavallé and improved thanks to the love from:
175
-
176
- - Álvaro Bautista
177
- - Felipe Talavera
178
- - Paco Guzmán
179
- - Jeff Kreeftmeijer
180
- - Jaime Iniesta
181
- - Emili Parreño
182
- - Andreas Wolff
183
- - Wincent Colaiuta
184
- - Falk Pauser
185
- - Francesc Esplugas
186
- - Raúl Murciano
187
- - Enable Interactive
188
- - Vojto Rinik
189
- - Fred Wu
190
- - Sergio Espeja
191
- - Joao Carlos
192
-
193
- Copyright (c) 2009, 2010 Luismi Cavallé, released under the MIT license
data/Rakefile DELETED
@@ -1,23 +0,0 @@
1
- require 'rake'
2
- require 'rake/rdoctask'
3
- require 'rspec/core'
4
- require 'rspec/core/rake_task'
5
-
6
- desc 'Default: run specs.'
7
- task :default => :spec
8
-
9
- desc 'Run specs for the steak plugin.'
10
- RSpec::Core::RakeTask.new(:spec) do |t|
11
- t.skip_bundler = true
12
- t.pattern = FileList["spec/**/*_spec.rb"]
13
- end
14
-
15
- desc 'Generate documentation for the steak plugin.'
16
- Rake::RDocTask.new(:rdoc) do |rdoc|
17
- rdoc.rdoc_dir = 'rdoc'
18
- rdoc.title = 'Steak'
19
- rdoc.options << '--line-numbers' << '--inline-source'
20
- rdoc.options << '--charset' << 'utf-8'
21
- rdoc.rdoc_files.include('README.rdoc')
22
- rdoc.rdoc_files.include('lib/**/*.rb')
23
- end
@@ -1 +0,0 @@
1
- s
@@ -1,9 +0,0 @@
1
- class AcceptanceSpecGenerator < Rails::Generator::NamedBase
2
- def manifest
3
- record do |m|
4
- m.directory File.join('spec/acceptance', class_path)
5
- file_name.gsub!(/_spec$/,"")
6
- m.template 'acceptance_spec.rb', File.join('spec/acceptance', class_path, "#{file_name}_spec.rb")
7
- end
8
- end
9
- end
@@ -1,12 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/acceptance_helper')
2
-
3
- feature "Feature name", %q{
4
- In order to ...
5
- As a ...
6
- I want to ...
7
- } do
8
-
9
- scenario "Scenario name" do
10
- true.should == true
11
- end
12
- end
@@ -1,8 +0,0 @@
1
- Description:
2
- Sets up Steak in your Rails project. This will generate the spec/acceptance directory
3
- and the necessary files.
4
-
5
- If you haven't already, You should also run `./script/generate rspec` to complete the set up.
6
-
7
- Examples:
8
- `./script/generate steak`
@@ -1,26 +0,0 @@
1
- class SteakGenerator < Rails::Generator::Base
2
- default_options :driver => 'capybara'
3
-
4
- def initialize(runtime_args, runtime_options = {})
5
- puts "Defaulting to Capybara..." if runtime_args.empty?
6
- super
7
- end
8
-
9
- def manifest
10
- record do |m|
11
- m.directory 'spec/acceptance/support'
12
- m.directory 'lib/tasks'
13
- m.template "acceptance_helper.rb", "spec/acceptance/acceptance_helper.rb"
14
- m.file "helpers.rb", "spec/acceptance/support/helpers.rb"
15
- m.file "paths.rb", "spec/acceptance/support/paths.rb"
16
- m.file "steak.rake", "lib/tasks/steak.rake"
17
- end
18
- end
19
-
20
- def add_options!(opt)
21
- opt.separator ''
22
- opt.separator 'Options:'
23
- opt.on('--capybara', 'Use Capybara (default).') { |v| options[:driver] = 'capybara' }
24
- opt.on('--webrat', 'Use Webrat.') { |v| options[:driver] = 'webrat' }
25
- end
26
- end
@@ -1,18 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
2
- require "steak"
3
- <%- if options[:driver] == 'webrat' %>
4
- require "webrat"
5
-
6
- Webrat.configure do |config|
7
- config.mode = :rails
8
- end
9
- <%- else -%>
10
- require 'capybara/rails'
11
-
12
- Spec::Runner.configure do |config|
13
- config.include Capybara
14
- end
15
- <%- end -%>
16
-
17
- # Put your acceptance spec helpers inside /spec/acceptance/support
18
- Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
@@ -1,5 +0,0 @@
1
- module HelperMethods
2
- # Put helper methods you need to be available in all tests here.
3
- end
4
-
5
- Spec::Runner.configuration.include(HelperMethods)
@@ -1,44 +0,0 @@
1
- unless ARGV.any? {|a| a =~ /^gems/} # Don't load anything when running the gems:* tasks
2
-
3
- begin
4
- require 'spec/rake/spectask'
5
- rescue MissingSourceFile
6
- module Spec
7
- module Rake
8
- class SpecTask
9
- def initialize(name)
10
- task name do
11
- # if rspec-rails is a configured gem, this will output helpful material and exit ...
12
- require File.expand_path(File.join(File.dirname(__FILE__),"..","..","config","environment"))
13
-
14
- # ... otherwise, do this:
15
- raise <<-MSG
16
-
17
- #{"*" * 80}
18
- * You are trying to run an rspec rake task defined in
19
- * #{__FILE__},
20
- * but rspec can not be found in vendor/gems, vendor/plugins or system gems.
21
- #{"*" * 80}
22
- MSG
23
- end
24
- end
25
- end
26
- end
27
- end
28
- end
29
-
30
- namespace :spec do
31
- desc "Run the code examples in spec/acceptance"
32
- Spec::Rake::SpecTask.new(:acceptance => "db:test:prepare") do |t|
33
- t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
34
- t.spec_files = FileList["spec/acceptance/**/*_spec.rb"]
35
- end
36
-
37
- # Setup stats to include acceptance specs
38
- task :statsetup do
39
- require 'code_statistics'
40
- ::STATS_DIRECTORIES << %w(Acceptance\ specs spec/acceptance) if File.exist?('spec/acceptance')
41
- ::CodeStatistics::TEST_TYPES << "Acceptance specs" if File.exist?('spec/acceptance')
42
- end
43
- end
44
- end
@@ -1,17 +0,0 @@
1
- module Spec::Example::ExampleGroupMethods
2
- alias scenario example
3
- alias background before
4
- end
5
-
6
- class << self
7
- alias feature describe
8
- end
9
-
10
- if defined?(Spec::Rails)
11
- module Spec::Rails::Example
12
- class AcceptanceExampleGroup < IntegrationExampleGroup
13
- include ActionController::RecordIdentifier
14
- Spec::Example::ExampleGroupFactory.register(:acceptance, self)
15
- end
16
- end
17
- end
@@ -1,31 +0,0 @@
1
- require 'rails/generators'
2
-
3
- module Steak
4
- class InstallGenerator < Rails::Generators::Base
5
- source_root File.join(File.dirname(__FILE__), 'templates')
6
-
7
- desc <<-DESC
8
- Description:
9
- Sets up Steak in your Rails project. This will generate the
10
- spec/acceptance directory and the necessary files.
11
-
12
- If you haven't already, You should also run
13
- `rails generate rspec:install` to complete the set up.
14
-
15
- Examples:
16
- `rails generate steak:install`
17
- DESC
18
-
19
- def initialize(args=[], options={}, config={})
20
- puts "Defaulting to Capybara..." if options.empty?
21
- super
22
- end
23
-
24
- def manifest
25
- empty_directory 'spec/acceptance/support'
26
- template "acceptance_helper.rb", "spec/acceptance/acceptance_helper.rb"
27
- copy_file "helpers.rb", "spec/acceptance/support/helpers.rb"
28
- copy_file "paths.rb", "spec/acceptance/support/paths.rb"
29
- end
30
- end
31
- end
@@ -1,36 +0,0 @@
1
- require 'rails/generators'
2
- require 'active_support/inflector/inflections'
3
-
4
- module Steak
5
- class SpecGenerator < Rails::Generators::NamedBase
6
- source_root File.join(File.dirname(__FILE__), 'templates')
7
-
8
- desc <<-DESC
9
- Description:
10
- Create an acceptance spec for the feature NAME in the
11
- 'spec/acceptance' folder.
12
-
13
- Example:
14
- `rails generate steak:spec checkout`
15
-
16
- Creates an acceptance spec for the "checkout" feature:
17
- spec/acceptance/checkout_spec.rb
18
- DESC
19
-
20
- def manifest
21
- if behavior == :invoke
22
- empty_directory File.join('spec/acceptance', class_path)
23
- end
24
-
25
- file_name.gsub!(/_spec$/, "")
26
-
27
- @feature_name = file_name.titleize
28
- @relative_path = "../" * class_path.size
29
-
30
- target = File.join('spec/acceptance', class_path,
31
- "#{file_name}_spec.rb")
32
-
33
- template 'acceptance_spec.rb', target
34
- end
35
- end
36
- end
@@ -1,5 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
2
- require "steak"
3
-
4
- # Put your acceptance spec helpers inside /spec/acceptance/support
5
- Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}