rspec-rails 1.1.11 → 1.1.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (140) hide show
  1. data/History.txt +29 -0
  2. data/Manifest.txt +94 -94
  3. data/README.txt +5 -7
  4. data/Rakefile +14 -2
  5. data/{spec_resources/views/controller_spec/_partial.rhtml → TODO.txt} +0 -0
  6. data/features/step_definitions/people.rb +6 -0
  7. data/features/support/env.rb +13 -0
  8. data/{stories/transactions_should_rollback → features/transactions/transactions_should_rollback.feature} +4 -3
  9. data/generators/rspec/rspec_generator.rb +0 -4
  10. data/generators/rspec/templates/rspec.rake +130 -104
  11. data/generators/rspec/templates/script/spec_server +17 -8
  12. data/generators/rspec/templates/spec_helper.rb +1 -1
  13. data/generators/rspec_default_values.rb +3 -3
  14. data/generators/rspec_scaffold/templates/edit_erb_spec.rb +7 -6
  15. data/generators/rspec_scaffold/templates/index_erb_spec.rb +9 -8
  16. data/generators/rspec_scaffold/templates/new_erb_spec.rb +7 -6
  17. data/generators/rspec_scaffold/templates/show_erb_spec.rb +9 -9
  18. data/lib/spec/rails.rb +14 -2
  19. data/lib/spec/rails/example/controller_example_group.rb +16 -23
  20. data/lib/spec/rails/example/cookies_proxy.rb +5 -1
  21. data/lib/spec/rails/example/functional_example_group.rb +17 -5
  22. data/lib/spec/rails/example/helper_example_group.rb +5 -4
  23. data/lib/spec/rails/example/rails_example_group.rb +10 -15
  24. data/lib/spec/rails/example/view_example_group.rb +5 -5
  25. data/lib/spec/rails/extensions.rb +1 -3
  26. data/lib/spec/rails/extensions/action_controller/base.rb +1 -1
  27. data/lib/spec/rails/extensions/action_controller/rescue.rb +9 -5
  28. data/lib/spec/rails/extensions/action_controller/test_response.rb +11 -2
  29. data/lib/spec/rails/extensions/action_view/base.rb +4 -2
  30. data/lib/spec/rails/extensions/active_record/base.rb +1 -2
  31. data/lib/spec/rails/extensions/spec/{example → runner}/configuration.rb +12 -7
  32. data/lib/spec/rails/matchers.rb +1 -0
  33. data/lib/spec/rails/matchers/ar_be_valid.rb +41 -0
  34. data/lib/spec/rails/matchers/redirect_to.rb +4 -2
  35. data/lib/spec/rails/matchers/render_template.rb +30 -10
  36. data/lib/spec/rails/mocks.rb +11 -8
  37. data/lib/spec/rails/version.rb +3 -2
  38. data/rspec-rails.gemspec +16 -8
  39. data/spec/{rails/autotest → autotest}/mappings_spec.rb +3 -3
  40. data/{spec_resources → spec/resources}/controllers/action_view_base_spec_controller.rb +0 -0
  41. data/spec/resources/controllers/application.rb +9 -0
  42. data/{spec_resources → spec/resources}/controllers/controller_spec_controller.rb +19 -6
  43. data/{spec_resources → spec/resources}/controllers/redirect_spec_controller.rb +7 -0
  44. data/{spec_resources → spec/resources}/controllers/render_spec_controller.rb +0 -0
  45. data/{spec_resources → spec/resources}/controllers/rjs_spec_controller.rb +0 -0
  46. data/{spec_resources → spec/resources}/helpers/addition_helper.rb +0 -0
  47. data/{spec_resources → spec/resources}/helpers/explicit_helper.rb +8 -0
  48. data/{spec_resources → spec/resources}/helpers/more_explicit_helper.rb +0 -0
  49. data/{spec_resources → spec/resources}/helpers/plugin_application_helper.rb +0 -0
  50. data/{spec_resources → spec/resources}/helpers/view_spec_helper.rb +0 -0
  51. data/spec/resources/models/animal.rb +4 -0
  52. data/spec/resources/models/person.rb +18 -0
  53. data/spec/resources/models/thing.rb +3 -0
  54. data/{spec_resources/views/controller_spec/action_setting_the_assigns_hash.rhtml → spec/resources/views/controller_spec/_partial.rhtml} +0 -0
  55. data/{spec_resources → spec/resources}/views/controller_spec/action_setting_flash_after_session_reset.rhtml +0 -0
  56. data/{spec_resources → spec/resources}/views/controller_spec/action_setting_flash_before_session_reset.rhtml +0 -0
  57. data/{spec_resources/views/layouts/application.rhtml → spec/resources/views/controller_spec/action_setting_the_assigns_hash.rhtml} +0 -0
  58. data/{spec_resources → spec/resources}/views/controller_spec/action_with_errors_in_template.rhtml +0 -0
  59. data/{spec_resources → spec/resources}/views/controller_spec/action_with_template.rhtml +0 -0
  60. data/{spec_resources/views/layouts/simple.rhtml → spec/resources/views/layouts/application.rhtml} +0 -0
  61. data/{spec_resources/views/render_spec/_a_partial.rhtml → spec/resources/views/layouts/simple.rhtml} +0 -0
  62. data/{spec_resources → spec/resources}/views/objects/_object.html.erb +0 -0
  63. data/{spec_resources/views/render_spec/action_with_alternate_layout.rhtml → spec/resources/views/render_spec/_a_partial.rhtml} +0 -0
  64. data/{spec_resources/views/render_spec/some_action.rhtml → spec/resources/views/render_spec/action_with_alternate_layout.rhtml} +0 -0
  65. data/{spec_resources/views/view_spec/_partial_used_twice.rhtml → spec/resources/views/render_spec/some_action.html.erb} +0 -0
  66. data/{spec_resources → spec/resources}/views/render_spec/some_action.js.rjs +0 -0
  67. data/{spec_resources → spec/resources}/views/render_spec/some_action.rjs +0 -0
  68. data/{spec_resources → spec/resources}/views/rjs_spec/_replacement_partial.rhtml +0 -0
  69. data/{spec_resources → spec/resources}/views/rjs_spec/hide_div.rjs +0 -0
  70. data/{spec_resources → spec/resources}/views/rjs_spec/hide_page_element.rjs +0 -0
  71. data/{spec_resources → spec/resources}/views/rjs_spec/insert_html.rjs +0 -0
  72. data/{spec_resources → spec/resources}/views/rjs_spec/replace.rjs +0 -0
  73. data/{spec_resources → spec/resources}/views/rjs_spec/replace_html.rjs +0 -0
  74. data/{spec_resources → spec/resources}/views/rjs_spec/replace_html_with_partial.rjs +0 -0
  75. data/{spec_resources → spec/resources}/views/rjs_spec/visual_effect.rjs +0 -0
  76. data/{spec_resources → spec/resources}/views/rjs_spec/visual_toggle_effect.rjs +0 -0
  77. data/{spec_resources → spec/resources}/views/tag_spec/no_tags.rhtml +0 -0
  78. data/{spec_resources → spec/resources}/views/tag_spec/single_div_with_no_attributes.rhtml +0 -0
  79. data/{spec_resources → spec/resources}/views/tag_spec/single_div_with_one_attribute.rhtml +0 -0
  80. data/{spec_resources → spec/resources}/views/view_spec/_partial.rhtml +0 -0
  81. data/spec/resources/views/view_spec/_partial_used_twice.rhtml +0 -0
  82. data/{spec_resources → spec/resources}/views/view_spec/_partial_with_local_variable.rhtml +0 -0
  83. data/{spec_resources → spec/resources}/views/view_spec/_partial_with_sub_partial.rhtml +0 -0
  84. data/{spec_resources → spec/resources}/views/view_spec/_spacer.rhtml +0 -0
  85. data/{spec_resources → spec/resources}/views/view_spec/accessor.rhtml +0 -0
  86. data/{spec_resources → spec/resources}/views/view_spec/block_helper.rhtml +0 -0
  87. data/{spec_resources → spec/resources}/views/view_spec/entry_form.rhtml +0 -0
  88. data/{spec_resources → spec/resources}/views/view_spec/explicit_helper.rhtml +0 -0
  89. data/{spec_resources → spec/resources}/views/view_spec/foo/show.rhtml +0 -0
  90. data/{spec_resources → spec/resources}/views/view_spec/implicit_helper.rhtml +0 -0
  91. data/{spec_resources → spec/resources}/views/view_spec/multiple_helpers.rhtml +0 -0
  92. data/spec/resources/views/view_spec/path_params.html.erb +1 -0
  93. data/{spec_resources → spec/resources}/views/view_spec/should_not_receive.rhtml +0 -0
  94. data/{spec_resources → spec/resources}/views/view_spec/template_with_partial.rhtml +0 -0
  95. data/{spec_resources → spec/resources}/views/view_spec/template_with_partial_using_collection.rhtml +0 -0
  96. data/{spec_resources → spec/resources}/views/view_spec/template_with_partial_with_array.rhtml +0 -0
  97. data/spec/{rails → spec/rails}/example/assigns_hash_proxy_spec.rb +1 -1
  98. data/spec/spec/rails/example/configuration_spec.rb +79 -0
  99. data/spec/{rails → spec/rails}/example/controller_isolation_spec.rb +1 -7
  100. data/spec/{rails → spec/rails}/example/controller_spec_spec.rb +63 -6
  101. data/spec/{rails → spec/rails}/example/cookies_proxy_spec.rb +30 -13
  102. data/spec/{rails → spec/rails}/example/example_group_factory_spec.rb +1 -1
  103. data/spec/{rails → spec/rails}/example/helper_spec_spec.rb +28 -1
  104. data/spec/{rails → spec/rails}/example/model_spec_spec.rb +1 -1
  105. data/spec/{rails → spec/rails}/example/shared_behaviour_spec.rb +1 -1
  106. data/spec/{rails → spec/rails}/example/test_unit_assertion_accessibility_spec.rb +1 -1
  107. data/spec/{rails → spec/rails}/example/view_spec_spec.rb +22 -1
  108. data/spec/{rails → spec/rails}/extensions/action_controller_rescue_action_spec.rb +4 -1
  109. data/spec/{rails → spec/rails}/extensions/action_view_base_spec.rb +1 -1
  110. data/spec/{rails → spec/rails}/extensions/active_record_spec.rb +1 -1
  111. data/spec/{rails → spec/rails}/interop/testcase_spec.rb +6 -2
  112. data/spec/spec/rails/matchers/ar_be_valid_spec.rb +35 -0
  113. data/spec/{rails → spec/rails}/matchers/assert_select_spec.rb +1 -5
  114. data/spec/{rails → spec/rails}/matchers/errors_on_spec.rb +1 -1
  115. data/spec/{rails → spec/rails}/matchers/have_text_spec.rb +1 -1
  116. data/spec/{rails → spec/rails}/matchers/include_text_spec.rb +1 -1
  117. data/spec/{rails → spec/rails}/matchers/redirect_to_spec.rb +11 -2
  118. data/spec/{rails → spec/rails}/matchers/render_template_spec.rb +8 -4
  119. data/spec/{rails → spec/rails}/matchers/should_change_spec.rb +1 -1
  120. data/spec/{rails → spec/rails}/mocks/ar_classes.rb +0 -0
  121. data/spec/{rails → spec/rails}/mocks/mock_model_spec.rb +1 -1
  122. data/spec/{rails → spec/rails}/mocks/stub_model_spec.rb +1 -1
  123. data/spec/{rails → spec/rails}/sample_modified_fixture.rb +1 -1
  124. data/spec/{rails → spec/rails}/sample_spec.rb +1 -1
  125. data/spec/spec/rails/spec_server_spec.rb +96 -0
  126. data/spec/{rails → spec/rails}/spec_spec.rb +1 -1
  127. data/spec/spec_helper.rb +23 -14
  128. metadata +111 -100
  129. data/UPGRADE +0 -7
  130. data/generators/rspec/templates/all_stories.rb +0 -4
  131. data/generators/rspec/templates/stories_helper.rb +0 -3
  132. data/lib/spec/rails/extensions/object.rb +0 -5
  133. data/spec/rails/example/configuration_spec.rb +0 -83
  134. data/spec/rails/matchers/description_generation_spec.rb +0 -37
  135. data/spec/rails/spec_server_spec.rb +0 -96
  136. data/stories/all.rb +0 -10
  137. data/stories/configuration/stories.rb +0 -5
  138. data/stories/helper.rb +0 -6
  139. data/stories/steps/people.rb +0 -8
  140. data/stories/transactions_should_rollback.rb +0 -25
