Guest User

Untitled

a guest
Jul 15th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. it 'should notify user and add to leader board if user is an expert' do
  2. user = mock_model(User, :is_expert? => true)
  3. topic = mock_model(Topic, :id => 1)
  4. collection = mock('col')
  5. collection.should_receive(:<<).with(user)
  6. topic.should_receive(:experts).and_return(collection)
  7. user.should_receive(:notify_about_topic!).with(topic)
  8. User.should_receive(:find).with(1).and_return(user)
  9. Topic.should_receive(:find).with(1).and_return(topic)
  10. post :notify, :topic_id => topic.id, :id => 1, :format => 'js'
  11. response.should be_succes
  12. assigns(:user).should == user
  13. end
Add Comment
Please, Sign In to add comment