spec/emotions/emotion_spec.rb in emotions-0.3 vs spec/emotions/emotion_spec.rb in emotions-0.3.1
- old
+ new
@@ -19,57 +19,57 @@
describe :Validations do
describe :validate_presence_of_emotional do
subject { Emotion.new(emotion: 'happy', emotive: Picture.create) }
before { subject.valid? }
- it { should_not be_valid }
- it { expect(subject.errors.full_messages).to eql ["Emotional can't be blank", "Emotional is invalid"] }
+ it { expect(subject).not_to be_valid }
+ it { expect(subject.errors.full_messages).to eql ['Emotional can\'t be blank', 'Emotional is invalid'] }
end
describe :validate_presence_of_emotive do
subject { Emotion.new(emotion: 'happy', emotional: User.create) }
before { subject.valid? }
- it { should_not be_valid }
- it { expect(subject.errors.full_messages).to eql ["Emotive can't be blank", "Emotive is invalid"] }
+ it { expect(subject).not_to be_valid }
+ it { expect(subject.errors.full_messages).to eql ['Emotive can\'t be blank', 'Emotive is invalid'] }
end
describe :validate_inclusion_of_emotion do
subject { Emotion.new(emotion: 'mad', emotional: User.create, emotive: Picture.create) }
before { subject.valid? }
- it { should_not be_valid }
- it { expect(subject.errors.full_messages).to eql ["Emotion is invalid"] }
+ it { expect(subject).not_to be_valid }
+ it { expect(subject.errors.full_messages).to eql ['Emotion is invalid'] }
end
describe :validate_class_of_emotive do
subject { Emotion.new(emotion: 'happy', emotional: User.create, emotive: User.create) }
before { subject.valid? }
- it { should_not be_valid }
- it { expect(subject.errors.full_messages).to eql ["Emotive is invalid"] }
+ it { expect(subject).not_to be_valid }
+ it { expect(subject.errors.full_messages).to eql ['Emotive is invalid'] }
end
describe :validate_class_of_emotional do
subject { Emotion.new(emotion: 'happy', emotional: Picture.create, emotive: Picture.create) }
before { subject.valid? }
- it { should_not be_valid }
- it { expect(subject.errors.full_messages).to eql ["Emotional is invalid"] }
+ it { expect(subject).not_to be_valid }
+ it { expect(subject.errors.full_messages).to eql ['Emotional is invalid'] }
end
end
describe :Callbacks do
describe :update_emotion_counter_on_create do
let(:picture) { Picture.create }
let(:user) { User.create }
let(:emotion) { Emotion.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
+ expect(picture).to receive(:update_emotion_counter).with('happy').once
+ expect(user).to receive(:update_emotion_counter).with('happy').once
+ expect(emotion).to receive(:update_emotion_counter).once.and_call_original
end
it { emotion.save! }
end
@@ -78,12 +78,12 @@
let(:user) { User.create }
let(:emotion) { Emotion.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
+ expect(picture).to receive(:update_emotion_counter).with('happy').once
+ expect(user).to receive(:update_emotion_counter).with('happy').once
+ expect(emotion).to receive(:update_emotion_counter).once.and_call_original
end
it { emotion.destroy }
end
end