@@ -35,4 +35,12 @@ module ExplicitHelper
35
35
  def flash_thing
36
36
  flash[:thing]
37
37
  end
38
+
39
+ def method_using_output_buffer
40
+ concat("the_text_from_concat")
41
+ end
42
+
43
+ def method_using_template
44
+ update_page { |p| p["#some_id"].replace_html "" }
45
+ end
38
46
  end
@@ -0,0 +1,4 @@
1
+ class Animal < ActiveRecord::Base
2
+ belongs_to :person
3
+ validates_uniqueness_of :name
4
+ end
@@ -0,0 +1,18 @@
1
+ class Person < ActiveRecord::Base
2
+ has_many :animals do
3
+ def pups
4
+ find(:all, :conditions => 'age < 1')
5
+ end
6
+ def adults
7
+ find(:all, :conditions => 'age >= 1')
8
+ end
9
+ end
10
+ validates_presence_of :name
11
+
12
+ def add_animal animal
13
+ animal.person = self
14
+ animals << animal
15
+ animal.save
16
+ end
17
+
18
+ end
@@ -0,0 +1,3 @@
1
+ class Thing < ActiveRecord::Base
2
+ validates_presence_of :name
3
+ end
@@ -0,0 +1 @@
1
+ <%= params[:controller] %>
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper'
1
+ require File.dirname(__FILE__) + '/../../../spec_helper'
2
2
 
