Skip to content
Browse files

Fixed extended example group behaviour when declared using the #conte…

…xt alias.
  • Loading branch information...
1 parent f0fff81 commit 3e37f949c282c925e1575e8eb8020d74140ca2ba Tibor Claassen committed with josevalim
View
1 .gitignore
@@ -16,3 +16,4 @@ lib/remarkable-more.rb
./gems
*.diff
memory
+*.tmproj
View
7 remarkable_rails/lib/remarkable_rails/action_controller/macro_stubs.rb
@@ -184,6 +184,11 @@ def self.included(base) #:nodoc:
base.class_inheritable_reader :expects_chain, :default_action, :default_mime,
:default_verb, :default_params, :default_xhr,
:before_all_block
+ base.class_eval do
+ class << self
+ alias_method :context, :describe
+ end
+ end
end
module ClassMethods
@@ -400,7 +405,7 @@ def describe(*args, &block)
instance_eval(&block)
end
end
-
+
# Creates mock methods automatically.
#
# == Options
View
30 remarkable_rails/spec/action_controller/macro_stubs_spec.rb
@@ -216,25 +216,27 @@ def current_id; '37'; end
@controller.send(:performed?).should_not be_true
end
- describe Mime::XML do
- expects :to_xml, :on => task_proc, :returns => 'XML'
+ [:describe, :context].each do |method|
+ send method, Mime::XML do
+ expects :to_xml, :on => task_proc, :returns => 'XML'
- it 'should provide a description based on the mime given in describe' do
- self.class.description.should =~ /with xml$/
- end
+ it "should provide a description based on the mime given in #{method}" do
+ self.class.description.should =~ /with xml$/
+ end
- it 'should run action based on inherited declarations' do
- @controller.send(:performed?).should_not be_true
+ it 'should run action based on inherited declarations' do
+ @controller.send(:performed?).should_not be_true
- run_action!
+ run_action!
- @controller.action_name.should == 'show'
- @controller.request.method.should == :get
- @controller.send(:performed?).should be_true
- @controller.response.body.should == 'XML'
- @request.parameters[:special_task_id].should == '42'
+ @controller.action_name.should == 'show'
+ @controller.request.method.should == :get
+ @controller.send(:performed?).should be_true
+ @controller.response.body.should == 'XML'
+ @request.parameters[:special_task_id].should == '42'
+ end
end
- end
+ end
describe 'and running actions in a before(:all) filter' do
get :show, :id => 37

0 comments on commit 3e37f94

Please sign in to comment.
Something went wrong with that request. Please try again.