/
steak_install_generator_spec.rb
66 lines (52 loc) · 1.99 KB
/
steak_install_generator_spec.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
require File.dirname(__FILE__) + "/acceptance_helper.rb"
feature "Steak generator for rails", %q{
In order to quickly start to hack my rails project with steak
As a developer
I want to run a generator that sets everything up for me
} do
scenario "Running generator in an empty project" do
rails_app = create_rails_app(:setup_steak => false)
Dir.chdir rails_app do
run "rails generate steak:install"
end
File.exist?(rails_app + "/spec/acceptance/acceptance_helper.rb").should be_true
File.exist?(rails_app + "/spec/acceptance/support/helpers.rb").should be_true
File.exist?(rails_app + "/spec/acceptance/support/paths.rb").should be_true
end
scenario "Running generator with capybara by default" do
rails_app = create_rails_app(:setup_steak => false, :scaffold => :users)
Dir.chdir rails_app do
run "rails generate steak:install"
end
spec_file = create_spec :path => rails_app + "/spec/acceptance",
:content => <<-SPEC
require File.dirname(__FILE__) + "/acceptance_helper.rb"
feature "Capybara spec" do
scenario "First scenario" do
visit "/users"
page.should have_content('Listing users')
end
end
SPEC
output = run_spec spec_file, rails_app
output.should =~ /1 example, 0 failures/
end
scenario "Running generator with webrat" do
rails_app = create_rails_app(:setup_steak => false, :scaffold => :users)
Dir.chdir rails_app do
run "rails generate steak:install --webrat"
end
spec_file = create_spec :path => rails_app + "/spec/acceptance",
:content => <<-SPEC
require File.dirname(__FILE__) + "/acceptance_helper.rb"
feature "Webrat spec" do
scenario "First scenario" do
visit "/users"
response_body.should contain('Listing users')
end
end
SPEC
output = run_spec spec_file, rails_app
output.should =~ /1 example, 0 failures/
end
end