3
3
  describe "AssignsHashProxy" do
4
4
  def orig_assigns
@@ -0,0 +1,79 @@
1
+ require File.dirname(__FILE__) + '/../../../spec_helper'
2
+
3
+ module Spec
4
+ module Runner
5
+ describe Configuration do
6
+
7
+ def config
8
+ @config ||= Configuration.new
9
+ end
10
+
11
+ describe "#use_transactional_fixtures" do
12
+ it "should return #{Spec::Runner::Configuration::TEST_CASE}.use_transactional_fixtures" do
13
+ config.use_transactional_fixtures.should == Spec::Runner::Configuration::TEST_CASE.use_transactional_fixtures
14
+ end
15
+
16
+ it "should set #{Spec::Runner::Configuration::TEST_CASE}.use_transactional_fixtures to false" do
17
+ Configuration::EXAMPLE_GROUP_CLASSES.each do |example_group|
18
+ example_group.should_receive(:use_transactional_fixtures=).with(false)
19
+ end
20
+ config.use_transactional_fixtures = false
21
+ end
22
+
23
+ it "should set #{Spec::Runner::Configuration::TEST_CASE}.use_transactional_fixtures to true" do
24
+ Configuration::EXAMPLE_GROUP_CLASSES.each do |example_group|
25
+ example_group.should_receive(:use_transactional_fixtures=).with(true)
26
+ end
27
+ config.use_transactional_fixtures = true
28
+ end
29
+ end
30
+
31
+ describe "#use_instantiated_fixtures" do
32
+ it "should return #{Spec::Runner::Configuration::TEST_CASE}.use_transactional_fixtures" do
33
+ config.use_instantiated_fixtures.should == Spec::Runner::Configuration::TEST_CASE.use_instantiated_fixtures
34
+ end
35
+
36
+ it "should set #{Spec::Runner::Configuration::TEST_CASE}.use_instantiated_fixtures to false" do
37
+ Configuration::EXAMPLE_GROUP_CLASSES.each do |example_group|
38
+ example_group.should_receive(:use_instantiated_fixtures=).with(false)
39
+ end
40
+ config.use_instantiated_fixtures = false
41
+ end
42
+
43
+ it "should set #{Spec::Runner::Configuration::TEST_CASE}.use_instantiated_fixtures to true" do
44
+ Configuration::EXAMPLE_GROUP_CLASSES.each do |example_group|
45
+ example_group.should_receive(:use_instantiated_fixtures=).with(true)
46
+ end
47
+ config.use_instantiated_fixtures = true
48
+ end
49
+ end
50
+
51
+ describe "#fixture_path" do
52
+ it "should default to RAILS_ROOT + '/spec/fixtures'" do
53
+ config.fixture_path.should == RAILS_ROOT + '/spec/fixtures'
54
+ Configuration::EXAMPLE_GROUP_CLASSES.each do |example_group|
55
+ example_group.fixture_path.should == RAILS_ROOT + '/spec/fixtures'
56
+ end
57
+ end
58
+
59
+ it "should set fixture_path" do
60
+ config.fixture_path = "/new/path"
61
+ config.fixture_path.should == "/new/path"
62
+ Configuration::EXAMPLE_GROUP_CLASSES.each do |example_group|
63
+ example_group.fixture_path.should == "/new/path"
64
+ end
65
+ end
66
+ end
67
+
68
+ describe "#global_fixtures" do
69
+ it "should set fixtures on TestCase" do
70
+ Configuration::EXAMPLE_GROUP_CLASSES.each do |example_group|
71
+ example_group.should_receive(:fixtures).with(:blah)
72
+ end
73
+ config.global_fixtures = [:blah]
74
+ end
75
+ end
76
+
77
+ end
78
+ end
79
+ end
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper'
1
+ require File.dirname(__FILE__) + '/../../../spec_helper'
2
2
  require 'controller_spec_controller'
