spec/zertico/controller_spec.rb in zertico-0.3.1 vs spec/zertico/controller_spec.rb in zertico-0.4.0
- old
+ new
@@ -18,13 +18,26 @@
it 'should extend it!' do
user_controller.should respond_to :user
end
end
+ context 'with a custom object to respond' do
+ before :each do
+ controller.stub(:all).and_return({ :user => 'user', :responder => 'admin' })
+ controller.stub(:respond_with)
+ controller.index
+ end
+
+ it 'should intialize an object with it' do
+ controller.instance_variable_get('@responder').should == 'admin'
+ end
+ end
+
context '#index' do
before :each do
controller.stub(:all).and_return({ :user => 'user' })
+ controller.stub(:respond_with)
controller.index
end
it 'should initialize a collection of objects' do
controller.instance_variable_get('@user').should == 'user'
@@ -32,10 +45,11 @@
end
context '#new' do
before :each do
controller.stub(:build).and_return({ :user => 'user' })
+ controller.stub(:respond_with)
controller.new
end
it 'should initialize an object' do
controller.instance_variable_get('@user').should == 'user'
@@ -44,10 +58,11 @@
context '#show' do
before :each do
controller.stub(:params).and_return({ :id => 1 })
controller.stub(:find).and_return({ :user => 'user' })
+ controller.stub(:respond_with)
controller.show
end
it 'should initialize an object' do
controller.instance_variable_get('@user').should == 'user'
@@ -56,9 +71,10 @@
context '#edit' do
before :each do
controller.stub(:params).and_return({ :id => 1 })
controller.stub(:find).and_return({ :user => 'user' })
+ controller.stub(:respond_with)
controller.edit
end
it 'should initialize an object' do
controller.instance_variable_get('@user').should == 'user'
\ No newline at end of file