steak 1.1.0 → 2.0.0.beta1
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.
- data/{MIT-LICENSE → LICENSE} +1 -1
- data/README.md +110 -0
- data/lib/generators/steak/install_generator.rb +12 -0
- data/lib/generators/steak/spec_generator.rb +11 -0
- data/lib/generators/steak/templates/acceptance_spec.rb +13 -0
- data/lib/generators/steak/templates/spec/acceptance/acceptance_helper.rb +4 -0
- data/lib/generators/steak/templates/spec/acceptance/support/helpers.rb +6 -0
- data/lib/{rspec-2/rails/generators/templates → generators/steak/templates/spec/acceptance/support}/paths.rb +1 -1
- data/lib/steak.rb +4 -10
- data/lib/steak/acceptance_example_group.rb +12 -0
- data/lib/steak/railtie.rb +7 -0
- data/lib/steak/version.rb +3 -0
- data/lib/tasks/steak_tasks.rake +14 -0
- data/spec/acceptance/creating_specs_spec.rb +75 -0
- data/spec/acceptance/getting_started_spec.rb +33 -0
- data/spec/acceptance/rake_support_spec.rb +40 -0
- data/spec/fixtures/rails_project/.gitignore +5 -0
- data/spec/fixtures/rails_project/Gemfile +55 -0
- data/spec/fixtures/rails_project/README +261 -0
- data/spec/fixtures/rails_project/Rakefile +7 -0
- data/spec/fixtures/rails_project/app/assets/images/rails.png +0 -0
- data/spec/fixtures/rails_project/app/assets/javascripts/application.js +9 -0
- data/spec/fixtures/rails_project/app/assets/stylesheets/application.css +7 -0
- data/spec/fixtures/rails_project/app/controllers/application_controller.rb +3 -0
- data/spec/fixtures/rails_project/app/helpers/application_helper.rb +2 -0
- data/spec/fixtures/rails_project/app/mailers/.gitkeep +0 -0
- data/spec/fixtures/rails_project/app/models/.gitkeep +0 -0
- data/spec/fixtures/rails_project/app/views/layouts/application.html.erb +14 -0
- data/spec/fixtures/rails_project/config.ru +4 -0
- data/spec/fixtures/rails_project/config/application.rb +49 -0
- data/spec/fixtures/rails_project/config/boot.rb +6 -0
- data/spec/fixtures/rails_project/config/database.yml +48 -0
- data/spec/fixtures/rails_project/config/environment.rb +5 -0
- data/spec/fixtures/rails_project/config/environments/development.rb +24 -0
- data/spec/fixtures/rails_project/config/environments/production.rb +52 -0
- data/spec/fixtures/rails_project/config/environments/test.rb +39 -0
- data/spec/fixtures/rails_project/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/fixtures/rails_project/config/initializers/inflections.rb +10 -0
- data/spec/fixtures/rails_project/config/initializers/mime_types.rb +5 -0
- data/spec/fixtures/rails_project/config/initializers/secret_token.rb +7 -0
- data/spec/fixtures/rails_project/config/initializers/session_store.rb +8 -0
- data/spec/fixtures/rails_project/config/initializers/wrap_parameters.rb +12 -0
- data/spec/fixtures/rails_project/config/locales/en.yml +5 -0
- data/spec/fixtures/rails_project/config/routes.rb +58 -0
- data/spec/fixtures/rails_project/db/seeds.rb +7 -0
- data/spec/fixtures/rails_project/doc/README_FOR_APP +2 -0
- data/spec/fixtures/rails_project/lib/tasks/.gitkeep +0 -0
- data/spec/fixtures/rails_project/log/.gitkeep +0 -0
- data/spec/fixtures/rails_project/public/404.html +26 -0
- data/spec/fixtures/rails_project/public/422.html +26 -0
- data/spec/fixtures/rails_project/public/500.html +26 -0
- data/spec/fixtures/rails_project/public/favicon.ico +0 -0
- data/spec/fixtures/rails_project/public/index.html +241 -0
- data/spec/fixtures/rails_project/public/robots.txt +5 -0
- data/spec/fixtures/rails_project/script/rails +6 -0
- data/spec/fixtures/rails_project/test/fixtures/.gitkeep +0 -0
- data/spec/fixtures/rails_project/test/functional/.gitkeep +0 -0
- data/spec/fixtures/rails_project/test/integration/.gitkeep +0 -0
- data/spec/fixtures/rails_project/test/performance/browsing_test.rb +12 -0
- data/spec/fixtures/rails_project/test/test_helper.rb +13 -0
- data/spec/fixtures/rails_project/test/unit/.gitkeep +0 -0
- data/spec/fixtures/rails_project/vendor/assets/stylesheets/.gitkeep +0 -0
- data/spec/fixtures/rails_project/vendor/plugins/.gitkeep +0 -0
- data/spec/fixtures/rails_project_with_steak/.gitignore +5 -0
- data/spec/fixtures/rails_project_with_steak/.rspec +1 -0
- data/spec/fixtures/rails_project_with_steak/Gemfile +58 -0
- data/spec/fixtures/rails_project_with_steak/README +261 -0
- data/spec/fixtures/rails_project_with_steak/Rakefile +7 -0
- data/spec/fixtures/rails_project_with_steak/app/assets/images/rails.png +0 -0
- data/spec/fixtures/rails_project_with_steak/app/assets/javascripts/application.js +9 -0
- data/spec/fixtures/rails_project_with_steak/app/assets/stylesheets/application.css +7 -0
- data/spec/fixtures/rails_project_with_steak/app/controllers/application_controller.rb +3 -0
- data/spec/fixtures/rails_project_with_steak/app/helpers/application_helper.rb +2 -0
- data/spec/fixtures/rails_project_with_steak/app/mailers/.gitkeep +0 -0
- data/spec/fixtures/rails_project_with_steak/app/models/.gitkeep +0 -0
- data/spec/fixtures/rails_project_with_steak/app/views/layouts/application.html.erb +14 -0
- data/spec/fixtures/rails_project_with_steak/config.ru +4 -0
- data/spec/fixtures/rails_project_with_steak/config/application.rb +49 -0
- data/spec/fixtures/rails_project_with_steak/config/boot.rb +6 -0
- data/spec/fixtures/rails_project_with_steak/config/database.yml +48 -0
- data/spec/fixtures/rails_project_with_steak/config/environment.rb +5 -0
- data/spec/fixtures/rails_project_with_steak/config/environments/development.rb +24 -0
- data/spec/fixtures/rails_project_with_steak/config/environments/production.rb +52 -0
- data/spec/fixtures/rails_project_with_steak/config/environments/test.rb +39 -0
- data/spec/fixtures/rails_project_with_steak/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/fixtures/rails_project_with_steak/config/initializers/inflections.rb +10 -0
- data/spec/fixtures/rails_project_with_steak/config/initializers/mime_types.rb +5 -0
- data/spec/fixtures/rails_project_with_steak/config/initializers/secret_token.rb +7 -0
- data/spec/fixtures/rails_project_with_steak/config/initializers/session_store.rb +8 -0
- data/spec/fixtures/rails_project_with_steak/config/initializers/wrap_parameters.rb +12 -0
- data/spec/fixtures/rails_project_with_steak/config/locales/en.yml +5 -0
- data/spec/fixtures/rails_project_with_steak/config/routes.rb +58 -0
- data/spec/fixtures/rails_project_with_steak/db/schema.rb +15 -0
- data/spec/fixtures/rails_project_with_steak/db/seeds.rb +7 -0
- data/spec/fixtures/rails_project_with_steak/doc/README_FOR_APP +2 -0
- data/spec/fixtures/rails_project_with_steak/lib/tasks/.gitkeep +0 -0
- data/spec/fixtures/rails_project_with_steak/log/.gitkeep +0 -0
- data/spec/fixtures/rails_project_with_steak/public/404.html +26 -0
- data/spec/fixtures/rails_project_with_steak/public/422.html +26 -0
- data/spec/fixtures/rails_project_with_steak/public/500.html +26 -0
- data/spec/fixtures/rails_project_with_steak/public/favicon.ico +0 -0
- data/spec/fixtures/rails_project_with_steak/public/index.html +241 -0
- data/spec/fixtures/rails_project_with_steak/public/robots.txt +5 -0
- data/spec/fixtures/rails_project_with_steak/script/rails +6 -0
- data/spec/fixtures/rails_project_with_steak/spec/acceptance/acceptance_helper.rb +4 -0
- data/spec/fixtures/rails_project_with_steak/spec/acceptance/support/.gitignore +0 -0
- data/spec/fixtures/rails_project_with_steak/spec/acceptance/support/helpers.rb +6 -0
- data/{generators/steak/templates → spec/fixtures/rails_project_with_steak/spec/acceptance/support}/paths.rb +1 -1
- data/spec/fixtures/rails_project_with_steak/spec/spec_helper.rb +27 -0
- data/spec/fixtures/rails_project_with_steak/test/fixtures/.gitkeep +0 -0
- data/spec/fixtures/rails_project_with_steak/test/functional/.gitkeep +0 -0
- data/spec/fixtures/rails_project_with_steak/test/integration/.gitkeep +0 -0
- data/spec/fixtures/rails_project_with_steak/test/performance/browsing_test.rb +12 -0
- data/spec/fixtures/rails_project_with_steak/test/test_helper.rb +13 -0
- data/spec/fixtures/rails_project_with_steak/test/unit/.gitkeep +0 -0
- data/spec/fixtures/rails_project_with_steak/vendor/assets/stylesheets/.gitkeep +0 -0
- data/spec/fixtures/rails_project_with_steak/vendor/plugins/.gitkeep +0 -0
- data/spec/support/helpers.rb +73 -0
- data/spec/support/refresh_fixtures_task.rb +30 -0
- metadata +255 -117
- data/README.rdoc +0 -193
- data/Rakefile +0 -23
- data/generators/acceptance_spec/USAGE +0 -1
- data/generators/acceptance_spec/acceptance_spec_generator.rb +0 -9
- data/generators/acceptance_spec/templates/acceptance_spec.rb +0 -12
- data/generators/steak/USAGE +0 -8
- data/generators/steak/steak_generator.rb +0 -26
- data/generators/steak/templates/acceptance_helper.rb +0 -18
- data/generators/steak/templates/helpers.rb +0 -5
- data/generators/steak/templates/steak.rake +0 -44
- data/lib/rspec-1/steak.rb +0 -17
- data/lib/rspec-2/rails/generators/install_generator.rb +0 -31
- data/lib/rspec-2/rails/generators/spec_generator.rb +0 -36
- data/lib/rspec-2/rails/generators/templates/acceptance_helper.rb +0 -5
- data/lib/rspec-2/rails/generators/templates/acceptance_spec.rb +0 -12
- data/lib/rspec-2/rails/generators/templates/helpers.rb +0 -5
- data/lib/rspec-2/rails/railtie.rb +0 -14
- data/lib/rspec-2/rails/tasks/steak.rake +0 -14
- data/lib/rspec-2/steak.rb +0 -31
- data/spec/acceptance/rspec-1/acceptance_helper.rb +0 -98
- data/spec/acceptance/rspec-1/acceptance_spec_generator_spec.rb +0 -44
- data/spec/acceptance/rspec-1/basic_spec.rb +0 -76
- data/spec/acceptance/rspec-1/rails_spec.rb +0 -39
- data/spec/acceptance/rspec-1/steak_generator_spec.rb +0 -96
- data/spec/acceptance/rspec-2/acceptance_helper.rb +0 -81
- data/spec/acceptance/rspec-2/basic_spec.rb +0 -121
- data/spec/acceptance/rspec-2/rails_spec.rb +0 -88
- data/spec/acceptance/rspec-2/steak_install_generator_spec.rb +0 -62
- data/spec/acceptance/rspec-2/steak_spec_generator_spec.rb +0 -77
data/README.rdoc
DELETED
|
@@ -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
|
data/generators/steak/USAGE
DELETED
|
@@ -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,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
|
data/lib/rspec-1/steak.rb
DELETED
|
@@ -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
|