3
3
 
4
4
  describe "a controller spec running in isolation mode", :type => :controller do
@@ -21,10 +21,6 @@ describe "a controller spec running in integration mode", :type => :controller d
21
21
  controller_name :controller_spec
22
22
  integrate_views
23
23
 
24
- before(:each) do
25
- controller.class.send(:define_method, :rescue_action) { |e| raise e }
26
- end
27
-
28
24
  it "should render a template" do
29
25
  get 'action_with_template'
30
26
  response.should be_success
@@ -34,12 +30,10 @@ describe "a controller spec running in integration mode", :type => :controller d
34
30
  it "should choke if the template doesn't exist" do
35
31
  error = defined?(ActionController::MissingTemplate) ? ActionController::MissingTemplate : ActionView::MissingTemplate
36
32
  lambda { get 'some_action' }.should raise_error(error)
37
- response.should_not be_success
38
33
  end
39
34
 
40
35
  it "should choke if the template has errors" do
41
36
  lambda { get 'action_with_errors_in_template' }.should raise_error(ActionView::TemplateError)
42
- response.should_not be_success
43
37
  end
44
38
 
45
39
  describe "nested" do
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper'
1
+ require File.dirname(__FILE__) + '/../../../spec_helper'
2
2
  require 'controller_spec_controller'
