[rspec-devel] [ rspec-Feature Requests-6560 ] controller.session should be available before the action
noreply at rubyforge.org
noreply at rubyforge.org
Wed Nov 8 05:26:41 EST 2006
Feature Requests item #6560, was opened at 2006-11-08 10:26
You can respond by visiting:
http://rubyforge.org/tracker/?func=detail&atid=3152&aid=6560&group_id=797
Category: None
Group: None
Status: Open
Priority: 3
Submitted By: David Chelimsky (dchelimsky)
Assigned to: Nobody (None)
Summary: controller.session should be available before the action
Initial Comment:
controller specs expose "session" before and after an action, but "controller.session" is only available afterwards.
['integration', 'isolation'].each do |mode|
context "Given a controller spec running in #{mode} mode", :context_type => :controller do
controller_name :controller_isolation_spec
integrate_views if mode == 'integration'
specify "session should be the same object as controller session" do
get 'action_with_implied_template'
session.should_equal controller.session
end
specify "session should be the same object before and after the action" do
session_before = session
get 'action_with_implied_template'
session.should_equal session_before
end
specify "controller.session should NOT be nil before the action" do
controller.session.should_not_be nil
get 'action_with_implied_template'
end
specify "controller.session should NOT be nil before the action" do
get 'action_with_implied_template'
controller.session.should_not_be nil
end
end
end
bin/spec vendor/rspec_on_rails/vendor/plugins/rspec/spec/controller_spec_spec.rb -fs
Given a controller spec running in integration mode
- session should be the same object as controller session
- session should be the same object before and after the action
- controller.session should NOT be nil before the action (FAILED - 1)
- controller.session should NOT be nil before the action
Given a controller spec running in isolation mode
- session should be the same object as controller session
- session should be the same object before and after the action
- controller.session should NOT be nil before the action (FAILED - 2)
- controller.session should NOT be nil before the action
1)
Spec::Expectations::ExpectationNotMetError in 'Given a controller spec running in integration mode controller.session should NOT be nil before the action'
nil should not be nil
./vendor/rspec_on_rails/vendor/plugins/rspec/spec/controller_spec_spec.rb:20:in `controller.session should NOT be nil before the action'
2)
Spec::Expectations::ExpectationNotMetError in 'Given a controller spec running in isolation mode controller.session should NOT be nil before the action'
nil should not be nil
./vendor/rspec_on_rails/vendor/plugins/rspec/spec/controller_spec_spec.rb:20:in `controller.session should NOT be nil before the action'
Finished in 0.188877 seconds
8 specifications, 2 failures
----------------------------------------------------------------------
You can respond by visiting:
http://rubyforge.org/tracker/?func=detail&atid=3152&aid=6560&group_id=797
More information about the rspec-devel
mailing list