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
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
require File.dirname(__FILE__) + "/acceptance_helper.rb"
|
|
2
|
-
|
|
3
|
-
feature "Acceptance spec execution", %q{
|
|
4
|
-
In order to write better software
|
|
5
|
-
As a ruby developer
|
|
6
|
-
I want to execute acceptance specs
|
|
7
|
-
} do
|
|
8
|
-
|
|
9
|
-
scenario "Minimal acceptance spec" do
|
|
10
|
-
spec_file = create_spec <<-SPEC
|
|
11
|
-
require '#{File.dirname(__FILE__) + "/../../../lib/steak"}'
|
|
12
|
-
feature "Minimal spec" do
|
|
13
|
-
scenario "First scenario" do
|
|
14
|
-
true.should be_true
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
SPEC
|
|
18
|
-
output = run_spec spec_file
|
|
19
|
-
output.should =~ /1 example, 0 failures/
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
scenario "Minimal acceptance spec that fails" do
|
|
23
|
-
spec_file = create_spec <<-SPEC
|
|
24
|
-
require '#{File.dirname(__FILE__) + "/../../../lib/steak"}'
|
|
25
|
-
feature "Minimal spec" do
|
|
26
|
-
scenario "First scenario" do
|
|
27
|
-
true.should be_false
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
SPEC
|
|
31
|
-
output = run_spec spec_file
|
|
32
|
-
output.should =~ /1 example, 1 failure/
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
scenario "Acceptance spec with background" do
|
|
36
|
-
spec_file = create_spec <<-SPEC
|
|
37
|
-
require '#{File.dirname(__FILE__) + "/../../../lib/steak"}'
|
|
38
|
-
feature "Minimal spec" do
|
|
39
|
-
background do
|
|
40
|
-
@value = 17
|
|
41
|
-
end
|
|
42
|
-
scenario "First scenario" do
|
|
43
|
-
@value.should == 17
|
|
44
|
-
end
|
|
45
|
-
end
|
|
46
|
-
SPEC
|
|
47
|
-
output = run_spec spec_file
|
|
48
|
-
output.should =~ /1 example, 0 failures/
|
|
49
|
-
end
|
|
50
|
-
|
|
51
|
-
scenario "Acceptance spec metadata" do
|
|
52
|
-
spec_file = create_spec <<-SPEC
|
|
53
|
-
require '#{File.dirname(__FILE__) + "/../../../lib/steak"}'
|
|
54
|
-
feature "Minimal spec" do
|
|
55
|
-
scenario "should have acceptance metadata" do
|
|
56
|
-
example.metadata[:type].should == :acceptance
|
|
57
|
-
example.metadata[:steak].should be_true
|
|
58
|
-
example.metadata[:file_path].should == __FILE__
|
|
59
|
-
end
|
|
60
|
-
end
|
|
61
|
-
SPEC
|
|
62
|
-
output = run_spec spec_file
|
|
63
|
-
output.should =~ /1 example, 0 failures/
|
|
64
|
-
end
|
|
65
|
-
|
|
66
|
-
scenario "Regular specs doesn't have acceptance metadata" do
|
|
67
|
-
spec_file = create_spec <<-SPEC
|
|
68
|
-
require '#{File.dirname(__FILE__) + "/../../../lib/steak"}'
|
|
69
|
-
describe "Regular spec" do
|
|
70
|
-
it "should not have acceptance metadata" do
|
|
71
|
-
example.metadata[:type].should_not == :acceptance
|
|
72
|
-
example.metadata[:steak].should_not be_true
|
|
73
|
-
end
|
|
74
|
-
end
|
|
75
|
-
SPEC
|
|
76
|
-
output = run_spec spec_file
|
|
77
|
-
output.should =~ /1 example, 0 failures/
|
|
78
|
-
end
|
|
79
|
-
|
|
80
|
-
scenario "Feature-level file path metadata filtering" do
|
|
81
|
-
spec_file = create_spec <<-SPEC
|
|
82
|
-
require '#{File.dirname(__FILE__) + "/../../../lib/steak"}'
|
|
83
|
-
RSpec.configuration.before(:each, :example_group => {:file_path => __FILE__}) do
|
|
84
|
-
@executed = true
|
|
85
|
-
end
|
|
86
|
-
feature "Minimal spec" do
|
|
87
|
-
scenario "should have run the before block" do
|
|
88
|
-
@executed.should be_true
|
|
89
|
-
end
|
|
90
|
-
end
|
|
91
|
-
SPEC
|
|
92
|
-
output = run_spec spec_file
|
|
93
|
-
output.should =~ /1 example, 0 failures/
|
|
94
|
-
end
|
|
95
|
-
|
|
96
|
-
scenario "Steak should not pollute Object methods namespace" do
|
|
97
|
-
spec_file = create_spec <<-SPEC
|
|
98
|
-
require '#{File.dirname(__FILE__) + "/../../../lib/steak"}'
|
|
99
|
-
|
|
100
|
-
class Wadus
|
|
101
|
-
def call_feature
|
|
102
|
-
feature
|
|
103
|
-
end
|
|
104
|
-
|
|
105
|
-
def method_missing(meth, *args, &blk)
|
|
106
|
-
return "Hello!"
|
|
107
|
-
end
|
|
108
|
-
end
|
|
109
|
-
|
|
110
|
-
feature "Wadus class" do
|
|
111
|
-
scenario "should not be polluted by Steak" do
|
|
112
|
-
w = Wadus.new
|
|
113
|
-
w.should_not respond_to(:feature)
|
|
114
|
-
w.call_feature.should == "Hello!"
|
|
115
|
-
end
|
|
116
|
-
end
|
|
117
|
-
SPEC
|
|
118
|
-
output = run_spec spec_file
|
|
119
|
-
output.should =~ /1 example, 0 failures/
|
|
120
|
-
end
|
|
121
|
-
end
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
require File.dirname(__FILE__) + "/acceptance_helper.rb"
|
|
2
|
-
|
|
3
|
-
feature "Acceptance spec execution", %q{
|
|
4
|
-
In order to write better web apps
|
|
5
|
-
As a rails developer
|
|
6
|
-
I want to execute acceptance specs
|
|
7
|
-
} do
|
|
8
|
-
|
|
9
|
-
scenario "Minimal acceptance spec" do
|
|
10
|
-
rails_app = create_rails_app
|
|
11
|
-
spec_file = create_spec :path => rails_app + "/spec/acceptance",
|
|
12
|
-
:content => <<-SPEC
|
|
13
|
-
require File.dirname(__FILE__) + "/acceptance_helper.rb"
|
|
14
|
-
feature "Minimal spec" do
|
|
15
|
-
scenario "First scenario" do
|
|
16
|
-
::Rails.env.should == "test"
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
SPEC
|
|
20
|
-
output = run_spec spec_file, File.join(File.dirname(spec_file), '../..')
|
|
21
|
-
output.should =~ /1 example, 0 failures/
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
scenario "Integration stuff" do
|
|
25
|
-
rails_app = create_rails_app
|
|
26
|
-
spec_file = create_spec :path => rails_app + "/spec/acceptance",
|
|
27
|
-
:content => <<-SPEC
|
|
28
|
-
require File.dirname(__FILE__) + "/acceptance_helper.rb"
|
|
29
|
-
feature "Minimal spec" do
|
|
30
|
-
scenario "First scenario" do
|
|
31
|
-
get "/"
|
|
32
|
-
last_response.body.should =~ /Not Found/
|
|
33
|
-
end
|
|
34
|
-
end
|
|
35
|
-
SPEC
|
|
36
|
-
output = run_spec spec_file, File.join(File.dirname(spec_file), '../..')
|
|
37
|
-
output.should =~ /1 example, 0 failures/
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
scenario "Path helpers are available" do
|
|
41
|
-
rails_app = create_rails_app
|
|
42
|
-
spec_file = create_spec :path => rails_app + "/spec/acceptance",
|
|
43
|
-
:content => <<-SPEC
|
|
44
|
-
require File.dirname(__FILE__) + "/acceptance_helper.rb"
|
|
45
|
-
feature "Minimal spec" do
|
|
46
|
-
scenario "First scenario" do
|
|
47
|
-
homepage.should == "/"
|
|
48
|
-
end
|
|
49
|
-
end
|
|
50
|
-
SPEC
|
|
51
|
-
output = run_spec spec_file, File.join(File.dirname(spec_file), '../..')
|
|
52
|
-
output.should =~ /1 example, 0 failures/
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
scenario "Running rake stats" do
|
|
56
|
-
rails_app = create_rails_app
|
|
57
|
-
|
|
58
|
-
Dir.chdir rails_app do
|
|
59
|
-
run "rails generate steak:install"
|
|
60
|
-
run("rake stats").should =~ /Acceptance specs/
|
|
61
|
-
end
|
|
62
|
-
end
|
|
63
|
-
|
|
64
|
-
scenario "Running specs with rake" do
|
|
65
|
-
rails_app = create_rails_app
|
|
66
|
-
|
|
67
|
-
spec_file = create_spec :path => rails_app + "/spec/acceptance",
|
|
68
|
-
:content => <<-SPEC
|
|
69
|
-
require File.dirname(__FILE__) + "/acceptance_helper.rb"
|
|
70
|
-
feature "Basic spec" do
|
|
71
|
-
scenario "First scenario" do
|
|
72
|
-
true.should == true
|
|
73
|
-
end
|
|
74
|
-
end
|
|
75
|
-
SPEC
|
|
76
|
-
|
|
77
|
-
Dir.chdir rails_app do
|
|
78
|
-
run "rake db:migrate db:test:prepare"
|
|
79
|
-
|
|
80
|
-
output = run("rake spec:acceptance")
|
|
81
|
-
output.should =~ /1 example, 0 failures/
|
|
82
|
-
|
|
83
|
-
output = run("rake")
|
|
84
|
-
output.should =~ /1 example, 0 failures/
|
|
85
|
-
end
|
|
86
|
-
end
|
|
87
|
-
|
|
88
|
-
end
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
require File.dirname(__FILE__) + "/acceptance_helper.rb"
|
|
2
|
-
|
|
3
|
-
feature "Steak generator for rails", %q{
|
|
4
|
-
In order to quickly start to hack my rails project with steak
|
|
5
|
-
As a developer
|
|
6
|
-
I want to run a generator that sets everything up for me
|
|
7
|
-
} do
|
|
8
|
-
|
|
9
|
-
scenario "Running generator in an empty project" do
|
|
10
|
-
|
|
11
|
-
rails_app = create_rails_app(:setup_steak => false)
|
|
12
|
-
|
|
13
|
-
Dir.chdir rails_app do
|
|
14
|
-
run "rails generate steak:install"
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
File.exist?(rails_app + "/spec/acceptance/acceptance_helper.rb").should be_true
|
|
18
|
-
File.exist?(rails_app + "/spec/acceptance/support/helpers.rb").should be_true
|
|
19
|
-
File.exist?(rails_app + "/spec/acceptance/support/paths.rb").should be_true
|
|
20
|
-
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
scenario "Running generator with capybara by default" do
|
|
24
|
-
rails_app = create_rails_app(:setup_steak => false, :scaffold => :users)
|
|
25
|
-
|
|
26
|
-
Dir.chdir rails_app do
|
|
27
|
-
run "rails generate steak:install"
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
spec_file = create_spec :path => rails_app + "/spec/acceptance",
|
|
31
|
-
:content => <<-SPEC
|
|
32
|
-
require File.dirname(__FILE__) + "/acceptance_helper.rb"
|
|
33
|
-
feature "Capybara spec" do
|
|
34
|
-
scenario "First scenario" do
|
|
35
|
-
visit "/users"
|
|
36
|
-
page.should have_content('Listing users')
|
|
37
|
-
end
|
|
38
|
-
end
|
|
39
|
-
SPEC
|
|
40
|
-
output = run_spec spec_file, rails_app
|
|
41
|
-
output.should =~ /1 example, 0 failures/
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
scenario "Running generator with webrat" do
|
|
45
|
-
rails_app = create_rails_app(:browser_simulator => :webrat, :scaffold => :users)
|
|
46
|
-
|
|
47
|
-
spec_file = create_spec :path => rails_app + "/spec/acceptance",
|
|
48
|
-
:content => <<-SPEC
|
|
49
|
-
require File.dirname(__FILE__) + "/acceptance_helper.rb"
|
|
50
|
-
feature "Webrat spec" do
|
|
51
|
-
scenario "First scenario" do
|
|
52
|
-
visit "/users"
|
|
53
|
-
response_body.should contain('Listing users')
|
|
54
|
-
end
|
|
55
|
-
end
|
|
56
|
-
SPEC
|
|
57
|
-
|
|
58
|
-
output = run_spec spec_file, rails_app
|
|
59
|
-
output.should =~ /1 example, 0 failures/
|
|
60
|
-
end
|
|
61
|
-
|
|
62
|
-
end
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
require File.dirname(__FILE__) + "/acceptance_helper.rb"
|
|
2
|
-
|
|
3
|
-
feature "Acceptance spec generator for rails", %q{
|
|
4
|
-
In order to quickly add a new acceptance spec
|
|
5
|
-
As a developer
|
|
6
|
-
I want to run a generator that creates it for me
|
|
7
|
-
} do
|
|
8
|
-
|
|
9
|
-
background do
|
|
10
|
-
@rails_app = create_rails_app
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
scenario "Adding new acceptance spec" do
|
|
14
|
-
Dir.chdir @rails_app do
|
|
15
|
-
run "rails generate steak:spec document_creation"
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
File.exist?(
|
|
19
|
-
@rails_app + "/spec/acceptance/document_creation_spec.rb"
|
|
20
|
-
).should be_true
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
scenario "Adding new acceptance spec (plural name)" do
|
|
24
|
-
Dir.chdir @rails_app do
|
|
25
|
-
run "rails generate steak:spec creating_documents"
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
File.exist?(
|
|
29
|
-
@rails_app + "/spec/acceptance/creating_documents_spec.rb"
|
|
30
|
-
).should be_true
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
scenario "Adding new acceptance spec (pascalized name)" do
|
|
34
|
-
Dir.chdir @rails_app do
|
|
35
|
-
run "rails generate steak:spec DocumentCreation"
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
File.exist?(
|
|
39
|
-
@rails_app + "/spec/acceptance/document_creation_spec.rb"
|
|
40
|
-
).should be_true
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
scenario "Adding new acceptance spec (name ending with _spec)" do
|
|
44
|
-
Dir.chdir @rails_app do
|
|
45
|
-
run "rails generate steak:spec document_creation_spec"
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
File.exist?(
|
|
49
|
-
@rails_app + "/spec/acceptance/document_creation_spec.rb"
|
|
50
|
-
).should be_true
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
scenario "Adding new acceptance spec (namespaced)" do
|
|
54
|
-
Dir.chdir @rails_app do
|
|
55
|
-
run "rails generate steak:spec document/creation_spec"
|
|
56
|
-
end
|
|
57
|
-
|
|
58
|
-
file_path = @rails_app + "/spec/acceptance/document/creation_spec.rb"
|
|
59
|
-
|
|
60
|
-
File.exist?(file_path).should be_true
|
|
61
|
-
File.read(file_path).should include("/../acceptance_helper")
|
|
62
|
-
end
|
|
63
|
-
|
|
64
|
-
scenario "Removing an acceptance spec" do
|
|
65
|
-
Dir.chdir @rails_app do
|
|
66
|
-
run "rails generate steak:spec document_creation"
|
|
67
|
-
run "rails destroy steak:spec document_creation"
|
|
68
|
-
end
|
|
69
|
-
|
|
70
|
-
spec_dir = @rails_app + "/spec/acceptance/"
|
|
71
|
-
|
|
72
|
-
File.exist?(spec_dir + "document_creation_spec.rb").should be_false
|
|
73
|
-
File.exist?(spec_dir + "acceptance_helper.rb").should be_true
|
|
74
|
-
File.exist?(spec_dir + "support/helpers.rb").should be_true
|
|
75
|
-
File.exist?(spec_dir + "support/paths.rb").should be_true
|
|
76
|
-
end
|
|
77
|
-
end
|