3
3
 
4
4
  ['integration', 'isolation'].each do |mode|
@@ -6,8 +6,6 @@ require 'controller_spec_controller'
6
6
  controller_name :controller_spec
7
7
  integrate_views if mode == 'integration'
8
8
 
9
- specify "this example should be pending, not an error"
10
-
11
9
  it "should provide controller.session as session" do
12
10
  get 'action_with_template'
13
11
  session.should equal(controller.session)
@@ -144,15 +142,74 @@ require 'controller_spec_controller'
144
142
 
145
143
  it "should support a Symbol key" do
146
144
  get 'action_which_sets_cookie', :value => "cookie value"
147
- cookies[:cookie_key].value.should == ["cookie value"]
145
+ if Rails::VERSION::STRING >= "2.3"
146
+ cookies[:cookie_key].should == "cookie+value"
147
+ else
148
+ cookies[:cookie_key].should == ["cookie value"]
149
+ end
148
150
  end
149
151
 
150
152
  it "should support a String key" do
151
153
  get 'action_which_sets_cookie', :value => "cookie value"
152
- cookies['cookie_key'].value.should == ["cookie value"]
154
+ if Rails::VERSION::STRING >= "2.3"
155
+ cookies['cookie_key'].should == "cookie+value"
156
+ else
157
+ cookies['cookie_key'].should == ["cookie value"]
158
+ end
153
159
  end
