rspec-rails 1.1.12 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +7 -0
- data/History.txt +55 -0
- data/License.txt +1 -1
- data/Manifest.txt +53 -48
- data/README.txt +5 -4
- data/Rakefile +9 -2
- data/TODO.txt +1 -0
- data/Upgrade.markdown +103 -0
- data/generators/rspec/rspec_generator.rb +1 -0
- data/generators/rspec/templates/rspec.rake +134 -111
- data/generators/rspec/templates/script/autospec +1 -0
- data/generators/rspec/templates/script/spec +21 -4
- data/generators/rspec/templates/script/spec_server +34 -107
- data/generators/rspec/templates/spec_helper.rb +1 -1
- data/generators/rspec_controller/rspec_controller_generator.rb +1 -5
- data/generators/rspec_scaffold/rspec_scaffold_generator.rb +13 -17
- data/generators/rspec_scaffold/templates/controller_spec.rb +27 -29
- data/generators/rspec_scaffold/templates/edit_erb_spec.rb +2 -2
- data/generators/rspec_scaffold/templates/helper_spec.rb +1 -1
- data/generators/rspec_scaffold/templates/index_erb_spec.rb +2 -2
- data/generators/rspec_scaffold/templates/new_erb_spec.rb +2 -2
- data/generators/rspec_scaffold/templates/routing_spec.rb +24 -20
- data/generators/rspec_scaffold/templates/show_erb_spec.rb +2 -2
- data/lib/spec/rails.rb +10 -9
- data/lib/spec/rails/example.rb +2 -2
- data/lib/spec/rails/example/assigns_hash_proxy.rb +1 -2
- data/lib/spec/rails/example/controller_example_group.rb +117 -123
- data/lib/spec/rails/example/functional_example_group.rb +7 -22
- data/lib/spec/rails/example/helper_example_group.rb +15 -33
- data/lib/spec/rails/example/model_example_group.rb +1 -1
- data/lib/spec/rails/example/render_observer.rb +0 -26
- data/lib/spec/rails/example/routing_example_group.rb +13 -0
- data/lib/spec/rails/example/routing_helpers.rb +68 -0
- data/lib/spec/rails/example/view_example_group.rb +50 -47
- data/lib/spec/rails/extensions.rb +2 -1
- data/lib/spec/rails/extensions/action_controller/rescue.rb +25 -8
- data/lib/spec/rails/extensions/action_controller/test_case.rb +16 -0
- data/lib/spec/rails/extensions/action_controller/test_response.rb +4 -3
- data/lib/spec/rails/extensions/action_view/base.rb +9 -9
- data/lib/spec/rails/extensions/active_record/base.rb +39 -23
- data/lib/spec/rails/extensions/active_support/test_case.rb +7 -0
- data/lib/spec/rails/extensions/spec/matchers/have.rb +8 -6
- data/lib/spec/rails/extensions/spec/runner/configuration.rb +12 -44
- data/lib/spec/rails/matchers/ar_be_valid.rb +8 -5
- data/lib/spec/rails/matchers/assert_select.rb +36 -21
- data/lib/spec/rails/matchers/have_text.rb +3 -3
- data/lib/spec/rails/matchers/include_text.rb +4 -4
- data/lib/spec/rails/matchers/redirect_to.rb +30 -19
- data/lib/spec/rails/matchers/render_template.rb +7 -3
- data/lib/spec/rails/mocks.rb +1 -1
- data/lib/spec/rails/spec_server.rb +97 -0
- data/lib/spec/rails/story_adapter.rb +4 -4
- data/lib/spec/rails/version.rb +2 -2
- data/spec/resources/controllers/controller_spec_controller.rb +14 -6
- data/spec/resources/controllers/example.txt +1 -0
- data/spec/resources/controllers/redirect_spec_controller.rb +4 -0
- data/spec/resources/controllers/render_spec_controller.rb +1 -1
- data/spec/resources/controllers/rjs_spec_controller.rb +1 -1
- data/spec/resources/helpers/explicit_helper.rb +1 -1
- data/spec/resources/views/controller_spec/{_partial.rhtml → _partial.html.erb} +0 -0
- data/spec/resources/views/controller_spec/{action_setting_flash_after_session_reset.rhtml → action_setting_flash_after_session_reset.html.erb} +0 -0
- data/spec/resources/views/controller_spec/{action_setting_flash_before_session_reset.rhtml → action_setting_flash_before_session_reset.html.erb} +0 -0
- data/spec/resources/views/controller_spec/{action_setting_the_assigns_hash.rhtml → action_setting_the_assigns_hash.html.erb} +0 -0
- data/spec/resources/views/controller_spec/{action_with_errors_in_template.rhtml → action_with_errors_in_template.html.erb} +0 -0
- data/spec/resources/views/controller_spec/{action_with_template.rhtml → action_with_template.html.erb} +0 -0
- data/spec/resources/views/layouts/{application.rhtml → application.html.erb} +0 -0
- data/spec/resources/views/layouts/{simple.rhtml → simple.html.erb} +0 -0
- data/spec/resources/views/render_spec/{_a_partial.rhtml → _a_partial.html.erb} +0 -0
- data/spec/resources/views/render_spec/{action_with_alternate_layout.rhtml → action_with_alternate_layout.html.erb} +0 -0
- data/spec/resources/views/rjs_spec/{_replacement_partial.rhtml → _replacement_partial.html.erb} +0 -0
- data/spec/resources/views/rjs_spec/{hide_div.rjs → hide_div.js.rjs} +0 -0
- data/spec/resources/views/rjs_spec/{hide_page_element.rjs → hide_page_element.js.rjs} +0 -0
- data/spec/resources/views/rjs_spec/{insert_html.rjs → insert_html.js.rjs} +0 -0
- data/spec/resources/views/rjs_spec/{replace.rjs → replace.js.rjs} +0 -0
- data/spec/resources/views/rjs_spec/{replace_html.rjs → replace_html.js.rjs} +0 -0
- data/spec/resources/views/rjs_spec/{replace_html_with_partial.rjs → replace_html_with_partial.js.rjs} +0 -0
- data/spec/resources/views/rjs_spec/{visual_effect.rjs → visual_effect.js.rjs} +0 -0
- data/spec/resources/views/rjs_spec/{visual_toggle_effect.rjs → visual_toggle_effect.js.rjs} +0 -0
- data/spec/resources/views/tag_spec/{no_tags.rhtml → no_tags.html.erb} +0 -0
- data/spec/resources/views/tag_spec/{single_div_with_no_attributes.rhtml → single_div_with_no_attributes.html.erb} +0 -0
- data/spec/resources/views/tag_spec/{single_div_with_one_attribute.rhtml → single_div_with_one_attribute.html.erb} +0 -0
- data/spec/resources/views/view_spec/{_partial.rhtml → _partial.html.erb} +0 -0
- data/spec/resources/views/view_spec/{_partial_used_twice.rhtml → _partial_used_twice.html.erb} +0 -0
- data/spec/resources/views/view_spec/{_partial_with_local_variable.rhtml → _partial_with_local_variable.html.erb} +0 -0
- data/spec/resources/views/view_spec/{_partial_with_sub_partial.rhtml → _partial_with_sub_partial.html.erb} +0 -0
- data/spec/resources/views/view_spec/{_spacer.rhtml → _spacer.html.erb} +0 -0
- data/spec/resources/views/view_spec/{accessor.rhtml → accessor.html.erb} +0 -0
- data/spec/resources/views/view_spec/{block_helper.rhtml → block_helper.html.erb} +0 -0
- data/spec/resources/views/view_spec/{entry_form.rhtml → entry_form.html.erb} +0 -0
- data/spec/resources/views/view_spec/{explicit_helper.rhtml → explicit_helper.html.erb} +0 -0
- data/spec/resources/views/view_spec/foo/{show.rhtml → show.html.erb} +0 -0
- data/spec/resources/views/view_spec/{implicit_helper.rhtml → implicit_helper.html.erb} +0 -0
- data/spec/resources/views/view_spec/{multiple_helpers.rhtml → multiple_helpers.html.erb} +0 -0
- data/spec/resources/views/view_spec/{should_not_receive.rhtml → should_not_receive.html.erb} +0 -0
- data/spec/resources/views/view_spec/{template_with_partial.rhtml → template_with_partial.html.erb} +0 -0
- data/spec/resources/views/view_spec/{template_with_partial_using_collection.rhtml → template_with_partial_using_collection.html.erb} +0 -0
- data/spec/resources/views/view_spec/{template_with_partial_with_array.rhtml → template_with_partial_with_array.html.erb} +0 -0
- data/spec/spec/rails/example/assigns_hash_proxy_spec.rb +18 -5
- data/spec/spec/rails/example/configuration_spec.rb +15 -29
- data/spec/spec/rails/example/{controller_spec_spec.rb → controller_example_group_spec.rb} +40 -96
- data/spec/spec/rails/example/cookies_proxy_spec.rb +32 -36
- data/spec/spec/rails/example/error_handling_spec.rb +90 -0
- data/spec/spec/rails/example/example_group_factory_spec.rb +5 -5
- data/spec/spec/rails/example/{helper_spec_spec.rb → helper_example_group_spec.rb} +45 -13
- data/spec/spec/rails/example/{model_spec_spec.rb → model_example_group_spec.rb} +3 -1
- data/spec/spec/rails/example/routing_example_group_spec.rb +9 -0
- data/spec/spec/rails/example/shared_routing_example_group_examples.rb +45 -0
- data/spec/spec/rails/example/test_unit_assertion_accessibility_spec.rb +1 -1
- data/spec/spec/rails/example/{view_spec_spec.rb → view_example_group_spec.rb} +44 -17
- data/spec/spec/rails/matchers/ar_be_valid_spec.rb +10 -0
- data/spec/spec/rails/matchers/assert_select_spec.rb +59 -60
- data/spec/spec/rails/matchers/have_text_spec.rb +12 -4
- data/spec/spec/rails/matchers/include_text_spec.rb +11 -13
- data/spec/spec/rails/matchers/redirect_to_spec.rb +224 -189
- data/spec/spec/rails/matchers/render_template_spec.rb +169 -158
- data/spec/spec/rails/spec_server_spec.rb +18 -7
- data/spec/spec_helper.rb +21 -9
- metadata +68 -53
- data/lib/spec/rails/example/rails_example_group.rb +0 -28
- data/lib/spec/rails/extensions/action_controller/base.rb +0 -14
- data/rspec-rails.gemspec +0 -36
- data/spec/resources/views/render_spec/some_action.rjs +0 -1
- data/spec/spec/rails/example/shared_behaviour_spec.rb +0 -16
- data/spec/spec/rails/extensions/action_controller_rescue_action_spec.rb +0 -57
@@ -4,21 +4,35 @@ module Spec
|
|
4
4
|
|
5
5
|
class RedirectTo #:nodoc:
|
6
6
|
|
7
|
+
include ActionController::StatusCodes
|
8
|
+
|
7
9
|
def initialize(request, expected)
|
8
10
|
@expected = expected
|
9
11
|
@request = request
|
10
12
|
end
|
11
13
|
|
12
|
-
def matches?(
|
14
|
+
def matches?(response_or_controller)
|
15
|
+
response = response_or_controller.respond_to?(:response) ?
|
16
|
+
response_or_controller.response :
|
17
|
+
response_or_controller
|
18
|
+
|
13
19
|
@redirected = response.redirect?
|
14
20
|
@actual = response.redirect_url
|
15
21
|
return false unless @redirected
|
22
|
+
|
23
|
+
if @expected_status
|
24
|
+
@actual_status = interpret_status(response.code.to_i)
|
25
|
+
@status_matched = @expected_status == @actual_status
|
26
|
+
else
|
27
|
+
@status_matched = true
|
28
|
+
end
|
29
|
+
|
16
30
|
if @expected.instance_of? Hash
|
17
31
|
return false unless @actual =~ %r{^\w+://#{@request.host}}
|
18
32
|
return false unless actual_redirect_to_valid_route
|
19
|
-
return actual_hash == expected_hash
|
33
|
+
return actual_hash == expected_hash && @status_matched
|
20
34
|
else
|
21
|
-
return @actual == expected_url
|
35
|
+
return @actual == expected_url && @status_matched
|
22
36
|
end
|
23
37
|
end
|
24
38
|
|
@@ -45,9 +59,14 @@ module Spec
|
|
45
59
|
|
46
60
|
def query_hash(url)
|
47
61
|
query = url.split("?", 2)[1] || ""
|
48
|
-
|
62
|
+
Rack::Utils.parse_query(query)
|
49
63
|
end
|
50
64
|
|
65
|
+
def with(options)
|
66
|
+
@expected_status = interpret_status(options[:status])
|
67
|
+
self
|
68
|
+
end
|
69
|
+
|
51
70
|
def expected_url
|
52
71
|
case @expected
|
53
72
|
when Hash
|
@@ -61,33 +80,25 @@ module Spec
|
|
61
80
|
end
|
62
81
|
end
|
63
82
|
|
64
|
-
def
|
83
|
+
def failure_message_for_should
|
65
84
|
if @redirected
|
66
|
-
|
85
|
+
if @status_matched
|
86
|
+
return %Q{expected redirect to #{@expected.inspect}, got redirect to #{@actual.inspect}}
|
87
|
+
else
|
88
|
+
return %Q{expected redirect to #{@expected.inspect} with status #{@expected_status}, got #{@actual_status}}
|
89
|
+
end
|
67
90
|
else
|
68
91
|
return %Q{expected redirect to #{@expected.inspect}, got no redirect}
|
69
92
|
end
|
70
93
|
end
|
71
94
|
|
72
|
-
def
|
95
|
+
def failure_message_for_should_not
|
73
96
|
return %Q{expected not to be redirected to #{@expected.inspect}, but was} if @redirected
|
74
97
|
end
|
75
98
|
|
76
99
|
def description
|
77
100
|
"redirect to #{@expected.inspect}"
|
78
101
|
end
|
79
|
-
|
80
|
-
class QueryParameterParser
|
81
|
-
def self.parse_query_parameters(query, request)
|
82
|
-
if defined?(CGIMethods)
|
83
|
-
CGIMethods.parse_query_parameters(query)
|
84
|
-
elsif defined?(ActionController::RequestParser)
|
85
|
-
ActionController::RequestParser.parse_query_parameters(query)
|
86
|
-
else
|
87
|
-
request.class.parse_query_parameters(query)
|
88
|
-
end
|
89
|
-
end
|
90
|
-
end
|
91
102
|
end
|
92
103
|
|
93
104
|
# :call-seq:
|
@@ -9,7 +9,11 @@ module Spec
|
|
9
9
|
@expected = expected
|
10
10
|
end
|
11
11
|
|
12
|
-
def matches?(
|
12
|
+
def matches?(response_or_controller)
|
13
|
+
response = response_or_controller.respond_to?(:response) ?
|
14
|
+
response_or_controller.response :
|
15
|
+
response_or_controller
|
16
|
+
|
13
17
|
if response.respond_to?(:rendered_file)
|
14
18
|
@actual = response.rendered_file
|
15
19
|
elsif response.respond_to?(:rendered)
|
@@ -32,11 +36,11 @@ module Spec
|
|
32
36
|
given_controller_path == expected_controller_path && given_file.match(expected_file)
|
33
37
|
end
|
34
38
|
|
35
|
-
def
|
39
|
+
def failure_message_for_should
|
36
40
|
"expected #{@expected.inspect}, got #{@actual.inspect}"
|
37
41
|
end
|
38
42
|
|
39
|
-
def
|
43
|
+
def failure_message_for_should_not
|
40
44
|
"expected not to render #{@expected.inspect}, but did"
|
41
45
|
end
|
42
46
|
|
data/lib/spec/rails/mocks.rb
CHANGED
@@ -17,7 +17,7 @@ module Spec
|
|
17
17
|
:errors => stub("errors", :count => 0)
|
18
18
|
})
|
19
19
|
m = mock("#{model_class.name}_#{id}", options_and_stubs)
|
20
|
-
m.
|
20
|
+
m.__send__(:__mock_proxy).instance_eval <<-CODE
|
21
21
|
def @target.as_new_record
|
22
22
|
self.stub!(:id).and_return nil
|
23
23
|
self.stub!(:to_param).and_return nil
|
@@ -0,0 +1,97 @@
|
|
1
|
+
require 'drb/drb'
|
2
|
+
require 'rbconfig'
|
3
|
+
|
4
|
+
# This is based on Florian Weber's TDDMate
|
5
|
+
module Spec
|
6
|
+
module Rails
|
7
|
+
class SpecServer
|
8
|
+
class << self
|
9
|
+
def restart_test_server
|
10
|
+
puts "restarting"
|
11
|
+
config = ::Config::CONFIG
|
12
|
+
ruby = File::join(config['bindir'], config['ruby_install_name']) + config['EXEEXT']
|
13
|
+
command_line = [ruby, $0, ARGV].flatten.join(' ')
|
14
|
+
exec(command_line)
|
15
|
+
end
|
16
|
+
|
17
|
+
def daemonize(pid_file = nil)
|
18
|
+
return yield if $DEBUG
|
19
|
+
pid = Process.fork{
|
20
|
+
Process.setsid
|
21
|
+
Dir.chdir(RAILS_ROOT)
|
22
|
+
trap("SIGINT"){ exit! 0 }
|
23
|
+
trap("SIGTERM"){ exit! 0 }
|
24
|
+
trap("SIGHUP"){ restart_test_server }
|
25
|
+
File.open("/dev/null"){|f|
|
26
|
+
STDERR.reopen f
|
27
|
+
STDIN.reopen f
|
28
|
+
STDOUT.reopen f
|
29
|
+
}
|
30
|
+
run
|
31
|
+
}
|
32
|
+
puts "spec_server launched (PID: %d)" % pid
|
33
|
+
File.open(pid_file,"w"){|f| f.puts pid } if pid_file
|
34
|
+
exit! 0
|
35
|
+
end
|
36
|
+
|
37
|
+
def run
|
38
|
+
trap("USR2") { ::Spec::Rails::SpecServer.restart_test_server } if Signal.list.has_key?("USR2")
|
39
|
+
DRb.start_service("druby://127.0.0.1:8989", ::Spec::Rails::SpecServer.new)
|
40
|
+
DRb.thread.join
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def run(argv, stderr, stdout)
|
45
|
+
$stdout = stdout
|
46
|
+
$stderr = stderr
|
47
|
+
|
48
|
+
::Rails::Configuration.extend Module.new {def cache_classes; false; end}
|
49
|
+
|
50
|
+
::ActiveSupport.const_defined?(:Dependencies) ?
|
51
|
+
::ActiveSupport::Dependencies.mechanism = :load :
|
52
|
+
::Dependencies.mechanism = :load
|
53
|
+
|
54
|
+
require 'action_controller/dispatcher'
|
55
|
+
dispatcher = ::ActionController::Dispatcher.new($stdout)
|
56
|
+
|
57
|
+
if ::ActionController::Dispatcher.respond_to?(:reload_application)
|
58
|
+
::ActionController::Dispatcher.reload_application
|
59
|
+
else
|
60
|
+
dispatcher.reload_application
|
61
|
+
end
|
62
|
+
|
63
|
+
if Object.const_defined?(:Fixtures) && Fixtures.respond_to?(:reset_cache)
|
64
|
+
Fixtures.reset_cache
|
65
|
+
end
|
66
|
+
|
67
|
+
unless Object.const_defined?(:ApplicationController)
|
68
|
+
%w(application_controller.rb application.rb).each do |name|
|
69
|
+
require_dependency(name) if File.exists?("#{RAILS_ROOT}/app/controllers/#{name}")
|
70
|
+
end
|
71
|
+
end
|
72
|
+
load "#{RAILS_ROOT}/spec/spec_helper.rb"
|
73
|
+
|
74
|
+
if in_memory_database?
|
75
|
+
load "#{RAILS_ROOT}/db/schema.rb"
|
76
|
+
ActiveRecord::Migrator.up('db/migrate')
|
77
|
+
end
|
78
|
+
|
79
|
+
::Spec::Runner::CommandLine.run(
|
80
|
+
::Spec::Runner::OptionParser.parse(
|
81
|
+
argv,
|
82
|
+
$stderr,
|
83
|
+
$stdout
|
84
|
+
)
|
85
|
+
)
|
86
|
+
|
87
|
+
dispatcher.cleanup_application if dispatcher.respond_to?(:cleanup_application)
|
88
|
+
end
|
89
|
+
|
90
|
+
def in_memory_database?
|
91
|
+
ENV["RAILS_ENV"] == "test" and
|
92
|
+
::ActiveRecord::Base.connection.class.to_s == "ActiveRecord::ConnectionAdapters::SQLite3Adapter" and
|
93
|
+
::Rails::Configuration.new.database_configuration['test']['database'] == ':memory:'
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
@@ -14,8 +14,8 @@ require 'spec/rails'
|
|
14
14
|
|
15
15
|
Test::Unit.run = true
|
16
16
|
|
17
|
-
ActionController::Integration::Session.
|
18
|
-
ActionController::Integration::Session.
|
17
|
+
ActionController::Integration::Session.__send__ :include, Spec::Matchers
|
18
|
+
ActionController::Integration::Session.__send__ :include, Spec::Rails::Matchers
|
19
19
|
|
20
20
|
class RailsStory < ActionController::IntegrationTest
|
21
21
|
if defined?(ActiveRecord::Base)
|
@@ -43,7 +43,7 @@ class ActiveRecordSafetyListener
|
|
43
43
|
if ActiveRecord::Base.connection.respond_to?(:increment_open_transactions)
|
44
44
|
ActiveRecord::Base.connection.increment_open_transactions
|
45
45
|
else
|
46
|
-
ActiveRecord::Base.
|
46
|
+
ActiveRecord::Base.__send__ :increment_open_transactions
|
47
47
|
end
|
48
48
|
end
|
49
49
|
ActiveRecord::Base.connection.begin_db_transaction
|
@@ -55,7 +55,7 @@ class ActiveRecordSafetyListener
|
|
55
55
|
if ActiveRecord::Base.connection.respond_to?(:decrement_open_transactions)
|
56
56
|
ActiveRecord::Base.connection.decrement_open_transactions
|
57
57
|
else
|
58
|
-
ActiveRecord::Base.
|
58
|
+
ActiveRecord::Base.__send__ :decrement_open_transactions
|
59
59
|
end
|
60
60
|
end
|
61
61
|
end
|
data/lib/spec/rails/version.rb
CHANGED
@@ -7,7 +7,7 @@ class ControllerSpecController < ActionController::Base
|
|
7
7
|
|
8
8
|
skip_before_filter :raise_error
|
9
9
|
|
10
|
-
|
10
|
+
prepend_view_path File.join(File.dirname(__FILE__), "..", "views")
|
11
11
|
|
12
12
|
def some_action
|
13
13
|
render :template => "template/that/does/not/actually/exist"
|
@@ -82,25 +82,33 @@ class ControllerSpecController < ActionController::Base
|
|
82
82
|
render :text => ""
|
83
83
|
end
|
84
84
|
|
85
|
+
def action_that_renders_inline
|
86
|
+
render :inline => "<%= 'inline code' %>"
|
87
|
+
end
|
88
|
+
|
85
89
|
def action_that_assigns_false_to_a_variable
|
86
90
|
@a_variable = false
|
87
91
|
render :text => ""
|
88
92
|
end
|
89
93
|
|
94
|
+
def action_with_two_arg_render
|
95
|
+
render :update, :status => 404 do |page|
|
96
|
+
page.visual_effect :highlight, 'user_list'
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
90
100
|
class RescuedError < Exception; end
|
91
101
|
class UnRescuedError < Exception; end
|
92
102
|
|
93
|
-
|
94
|
-
|
95
|
-
render :text => 'Rescued!'
|
96
|
-
end
|
103
|
+
rescue_from RescuedError do |e|
|
104
|
+
render :text => 'Rescued!'
|
97
105
|
end
|
98
106
|
|
99
107
|
def rescued_error_action
|
100
108
|
raise RescuedError
|
101
109
|
end
|
102
110
|
|
103
|
-
def
|
111
|
+
def un_rescued_error_action
|
104
112
|
raise UnRescuedError
|
105
113
|
end
|
106
114
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
This is an example file to download.
|
@@ -62,5 +62,9 @@ class RedirectSpecController < ApplicationController
|
|
62
62
|
def action_to_redirect_to_action_with_method_restriction
|
63
63
|
redirect_to :action => 'action_with_method_restriction'
|
64
64
|
end
|
65
|
+
|
66
|
+
def action_with_redirect_to_somewhere_with_status
|
67
|
+
redirect_to :action => 'somewhere', :status => 301
|
68
|
+
end
|
65
69
|
end
|
66
70
|
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/spec/resources/views/rjs_spec/{_replacement_partial.rhtml → _replacement_partial.html.erb}
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/spec/resources/views/view_spec/{_partial_used_twice.rhtml → _partial_used_twice.html.erb}
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/spec/resources/views/view_spec/{should_not_receive.rhtml → should_not_receive.html.erb}
RENAMED
File without changes
|
data/spec/resources/views/view_spec/{template_with_partial.rhtml → template_with_partial.html.erb}
RENAMED
File without changes
|
File without changes
|
File without changes
|
@@ -5,14 +5,27 @@ describe "AssignsHashProxy" do
|
|
5
5
|
@object.assigns
|
6
6
|
end
|
7
7
|
|
8
|
+
class Foo
|
9
|
+
def initialize(bar)
|
10
|
+
@bar = bar
|
11
|
+
end
|
12
|
+
attr_reader :bar
|
13
|
+
|
14
|
+
def ==(other)
|
15
|
+
self.bar == other.bar
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
8
19
|
before(:each) do
|
9
20
|
@object = Class.new do
|
10
|
-
|
21
|
+
def assigns; @assigns ||= Hash.new; end
|
11
22
|
end.new
|
12
|
-
@
|
13
|
-
|
14
|
-
|
15
|
-
|
23
|
+
@proxy = Spec::Rails::Example::AssignsHashProxy.new(self) {@object}
|
24
|
+
end
|
25
|
+
|
26
|
+
it "doesn't wig out on objects that define their own == method" do
|
27
|
+
@object.assigns['foo'] = Foo.new(1)
|
28
|
+
@proxy['foo'].should == Foo.new(1)
|
16
29
|
end
|
17
30
|
|
18
31
|
it "should set ivars on object using string" do
|