rspec-rails 2.13.1 → 2.13.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Changelog.md +12 -1
- data/README.md +1 -1
- data/lib/generators/rspec.rb +1 -2
- data/lib/generators/rspec/install/install_generator.rb +0 -2
- data/lib/generators/rspec/install/templates/spec/spec_helper.rb.tt +1 -1
- data/lib/generators/rspec/scaffold/templates/controller_spec.rb +1 -1
- data/lib/rspec/rails.rb +1 -1
- data/lib/rspec/rails/example/controller_example_group.rb +4 -2
- data/lib/rspec/rails/example/rails_example_group.rb +1 -2
- data/lib/rspec/rails/example/view_example_group.rb +1 -1
- data/lib/rspec/rails/fixture_support.rb +1 -1
- data/lib/rspec/rails/version.rb +1 -1
- metadata +5 -182
- data/features/Autotest.md +0 -24
- data/features/Generators.md +0 -8
- data/features/GettingStarted.md +0 -84
- data/features/README.md +0 -56
- data/features/RailsVersions.md +0 -4
- data/features/Transactions.md +0 -84
- data/features/Upgrade.md +0 -121
- data/features/controller_specs/Cookies.md +0 -57
- data/features/controller_specs/README.md +0 -45
- data/features/controller_specs/anonymous_controller.feature +0 -378
- data/features/controller_specs/bypass_rescue.feature +0 -75
- data/features/controller_specs/controller_spec.feature +0 -35
- data/features/controller_specs/engine_routes.feature +0 -51
- data/features/controller_specs/isolation_from_views.feature +0 -87
- data/features/controller_specs/render_views.feature +0 -114
- data/features/feature_specs/feature_spec.feature +0 -34
- data/features/helper_specs/helper_spec.feature +0 -122
- data/features/mailer_specs/url_helpers.feature +0 -38
- data/features/matchers/README.md +0 -18
- data/features/matchers/new_record_matcher.feature +0 -41
- data/features/matchers/redirect_to_matcher.feature +0 -40
- data/features/matchers/relation_match_array.feature +0 -22
- data/features/matchers/render_template_matcher.feature +0 -49
- data/features/mocks/mock_model.feature +0 -147
- data/features/mocks/stub_model.feature +0 -58
- data/features/model_specs/README.md +0 -21
- data/features/model_specs/errors_on.feature +0 -51
- data/features/model_specs/transactional_examples.feature +0 -109
- data/features/request_specs/request_spec.feature +0 -49
- data/features/routing_specs/README.md +0 -16
- data/features/routing_specs/be_routable_matcher.feature +0 -80
- data/features/routing_specs/engine_routes.feature +0 -38
- data/features/routing_specs/named_routes.feature +0 -18
- data/features/routing_specs/route_to_matcher.feature +0 -90
- data/features/step_definitions/additional_cli_steps.rb +0 -4
- data/features/step_definitions/model_steps.rb +0 -3
- data/features/support/env.rb +0 -53
- data/features/support/rails_versions.rb +0 -4
- data/features/view_specs/inferred_controller_path.feature +0 -45
- data/features/view_specs/stub_template.feature +0 -51
- data/features/view_specs/view_spec.feature +0 -206
- data/lib/rspec/rails/rails_version.rb +0 -17
- data/spec/autotest/rails_rspec2_spec.rb +0 -36
- data/spec/generators/rspec/controller/controller_generator_spec.rb +0 -97
- data/spec/generators/rspec/helper/helper_generator_spec.rb +0 -30
- data/spec/generators/rspec/install/install_generator_spec.rb +0 -30
- data/spec/generators/rspec/integration/integration_generator_spec.rb +0 -44
- data/spec/generators/rspec/mailer/mailer_generator_spec.rb +0 -48
- data/spec/generators/rspec/model/model_generator_spec.rb +0 -52
- data/spec/generators/rspec/observer/observer_generator_spec.rb +0 -21
- data/spec/generators/rspec/scaffold/scaffold_generator_spec.rb +0 -138
- data/spec/generators/rspec/view/view_generator_spec.rb +0 -41
- data/spec/rspec/rails/assertion_adapter_spec.rb +0 -28
- data/spec/rspec/rails/assertion_delegator_spec.rb +0 -43
- data/spec/rspec/rails/configuration_spec.rb +0 -26
- data/spec/rspec/rails/deprecations_spec.rb +0 -18
- data/spec/rspec/rails/example/controller_example_group_spec.rb +0 -100
- data/spec/rspec/rails/example/feature_example_group_spec.rb +0 -56
- data/spec/rspec/rails/example/helper_example_group_spec.rb +0 -64
- data/spec/rspec/rails/example/mailer_example_group_spec.rb +0 -21
- data/spec/rspec/rails/example/model_example_group_spec.rb +0 -15
- data/spec/rspec/rails/example/request_example_group_spec.rb +0 -17
- data/spec/rspec/rails/example/routing_example_group_spec.rb +0 -32
- data/spec/rspec/rails/example/view_example_group_spec.rb +0 -220
- data/spec/rspec/rails/extensions/active_model/errors_on_spec.rb +0 -23
- data/spec/rspec/rails/extensions/active_record/base_spec.rb +0 -42
- data/spec/rspec/rails/extensions/active_record/records_spec.rb +0 -9
- data/spec/rspec/rails/fixture_support_spec.rb +0 -17
- data/spec/rspec/rails/matchers/be_a_new_spec.rb +0 -142
- data/spec/rspec/rails/matchers/be_new_record_spec.rb +0 -33
- data/spec/rspec/rails/matchers/be_routable_spec.rb +0 -41
- data/spec/rspec/rails/matchers/be_valid_spec.rb +0 -44
- data/spec/rspec/rails/matchers/errors_on_spec.rb +0 -38
- data/spec/rspec/rails/matchers/has_spec.rb +0 -29
- data/spec/rspec/rails/matchers/have_rendered_spec.rb +0 -93
- data/spec/rspec/rails/matchers/redirect_to_spec.rb +0 -80
- data/spec/rspec/rails/matchers/relation_match_array_spec.rb +0 -31
- data/spec/rspec/rails/matchers/route_to_spec.rb +0 -151
- data/spec/rspec/rails/minitest_lifecycle_adapter_spec.rb +0 -22
- data/spec/rspec/rails/mocks/mock_model_spec.rb +0 -379
- data/spec/rspec/rails/mocks/stub_model_spec.rb +0 -154
- data/spec/rspec/rails/rails_version_spec.rb +0 -29
- data/spec/rspec/rails/setup_and_teardown_adapter_spec.rb +0 -32
- data/spec/rspec/rails/view_rendering_spec.rb +0 -111
- data/spec/spec_helper.rb +0 -31
- data/spec/support/ar_classes.rb +0 -42
- data/spec/support/helpers.rb +0 -20
- data/spec/support/matchers.rb +0 -9
- data/spec/support/null_object.rb +0 -6
@@ -1,45 +0,0 @@
|
|
1
|
-
Feature: view spec infers controller path and action
|
2
|
-
|
3
|
-
Scenario: infer controller path
|
4
|
-
Given a file named "spec/views/widgets/new.html.erb_spec.rb" with:
|
5
|
-
"""ruby
|
6
|
-
require "spec_helper"
|
7
|
-
|
8
|
-
describe "widgets/new" do
|
9
|
-
it "infers the controller path" do
|
10
|
-
expect(controller.request.path_parameters[:controller]).to eq("widgets")
|
11
|
-
expect(controller.controller_path).to eq("widgets")
|
12
|
-
end
|
13
|
-
end
|
14
|
-
"""
|
15
|
-
When I run `rspec spec/views`
|
16
|
-
Then the examples should all pass
|
17
|
-
|
18
|
-
Scenario: infer action
|
19
|
-
Given a file named "spec/views/widgets/new.html.erb_spec.rb" with:
|
20
|
-
"""ruby
|
21
|
-
require "spec_helper"
|
22
|
-
|
23
|
-
describe "widgets/new" do
|
24
|
-
it "infers the controller path" do
|
25
|
-
expect(controller.request.path_parameters[:action]).to eq("new")
|
26
|
-
end
|
27
|
-
end
|
28
|
-
"""
|
29
|
-
When I run `rspec spec/views`
|
30
|
-
Then the examples should all pass
|
31
|
-
|
32
|
-
Scenario: do not infer action in a partial
|
33
|
-
Given a file named "spec/views/widgets/_form.html.erb_spec.rb" with:
|
34
|
-
"""ruby
|
35
|
-
require "spec_helper"
|
36
|
-
|
37
|
-
describe "widgets/_form" do
|
38
|
-
it "includes a link to new" do
|
39
|
-
expect(controller.request.path_parameters[:action]).to be_nil
|
40
|
-
end
|
41
|
-
end
|
42
|
-
"""
|
43
|
-
When I run `rspec spec/views`
|
44
|
-
Then the examples should all pass
|
45
|
-
|
@@ -1,51 +0,0 @@
|
|
1
|
-
Feature: stub template
|
2
|
-
|
3
|
-
In order to isolate view specs from the partials rendered by the primary
|
4
|
-
view, rspec-rails (since 2.2) provides the stub_template method.
|
5
|
-
|
6
|
-
Scenario: stub template that does not exist
|
7
|
-
Given a file named "spec/views/gadgets/list.html.erb_spec.rb" with:
|
8
|
-
"""ruby
|
9
|
-
require "spec_helper"
|
10
|
-
|
11
|
-
describe "gadgets/list" do
|
12
|
-
it "renders the gadget partial for each gadget" do
|
13
|
-
assign(:gadgets, [
|
14
|
-
mock_model(Gadget, :id => 1, :name => "First"),
|
15
|
-
mock_model(Gadget, :id => 2, :name => "Second")
|
16
|
-
])
|
17
|
-
stub_template "gadgets/_gadget.html.erb" => "<%= gadget.name %><br/>"
|
18
|
-
render
|
19
|
-
expect(rendered).to match /First/
|
20
|
-
expect(rendered).to match /Second/
|
21
|
-
end
|
22
|
-
end
|
23
|
-
"""
|
24
|
-
|
25
|
-
And a file named "app/views/gadgets/list.html.erb" with:
|
26
|
-
"""
|
27
|
-
<%= render :partial => "gadget", :collection => @gadgets %>
|
28
|
-
"""
|
29
|
-
When I run `rspec spec/views/gadgets/list.html.erb_spec.rb`
|
30
|
-
Then the examples should all pass
|
31
|
-
|
32
|
-
Scenario: stub template that exists
|
33
|
-
Given a file named "spec/views/gadgets/edit.html.erb_spec.rb" with:
|
34
|
-
"""ruby
|
35
|
-
require "spec_helper"
|
36
|
-
|
37
|
-
describe "gadgets/edit" do
|
38
|
-
before(:each) do
|
39
|
-
@gadget = assign(:gadget, stub_model(Gadget))
|
40
|
-
end
|
41
|
-
|
42
|
-
it "renders the form partial" do
|
43
|
-
stub_template "gadgets/_form.html.erb" => "This content"
|
44
|
-
render
|
45
|
-
expect(rendered).to match /This content/
|
46
|
-
end
|
47
|
-
end
|
48
|
-
"""
|
49
|
-
When I run `rspec spec/views/gadgets/edit.html.erb_spec.rb`
|
50
|
-
Then the examples should all pass
|
51
|
-
|
@@ -1,206 +0,0 @@
|
|
1
|
-
Feature: view spec
|
2
|
-
|
3
|
-
View specs live in spec/views and render view templates in isolation.
|
4
|
-
|
5
|
-
Scenario: passing spec that renders the described view file
|
6
|
-
Given a file named "spec/views/widgets/index.html.erb_spec.rb" with:
|
7
|
-
"""ruby
|
8
|
-
require "spec_helper"
|
9
|
-
|
10
|
-
describe "widgets/index" do
|
11
|
-
it "displays all the widgets" do
|
12
|
-
assign(:widgets, [
|
13
|
-
stub_model(Widget, :name => "slicer"),
|
14
|
-
stub_model(Widget, :name => "dicer")
|
15
|
-
])
|
16
|
-
|
17
|
-
render
|
18
|
-
|
19
|
-
expect(rendered).to match /slicer/
|
20
|
-
expect(rendered).to match /dicer/
|
21
|
-
end
|
22
|
-
end
|
23
|
-
"""
|
24
|
-
When I run `rspec spec/views`
|
25
|
-
Then the examples should all pass
|
26
|
-
|
27
|
-
Scenario: passing spec with before and nesting
|
28
|
-
Given a file named "spec/views/widgets/index.html.erb_spec.rb" with:
|
29
|
-
"""ruby
|
30
|
-
require "spec_helper"
|
31
|
-
|
32
|
-
describe "widgets/index" do
|
33
|
-
|
34
|
-
context "with 2 widgets" do
|
35
|
-
before(:each) do
|
36
|
-
assign(:widgets, [
|
37
|
-
stub_model(Widget, :name => "slicer"),
|
38
|
-
stub_model(Widget, :name => "dicer")
|
39
|
-
])
|
40
|
-
end
|
41
|
-
|
42
|
-
it "displays both widgets" do
|
43
|
-
render
|
44
|
-
|
45
|
-
expect(rendered).to match /slicer/
|
46
|
-
expect(rendered).to match /dicer/
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
"""
|
51
|
-
When I run `rspec spec/views`
|
52
|
-
Then the examples should all pass
|
53
|
-
|
54
|
-
Scenario: passing spec with explicit template rendering
|
55
|
-
Given a file named "spec/views/widgets/widget.html.erb_spec.rb" with:
|
56
|
-
"""ruby
|
57
|
-
require "spec_helper"
|
58
|
-
|
59
|
-
describe "rendering the widget template" do
|
60
|
-
it "displays the widget" do
|
61
|
-
assign(:widget, stub_model(Widget, :name => "slicer"))
|
62
|
-
|
63
|
-
render :template => "widgets/widget.html.erb"
|
64
|
-
|
65
|
-
expect(rendered).to match /slicer/
|
66
|
-
end
|
67
|
-
end
|
68
|
-
"""
|
69
|
-
And a file named "app/views/widgets/widget.html.erb" with:
|
70
|
-
"""
|
71
|
-
<h2><%= @widget.name %></h2>
|
72
|
-
"""
|
73
|
-
When I run `rspec spec/views`
|
74
|
-
Then the examples should all pass
|
75
|
-
|
76
|
-
Scenario: passing spec with a description that includes the format and handler
|
77
|
-
Given a file named "spec/views/widgets/widget.xml.erb_spec.rb" with:
|
78
|
-
"""ruby
|
79
|
-
require "spec_helper"
|
80
|
-
|
81
|
-
describe "widgets/widget.html.erb" do
|
82
|
-
it "renders the HTML template" do
|
83
|
-
render
|
84
|
-
|
85
|
-
expect(rendered).to match /HTML/
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
89
|
-
describe "widgets/widget.xml.erb" do
|
90
|
-
it "renders the XML template" do
|
91
|
-
render
|
92
|
-
|
93
|
-
expect(rendered).to match /XML/
|
94
|
-
end
|
95
|
-
end
|
96
|
-
"""
|
97
|
-
And a file named "app/views/widgets/widget.html.erb" with:
|
98
|
-
"""
|
99
|
-
HTML
|
100
|
-
"""
|
101
|
-
And a file named "app/views/widgets/widget.xml.erb" with:
|
102
|
-
"""
|
103
|
-
XML
|
104
|
-
"""
|
105
|
-
When I run `rspec spec/views`
|
106
|
-
Then the examples should all pass
|
107
|
-
|
108
|
-
Scenario: passing spec with rendering of locals in a partial
|
109
|
-
Given a file named "spec/views/widgets/_widget.html.erb_spec.rb" with:
|
110
|
-
"""ruby
|
111
|
-
require "spec_helper"
|
112
|
-
|
113
|
-
describe "rendering locals in a partial" do
|
114
|
-
it "displays the widget" do
|
115
|
-
widget = stub_model(Widget, :name => "slicer")
|
116
|
-
|
117
|
-
render :partial => "widgets/widget.html.erb", :locals => {:widget => widget}
|
118
|
-
|
119
|
-
expect(rendered).to match /slicer/
|
120
|
-
end
|
121
|
-
end
|
122
|
-
"""
|
123
|
-
And a file named "app/views/widgets/_widget.html.erb" with:
|
124
|
-
"""
|
125
|
-
<h3><%= widget.name %></h3>
|
126
|
-
"""
|
127
|
-
When I run `rspec spec/views`
|
128
|
-
Then the examples should all pass
|
129
|
-
|
130
|
-
Scenario: passing spec with rendering of locals in an implicit partial
|
131
|
-
Given a file named "spec/views/widgets/_widget.html.erb_spec.rb" with:
|
132
|
-
"""ruby
|
133
|
-
require "spec_helper"
|
134
|
-
|
135
|
-
describe "rendering locals in a partial" do
|
136
|
-
it "displays the widget" do
|
137
|
-
widget = stub_model(Widget, :name => "slicer")
|
138
|
-
|
139
|
-
render "widgets/widget", :widget => widget
|
140
|
-
|
141
|
-
expect(rendered).to match /slicer/
|
142
|
-
end
|
143
|
-
end
|
144
|
-
"""
|
145
|
-
And a file named "app/views/widgets/_widget.html.erb" with:
|
146
|
-
"""
|
147
|
-
<h3><%= widget.name %></h3>
|
148
|
-
"""
|
149
|
-
When I run `rspec spec/views`
|
150
|
-
Then the examples should all pass
|
151
|
-
|
152
|
-
Scenario: passing spec with rendering of text
|
153
|
-
Given a file named "spec/views/widgets/direct.html.erb_spec.rb" with:
|
154
|
-
"""ruby
|
155
|
-
require "spec_helper"
|
156
|
-
|
157
|
-
describe "rendering text directly" do
|
158
|
-
it "displays the given text" do
|
159
|
-
|
160
|
-
render :text => "This is directly rendered"
|
161
|
-
|
162
|
-
expect(rendered).to match /directly rendered/
|
163
|
-
end
|
164
|
-
end
|
165
|
-
"""
|
166
|
-
When I run `rspec spec/views`
|
167
|
-
Then the examples should all pass
|
168
|
-
|
169
|
-
Scenario: passing view spec that stubs a helper method
|
170
|
-
Given a file named "app/views/secrets/index.html.erb" with:
|
171
|
-
"""
|
172
|
-
<%- if admin? %>
|
173
|
-
<h1>Secret admin area</h1>
|
174
|
-
<%- end %>
|
175
|
-
"""
|
176
|
-
And a file named "spec/views/secrets/index.html.erb_spec.rb" with:
|
177
|
-
"""ruby
|
178
|
-
require 'spec_helper'
|
179
|
-
|
180
|
-
describe 'secrets/index' do
|
181
|
-
before do
|
182
|
-
view.stub(:admin?).and_return(true)
|
183
|
-
end
|
184
|
-
|
185
|
-
it 'checks for admin access' do
|
186
|
-
render
|
187
|
-
expect(rendered).to match /Secret admin area/
|
188
|
-
end
|
189
|
-
end
|
190
|
-
"""
|
191
|
-
When I run `rspec spec/views/secrets`
|
192
|
-
Then the examples should all pass
|
193
|
-
|
194
|
-
Scenario: request.path_parameters should match Rails by using symbols for keys
|
195
|
-
Given a file named "spec/views/widgets/index.html.erb_spec.rb" with:
|
196
|
-
"""ruby
|
197
|
-
require "spec_helper"
|
198
|
-
|
199
|
-
describe "controller.request.path_parameters" do
|
200
|
-
it "matches the Rails environment by using symbols for keys" do
|
201
|
-
[:controller, :action].each { |k| expect(controller.request.path_parameters.keys).to include(k) }
|
202
|
-
end
|
203
|
-
end
|
204
|
-
"""
|
205
|
-
When I run `rspec spec/views`
|
206
|
-
Then the examples should all pass
|
@@ -1,17 +0,0 @@
|
|
1
|
-
module RSpec
|
2
|
-
module Rails
|
3
|
-
# @api private
|
4
|
-
def self.rails_version_satisfied_by?(requirement)
|
5
|
-
Gem::Requirement.new(requirement).satisfied_by?(rails_version)
|
6
|
-
end
|
7
|
-
|
8
|
-
# @api private
|
9
|
-
def self.rails_version
|
10
|
-
@rails_version ||= if ::Rails.version.is_a?(Gem::Version)
|
11
|
-
::Rails.version
|
12
|
-
else
|
13
|
-
Gem::Version.new(::Rails.version.to_s)
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
@@ -1,36 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
require "autotest/rails_rspec2"
|
3
|
-
|
4
|
-
describe Autotest::RailsRspec2 do
|
5
|
-
|
6
|
-
let(:rails_rspec2_autotest) { Autotest::RailsRspec2.new }
|
7
|
-
|
8
|
-
describe 'exceptions' do
|
9
|
-
let(:exceptions_regexp) { rails_rspec2_autotest.exceptions }
|
10
|
-
|
11
|
-
it "matches './log/test.log'" do
|
12
|
-
exceptions_regexp.should match('./log/test.log')
|
13
|
-
end
|
14
|
-
|
15
|
-
it "matches 'log/test.log'" do
|
16
|
-
exceptions_regexp.should match('log/test.log')
|
17
|
-
end
|
18
|
-
|
19
|
-
it "does not match './spec/models/user_spec.rb'" do
|
20
|
-
exceptions_regexp.should_not match('./spec/models/user_spec.rb')
|
21
|
-
end
|
22
|
-
|
23
|
-
it "does not match 'spec/models/user_spec.rb'" do
|
24
|
-
exceptions_regexp.should_not match('spec/models/user_spec.rb')
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
describe 'mappings' do
|
29
|
-
it 'runs model specs when support files change' do
|
30
|
-
rails_rspec2_autotest.find_order = %w(spec/models/user_spec.rb spec/support/blueprints.rb)
|
31
|
-
rails_rspec2_autotest.test_files_for('spec/support/blueprints.rb').should(
|
32
|
-
include('spec/models/user_spec.rb'))
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
end
|
@@ -1,97 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
# Generators are not automatically loaded by Rails
|
4
|
-
require 'generators/rspec/controller/controller_generator'
|
5
|
-
|
6
|
-
describe Rspec::Generators::ControllerGenerator do
|
7
|
-
# Tell the generator where to put its output (what it thinks of as Rails.root)
|
8
|
-
destination File.expand_path("../../../../../tmp", __FILE__)
|
9
|
-
|
10
|
-
before { prepare_destination }
|
11
|
-
|
12
|
-
describe 'controller specs' do
|
13
|
-
subject { file('spec/controllers/posts_controller_spec.rb') }
|
14
|
-
describe 'generated by default' do
|
15
|
-
before do
|
16
|
-
run_generator %w(posts)
|
17
|
-
end
|
18
|
-
|
19
|
-
describe 'the spec' do
|
20
|
-
it { should exist }
|
21
|
-
it { should contain(/require 'spec_helper'/) }
|
22
|
-
it { should contain(/describe PostsController/) }
|
23
|
-
end
|
24
|
-
end
|
25
|
-
describe 'skipped with a flag' do
|
26
|
-
before do
|
27
|
-
run_generator %w(posts --no-controller_specs)
|
28
|
-
end
|
29
|
-
it { should_not exist }
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
describe 'view specs' do
|
34
|
-
describe 'are not generated' do
|
35
|
-
describe 'with no-view-spec flag' do
|
36
|
-
before do
|
37
|
-
run_generator %w(posts index show --no-view-specs)
|
38
|
-
end
|
39
|
-
describe 'index.html.erb' do
|
40
|
-
subject { file('spec/views/posts/index.html.erb_spec.rb') }
|
41
|
-
it { should_not exist }
|
42
|
-
end
|
43
|
-
end
|
44
|
-
describe 'with no actions' do
|
45
|
-
before do
|
46
|
-
run_generator %w(posts)
|
47
|
-
end
|
48
|
-
describe 'index.html.erb' do
|
49
|
-
subject { file('spec/views/posts/index.html.erb_spec.rb') }
|
50
|
-
it { should_not exist }
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
describe 'with --no-template-engine' do
|
55
|
-
before do
|
56
|
-
run_generator %w(posts index --no-template-engine)
|
57
|
-
end
|
58
|
-
|
59
|
-
describe 'index.html.erb' do
|
60
|
-
subject { file('spec/views/posts/index.html._spec.rb') }
|
61
|
-
it { should_not exist }
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
describe 'are generated' do
|
67
|
-
describe 'with default template engine' do
|
68
|
-
before do
|
69
|
-
run_generator %w(posts index show)
|
70
|
-
end
|
71
|
-
describe 'index.html.erb' do
|
72
|
-
subject { file('spec/views/posts/index.html.erb_spec.rb') }
|
73
|
-
it { should exist }
|
74
|
-
it { should contain(/require 'spec_helper'/) }
|
75
|
-
it { should contain(/describe "posts\/index.html.erb"/) }
|
76
|
-
end
|
77
|
-
describe 'show.html.erb' do
|
78
|
-
subject { file('spec/views/posts/show.html.erb_spec.rb') }
|
79
|
-
it { should exist }
|
80
|
-
it { should contain(/require 'spec_helper'/) }
|
81
|
-
it { should contain(/describe "posts\/show.html.erb"/) }
|
82
|
-
end
|
83
|
-
end
|
84
|
-
describe 'with haml' do
|
85
|
-
before do
|
86
|
-
run_generator %w(posts index --template_engine haml)
|
87
|
-
end
|
88
|
-
describe 'index.html.haml' do
|
89
|
-
subject { file('spec/views/posts/index.html.haml_spec.rb') }
|
90
|
-
it { should exist }
|
91
|
-
it { should contain(/require 'spec_helper'/) }
|
92
|
-
it { should contain(/describe "posts\/index.html.haml"/) }
|
93
|
-
end
|
94
|
-
end
|
95
|
-
end
|
96
|
-
end
|
97
|
-
end
|