154
160
 
155
161
  end
162
+
163
+ describe "with an error that is not rescued in the controller" do
164
+ context "without rails' error handling" do
165
+ it "raises the error" do
166
+ lambda do
167
+ get 'other_error_action'
168
+ end.should raise_error(ControllerSpecController::UnRescuedError)
169
+ end
170
+ end
171
+ context "with rails' error handling" do
172
+ it "does not raise the error" do
173
+ controller.use_rails_error_handling!
174
+ lambda do
175
+ get 'other_error_action'
176
+ end.should_not raise_error
177
+ end
178
+ end
179
+ end
180
+
181
+ if Rails::VERSION::MAJOR >= 2
182
+ describe "with an error that is rescued in the controller" do
183
+ context "without rails' error handling" do
184
+ it "does not raise error" do
185
+ lambda do
186
+ get 'rescued_error_action'
187
+ end.should_not raise_error
188
+ end
189
+
190
+ it "executes rescue_from" do
191
+ get 'rescued_error_action'
192
+ response.body.should == 'Rescued!'
193
+ end
194
+ end
195
+
196
+ context "with rails' error handling" do
197
+ before(:each) do
198
+ controller.use_rails_error_handling!
199
+ end
200
+ it "does not raise error" do
201
+ lambda do
202
+ get 'rescued_error_action'
203
+ end.should_not raise_error
204
+ end
205
+
206
+ it "executes rescue_from" do
207
+ get 'rescued_error_action'
208
+ response.body.should == 'Rescued!'
209
+ end
210
+ end
211
+ end
212
+ end
156
213
 
157
214
  it "should support custom routes" do
158
215
  route_for(:controller => "custom_route_spec", :action => "custom_route").should == "/custom_route"
@@ -276,4 +333,4 @@ module Spec
276
333
  end
277
334
  end
278
335
  end
279
- end
336
+ end
@@ -1,8 +1,9 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper'
1
+ require File.dirname(__FILE__) + '/../../../spec_helper'
2
2
 
3
3
  class CookiesProxyExamplesController < ActionController::Base
4
4
  def index
5
5
  cookies[:key] = cookies[:key]
6
+ render :text => ""
6
7
  end
7
8
  end
8
9
 
@@ -18,18 +19,26 @@ module Spec
18
19
  cookies = CookiesProxy.new(self)
19
20
  cookies['key'] = 'value'
20
21
  get :index
21
- cookies['key'].should == ['value']
22
+ if ::Rails::VERSION::STRING >= "2.3"
23
+ cookies['key'].should == 'value'
24
+ else
25
+ cookies['key'].should == ['value']
26
+ end
22
27
  end
23
28
 
