Rspec: how can I check if a call to a method of another class is called?

You should not know where the method is called, just if the method is called.. You just know if the method is call:

Before RSpec 3

 it "should auto populate feed after user.add_friend" do
    FeedItem.should_receive(:populate_from_friend_to_user).with(@friend1, @user)
    @user.add_friend(@friend1)
 end

In RSpec 3 the syntax is

expect(Object).to receive(:method).with(params)

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)