steak 0.4.0.a4 → 0.4.0.a5
Sign up to get free protection for your applications and to get access to all the features.
- data/MIT-LICENSE +20 -0
- data/README.rdoc +51 -5
- data/Rakefile +22 -0
- data/init.rb +8 -0
- data/lib/generators/steak/templates/steak.rake +7 -1
- data/lib/steak.rb +2 -21
- data/spec/acceptance/steak_generator_spec.rb +33 -0
- metadata +31 -20
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2009 Luismi Cavallé
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
CHANGED
@@ -36,8 +36,6 @@ If you are not in Rails but use RSpec, then Steak is just some aliases providing
|
|
36
36
|
|
37
37
|
== Getting started
|
38
38
|
|
39
|
-
<em><b>NOTE:</b> Please note that the stable version of Steak only works with Rails 2.x and RSpec 1.x. If you want to try with Rails 3 or RSpec 2, then you can install the prerelease version of Steak (using <tt>gem install steak --pre</tt>) which is based on the experimental <tt>rails3</tt> branch.</em>
|
40
|
-
|
41
39
|
=== Not in Rails
|
42
40
|
|
43
41
|
Just install and require the damned gem!
|
@@ -49,12 +47,48 @@ Then in your spec or spec helper:
|
|
49
47
|
require 'steak'
|
50
48
|
|
51
49
|
That's all. You don't really need to require RSpec.
|
50
|
+
|
51
|
+
=== In Rails 2.x (stable branch)
|
52
|
+
|
53
|
+
Assuming you have already setup rspec-rails, add this to your project's <tt>config/environments/test.rb</tt>:
|
54
|
+
|
55
|
+
config.gem "steak"
|
56
|
+
|
57
|
+
Install the gem from the command line:
|
58
|
+
|
59
|
+
$ RAILS_ENV=test rake gems:install
|
60
|
+
|
61
|
+
Run the generator:
|
62
|
+
|
63
|
+
$ script/generate steak
|
64
|
+
|
65
|
+
That will create some basic helper files and directory structure under the +spec/acceptance+ directory, already configured for +Capybara+. If you want to use +Webrat+, just pass it to the generator:
|
66
|
+
|
67
|
+
$ script/generate steak --webrat
|
68
|
+
|
69
|
+
Spend one minute on getting familiar with the structure and files you've got.
|
70
|
+
|
71
|
+
Now you may want to create your first acceptance spec:
|
72
|
+
|
73
|
+
$ script/generate acceptance_spec this_is_my_first_feature
|
52
74
|
|
53
|
-
|
75
|
+
You run your acceptance specs just like your regular specs. Individually...
|
54
76
|
|
55
|
-
|
77
|
+
$ spec spec/acceptance/this_is_my_first_feature_spec.rb
|
78
|
+
|
79
|
+
...or all together:
|
56
80
|
|
57
|
-
|
81
|
+
$ spec spec/acceptance
|
82
|
+
|
83
|
+
...you can also do:
|
84
|
+
|
85
|
+
$ rake spec:acceptance
|
86
|
+
|
87
|
+
=== In Rails 3 (master branch)
|
88
|
+
|
89
|
+
Add this to your project's <tt>Gemfile</tt>:
|
90
|
+
|
91
|
+
gem 'steak', '>= 0.4.0.a5'
|
58
92
|
|
59
93
|
And install it:
|
60
94
|
|
@@ -86,6 +120,15 @@ You run your acceptance specs just like your regular specs. Individually...
|
|
86
120
|
|
87
121
|
$ rake spec:acceptance
|
88
122
|
|
123
|
+
== Resources
|
124
|
+
|
125
|
+
* Source: http://github.com/cavalle/steak
|
126
|
+
* Issues: http://github.com/cavalle/steak/issues
|
127
|
+
* Hashtag: #steakrb
|
128
|
+
* Group: http://groups.google.com/group/steakrb
|
129
|
+
* IRC channel: #steakrb on freenode
|
130
|
+
* Tutorial: http://jeffkreeftmeijer.com/2010/steak-because-cucumber-is-for-vegetarians/
|
131
|
+
|
89
132
|
== Credits
|
90
133
|
|
91
134
|
Steak was created by Luismi Cavallé and improved thanks to the love from:
|
@@ -94,5 +137,8 @@ Steak was created by Luismi Cavallé and improved thanks to the love from:
|
|
94
137
|
- Felipe Talavera
|
95
138
|
- Paco Guzmán
|
96
139
|
- Jeff Kreeftmeijer
|
140
|
+
- Jaime Iniesta
|
141
|
+
- Emili Parreño
|
142
|
+
- Andreas Wolff
|
97
143
|
|
98
144
|
Copyright (c) 2009, 2010 Luismi Cavallé, released under the MIT license
|
data/Rakefile
ADDED
@@ -0,0 +1,22 @@
|
|
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.pattern = FileList["spec/**/*_spec.rb"]
|
12
|
+
end
|
13
|
+
|
14
|
+
desc 'Generate documentation for the steak plugin.'
|
15
|
+
Rake::RDocTask.new(:rdoc) do |rdoc|
|
16
|
+
rdoc.rdoc_dir = 'rdoc'
|
17
|
+
rdoc.title = 'Steak'
|
18
|
+
rdoc.options << '--line-numbers' << '--inline-source'
|
19
|
+
rdoc.options << '--charset' << 'utf-8'
|
20
|
+
rdoc.rdoc_files.include('README.rdoc')
|
21
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
22
|
+
end
|
data/init.rb
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
# Placeholder to satisfy Rails.
|
2
|
+
#
|
3
|
+
# Do NOT add any require statements to this file. Doing
|
4
|
+
# so will cause Rails to load this plugin all of the time.
|
5
|
+
#
|
6
|
+
# spec/acceptance/acceptance_helper.rb should include the necessary
|
7
|
+
# require statements and configuration. This file should
|
8
|
+
# be required by all of your acceptance specs.
|
@@ -1,8 +1,14 @@
|
|
1
|
-
|
1
|
+
require 'rspec/core/rake_task'
|
2
2
|
|
3
3
|
namespace :spec do
|
4
4
|
desc "Run the code examples in spec/acceptance"
|
5
5
|
Rspec::Core::RakeTask.new(:acceptance => "db:test:prepare") do |t|
|
6
6
|
t.pattern = "spec/acceptance/**/*_spec.rb"
|
7
7
|
end
|
8
|
+
|
9
|
+
task :statsetup do
|
10
|
+
require 'rails/code_statistics'
|
11
|
+
::STATS_DIRECTORIES << %w(Acceptance\ specs spec/acceptance) if File.exist?('spec/acceptance')
|
12
|
+
::CodeStatistics::TEST_TYPES << "Acceptance specs" if File.exist?('spec/acceptance')
|
13
|
+
end
|
8
14
|
end
|
data/lib/steak.rb
CHANGED
@@ -8,25 +8,6 @@ class Rspec::Core::ExampleGroup
|
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
|
-
module Rspec::Core::
|
11
|
+
module Rspec::Core::ObjectExtensions
|
12
12
|
alias feature describe
|
13
|
-
end
|
14
|
-
|
15
|
-
if defined?(Rspec::Rails)
|
16
|
-
|
17
|
-
module Rspec::Rails::Example
|
18
|
-
module AcceptanceExampleGroup
|
19
|
-
def method_missing(sym, *args, &block)
|
20
|
-
return Rspec::Matchers::Be.new(sym, *args) if sym.to_s =~ /^be_/
|
21
|
-
return Rspec::Matchers::Has.new(sym, *args) if sym.to_s =~ /^have_/
|
22
|
-
super
|
23
|
-
end
|
24
|
-
|
25
|
-
Rspec.configure do |c|
|
26
|
-
c.include RequestExampleGroupBehaviour, :example_group => { :file_path => /\bspec\/acceptance\// }
|
27
|
-
c.include self, :example_group => { :file_path => /\bspec\/acceptance\// }
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
end
|
13
|
+
end
|
@@ -63,5 +63,38 @@ feature "Steak generator for rails", %q{
|
|
63
63
|
output = run_spec spec_file, rails_app
|
64
64
|
output.should =~ /1 example, 0 failures/
|
65
65
|
end
|
66
|
+
|
67
|
+
scenario "Running rake stats" do
|
68
|
+
rails_app = create_rails_app
|
69
|
+
|
70
|
+
Dir.chdir rails_app do
|
71
|
+
`rails generate steak`
|
72
|
+
`rake stats`.should =~ /Acceptance specs/
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
scenario "Running specs with rake" do
|
77
|
+
rails_app = create_rails_app(:setup_steak => true)
|
78
|
+
|
79
|
+
spec_file = create_spec :path => rails_app + "/spec/acceptance",
|
80
|
+
:content => <<-SPEC
|
81
|
+
require File.dirname(__FILE__) + "/acceptance_helper.rb"
|
82
|
+
feature "Basic spec" do
|
83
|
+
scenario "First scenario" do
|
84
|
+
true.should == true
|
85
|
+
end
|
86
|
+
end
|
87
|
+
SPEC
|
88
|
+
|
89
|
+
Dir.chdir rails_app do
|
90
|
+
`rake db:create db:migrate db:test:prepare`
|
91
|
+
|
92
|
+
output = `rake spec:acceptance`
|
93
|
+
output.should =~ /1 example, 0 failures/
|
94
|
+
|
95
|
+
output = `rake`
|
96
|
+
output.should =~ /1 example, 0 failures/
|
97
|
+
end
|
98
|
+
end
|
66
99
|
|
67
100
|
end
|
metadata
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: steak
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 6561978
|
4
5
|
prerelease: true
|
5
6
|
segments:
|
6
7
|
- 0
|
7
8
|
- 4
|
8
9
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.4.0.
|
10
|
+
- a5
|
11
|
+
version: 0.4.0.a5
|
11
12
|
platform: ruby
|
12
13
|
authors:
|
13
14
|
- "Luismi Cavall\xC3\xA9"
|
@@ -15,65 +16,79 @@ autorequire:
|
|
15
16
|
bindir: bin
|
16
17
|
cert_chain: []
|
17
18
|
|
18
|
-
date: 2010-05-
|
19
|
+
date: 2010-05-30 00:00:00 +02:00
|
19
20
|
default_executable:
|
20
21
|
dependencies:
|
21
22
|
- !ruby/object:Gem::Dependency
|
22
23
|
name: rspec
|
23
24
|
prerelease: false
|
24
25
|
requirement: &id001 !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
25
27
|
requirements:
|
26
28
|
- - ">="
|
27
29
|
- !ruby/object:Gem::Version
|
30
|
+
hash: 62196465
|
28
31
|
segments:
|
29
32
|
- 2
|
30
33
|
- 0
|
31
34
|
- 0
|
32
35
|
- beta
|
33
|
-
-
|
34
|
-
version: 2.0.0.beta.
|
36
|
+
- 9
|
37
|
+
version: 2.0.0.beta.9
|
35
38
|
type: :runtime
|
36
39
|
version_requirements: *id001
|
37
|
-
description:
|
40
|
+
description: If you are not in Rails but use Rspec, then Steak is just some aliases providing you with the language of acceptance testing (feature, scenario, background). If you are in Rails, you also have a couple of generators, a rake task and full Rails integration testing (meaning Webrat support, for instance)
|
38
41
|
email: luismi@lmcavalle.com
|
39
42
|
executables: []
|
40
43
|
|
41
44
|
extensions: []
|
42
45
|
|
43
|
-
extra_rdoc_files:
|
44
|
-
|
46
|
+
extra_rdoc_files: []
|
47
|
+
|
45
48
|
files:
|
49
|
+
- init.rb
|
50
|
+
- MIT-LICENSE
|
51
|
+
- Rakefile
|
46
52
|
- README.rdoc
|
47
|
-
- lib/generators/acceptance_spec/USAGE
|
48
53
|
- lib/generators/acceptance_spec/acceptance_spec_generator.rb
|
49
54
|
- lib/generators/acceptance_spec/templates/acceptance_spec.rb
|
50
|
-
- lib/generators/
|
55
|
+
- lib/generators/acceptance_spec/USAGE
|
51
56
|
- lib/generators/steak/steak_generator.rb
|
52
57
|
- lib/generators/steak/templates/acceptance_helper.rb
|
53
58
|
- lib/generators/steak/templates/helpers.rb
|
54
59
|
- lib/generators/steak/templates/paths.rb
|
55
60
|
- lib/generators/steak/templates/steak.rake
|
61
|
+
- lib/generators/steak/USAGE
|
56
62
|
- lib/steak.rb
|
63
|
+
- spec/acceptance/acceptance_helper.rb
|
64
|
+
- spec/acceptance/acceptance_spec_generator_spec.rb
|
65
|
+
- spec/acceptance/basic_spec.rb
|
66
|
+
- spec/acceptance/rails_spec.rb
|
67
|
+
- spec/acceptance/steak_generator_spec.rb
|
57
68
|
has_rdoc: true
|
58
69
|
homepage: http://github.com/cavalle/steak
|
59
70
|
licenses: []
|
60
71
|
|
61
72
|
post_install_message:
|
62
|
-
rdoc_options:
|
63
|
-
|
73
|
+
rdoc_options: []
|
74
|
+
|
64
75
|
require_paths:
|
65
76
|
- lib
|
66
77
|
required_ruby_version: !ruby/object:Gem::Requirement
|
78
|
+
none: false
|
67
79
|
requirements:
|
68
80
|
- - ">="
|
69
81
|
- !ruby/object:Gem::Version
|
82
|
+
hash: 3
|
70
83
|
segments:
|
71
84
|
- 0
|
72
85
|
version: "0"
|
73
86
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
87
|
+
none: false
|
74
88
|
requirements:
|
75
89
|
- - ">"
|
76
90
|
- !ruby/object:Gem::Version
|
91
|
+
hash: 25
|
77
92
|
segments:
|
78
93
|
- 1
|
79
94
|
- 3
|
@@ -82,13 +97,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
82
97
|
requirements: []
|
83
98
|
|
84
99
|
rubyforge_project:
|
85
|
-
rubygems_version: 1.3.
|
100
|
+
rubygems_version: 1.3.7
|
86
101
|
signing_key:
|
87
102
|
specification_version: 3
|
88
|
-
summary:
|
89
|
-
test_files:
|
90
|
-
|
91
|
-
- spec/acceptance/acceptance_spec_generator_spec.rb
|
92
|
-
- spec/acceptance/basic_spec.rb
|
93
|
-
- spec/acceptance/rails_spec.rb
|
94
|
-
- spec/acceptance/steak_generator_spec.rb
|
103
|
+
summary: Minimalist acceptance testing on top of Rspec
|
104
|
+
test_files: []
|
105
|
+
|