24
- if Rails::VERSION::STRING >= "2.0.0"
29
+ if ::Rails::VERSION::STRING >= "2.0.0"
25
30
  it "should accept a Hash value" do
26
31
  cookies = CookiesProxy.new(self)
27
32
  cookies['key'] = { :value => 'value', :expires => expiration = 1.hour.from_now, :path => path = '/path' }
28
33
  get :index
29
- cookies['key'].should == ['value']
30
- cookies['key'].value.should == ['value']
31
- cookies['key'].expires.should == expiration
32
- cookies['key'].path.should == path
34
+ if ::Rails::VERSION::STRING >= "2.3"
35
+ cookies['key'].should == 'value'
36
+ else
37
+ cookies['key'].should == ['value']
38
+ cookies['key'].value.should == ['value']
39
+ cookies['key'].expires.should == expiration
40
+ cookies['key'].path.should == path
41
+ end
33
42
  end
34
43
  end
35
44
 
@@ -41,18 +50,26 @@ module Spec
41
50
  example_cookies = CookiesProxy.new(self)
42
51
  example_cookies[:key] = 'value'
43
52
  get :index
44
- example_cookies[:key].should == ['value']
53
+ if ::Rails::VERSION::STRING >= "2.3"
54
+ example_cookies[:key].should == 'value'
55
+ else
56
+ example_cookies[:key].should == ['value']
57
+ end
45
58
  end
46
59
 
47
- if Rails::VERSION::STRING >= "2.0.0"
60
+ if ::Rails::VERSION::STRING >= "2.0.0"
48
61
  it "should accept a Hash value" do
49
62
  example_cookies = CookiesProxy.new(self)
50
63
  example_cookies[:key] = { :value => 'value', :expires => expiration = 1.hour.from_now, :path => path = '/path' }
51
64
  get :index
52
- example_cookies[:key].should == ['value']
53
- example_cookies[:key].value.should == ['value']
54
- example_cookies[:key].expires.should == expiration
55
- example_cookies[:key].path.should == path
65
+ if ::Rails::VERSION::STRING >= "2.3"
66
+ example_cookies[:key].should == 'value'
67
+ else
68
+ example_cookies[:key].should == ['value']
69
+ example_cookies[:key].value.should == ['value']
70
+ example_cookies[:key].expires.should == expiration
71
+ example_cookies[:key].path.should == path
72
+ end
56
73
  end
57
74
  end
58
75
 
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper'
1
+ require File.dirname(__FILE__) + '/../../../spec_helper'
2
2
 
3
3
  module Spec
4
4
  module Example
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper'
1
+ require File.dirname(__FILE__) + '/../../../spec_helper'
2
2
  Spec::Runner.configuration.global_fixtures = :people
3
3
 
4
4
  describe ExplicitHelper, :type => :helper do
@@ -143,6 +143,33 @@ module Spec
143
143
  assigns[:addend].should == 3
144
144
  end
145
145
  end
146
+
147
+ if Rails::VERSION::MAJOR >= 2
148
+ describe HelperExampleGroup, "using a helper that uses output_buffer inside helper", :type => :helper do
149
+ helper_name :explicit
150
+
151
+ it "should not raise an error" do
152
+ lambda { method_using_output_buffer }.should_not raise_error
153
+ end
154
+
155
+ it "should put the output in the output_buffer" do
156
+ method_using_output_buffer
157
+ output_buffer.should == "the_text_from_concat"
158
+ end
159
+ end
160
+ end
161
+
162
+ describe HelperExampleGroup, "using a helper that tries to access @template", :type => :helper do
163
+ helper_name :explicit
164
+
165
+ it "should not raise an error" do
166
+ lambda { method_using_template }.should_not raise_error
167
+ end
168
+
169
+ it "should have the correct output" do
170
+ method_using_template.should have_text(/#some_id/)
171
+ end
172
+ end
146
173
  end
147
174
  end
148
175
  end