stub out some stuff in publics_controller
This commit is contained in:
parent
53dbff42ad
commit
ccf3b7d87b
1 changed files with 12 additions and 43 deletions
|
|
@ -27,53 +27,22 @@ describe PublicsController do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'success cases' do
|
context 'success cases' do
|
||||||
it 'should 200 on successful receipt of a request' do
|
before do
|
||||||
EM::run {
|
@person_mock = mock()
|
||||||
|
@user_mock = mock()
|
||||||
person_mock = mock()
|
@user_mock.stub!(:receive_salmon).and_return(true)
|
||||||
user_mock = mock()
|
@person_mock.stub!(:owner_id).and_return(true)
|
||||||
user_mock.stub!(:receive_salmon).and_return(true)
|
@person_mock.stub!(:owner).and_return(@user_mock)
|
||||||
user_mock.should_receive(:receive_salmon).and_return(true)
|
Person.stub!(:first).and_return(@person_mock)
|
||||||
person_mock.stub!(:owner_id).and_return(true)
|
|
||||||
person_mock.stub!(:owner).and_return(user_mock)
|
|
||||||
Person.stub!(:first).and_return(person_mock)
|
|
||||||
|
|
||||||
post :receive, :id =>user.person.id, :xml => xml
|
|
||||||
response.code.should == '200'
|
|
||||||
EM.stop
|
|
||||||
}
|
|
||||||
end
|
end
|
||||||
|
it 'should 200 on successful receipt of a request' do
|
||||||
it 'should set the user based on their person_id' do
|
post :receive, :id =>user.person.id, :xml => xml
|
||||||
|
response.code.should == '200'
|
||||||
EM::run {
|
|
||||||
|
|
||||||
person_mock = mock()
|
|
||||||
person_mock.stub!(:owner_id).and_return(true)
|
|
||||||
person_mock.stub!(:owner).and_return(user)
|
|
||||||
Person.stub!(:first).and_return(person_mock)
|
|
||||||
|
|
||||||
|
|
||||||
post :receive, :id => user.person.id, :xml => xml
|
|
||||||
assigns[:user].should == user
|
|
||||||
EM.stop
|
|
||||||
}
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should have the xml processed as salmon on success' do
|
it 'should have the xml processed as salmon on success' do
|
||||||
EM::run{
|
@user_mock.should_receive(:receive_salmon).and_return(true)
|
||||||
|
post :receive, :id => user.person.id, :xml => xml
|
||||||
person_mock = mock()
|
|
||||||
user_mock = mock()
|
|
||||||
user_mock.stub!(:receive_salmon).and_return(true)
|
|
||||||
person_mock.stub!(:owner_id).and_return(true)
|
|
||||||
person_mock.stub!(:owner).and_return(user_mock)
|
|
||||||
Person.stub!(:first).and_return(person_mock)
|
|
||||||
|
|
||||||
|
|
||||||
post :receive, :id => user.person.id, :xml => xml
|
|
||||||
EM.stop
|
|
||||||
}
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue