Skip to content

Instantly share code, notes, and snippets.

@kidpollo
Created November 24, 2010 02:55
Show Gist options
  • Save kidpollo/713016 to your computer and use it in GitHub Desktop.
Save kidpollo/713016 to your computer and use it in GitHub Desktop.
it 'should notify user and add to leader board if user is an expert' do
user = mock_model(User, :is_expert? => true)
topic = mock_model(Topic, :id => 1)
collection = mock('col')
collection.should_receive(:<<).with(user)
topic.should_receive(:experts).and_return(collection)
user.should_receive(:notify_about_topic!).with(topic)
User.should_receive(:find).with(1).and_return(user)
Topic.should_receive(:find).with(1).and_return(topic)
post :notify, :topic_id => topic.id, :id => 1, :format => 'js'
response.should be_succes
assigns(:user).should == user
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment