Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

61 lines (36 sloc) 1.453 kb
require 'test_helper'
module Emotions
class IntegrationTestEmotionsEmotion < MiniTest::Integration::TestCase
def test_emotions_do_not_exist_until_persisted
example_object = ExampleObject.new
example_object.id = 123
example_target = ExampleTarget.new
example_target.id = 456
emotion = Emotion.new(object: example_object, target: example_target, emotion: :example)
refute emotion.exists?
end
def test_emotions_exist_once_persisted
example_object = ExampleObject.new
example_object.id = 123
example_target = ExampleTarget.new
example_target.id = 456
emotion_one = Emotion.new(object: example_object, target: example_target, emotion: :example)
refute emotion_one.exists?
assert emotion_one.persist
assert emotion_one.exists?
end
def test_emotions_that_are_the_same_can_be_treated_as_equal
example_object = ExampleObject.new
example_object.id = 123
example_target = ExampleTarget.new
example_target.id = 456
emotion_one = Emotion.new(object: example_object, target: example_target, emotion: :example)
emotion_two = Emotion.new(object: example_object, target: example_target, emotion: :example)
refute emotion_one.exists?
refute emotion_two.exists?
[emotion_one, emotion_two].sample.persist
assert emotion_one.exists?
assert emotion_two.exists?
end
end
end
Jump to Line
Something went wrong with that request. Please try again.