spec/emotions/emotion_spec.rb in emotions-0.2.1 vs spec/emotions/emotion_spec.rb in emotions-0.2.2
- old
+ new
@@ -59,26 +59,30 @@
end
describe :Callbacks do
describe :update_emotion_counter_on_create do
let(:picture) { Picture.create }
- let(:emotion) { described_class.new(emotion: 'happy', emotional: User.create, emotive: picture) }
+ let(:user) { User.create }
+ let(:emotion) { described_class.new(emotion: 'happy', emotional: user, emotive: picture) }
before do
picture.should_receive(:update_emotion_counter).with('happy').once
+ user.should_receive(:update_emotion_counter).with('happy').once
emotion.should_receive(:update_emotion_counter).once.and_call_original
end
it { emotion.save! }
end
describe :update_emotion_counter_on_destroy do
let(:picture) { Picture.create }
- let(:emotion) { described_class.new(emotion: 'happy', emotional: User.create, emotive: picture) }
+ let(:user) { User.create }
+ let(:emotion) { described_class.new(emotion: 'happy', emotional: user, emotive: picture) }
before do
emotion.save!
picture.should_receive(:update_emotion_counter).with('happy').once
+ user.should_receive(:update_emotion_counter).with('happy').once
emotion.should_receive(:update_emotion_counter).once.and_call_original
end
it { emotion.destroy }
end