spec/models/uuids/uuid_spec.rb in uuids-0.0.1 vs spec/models/uuids/uuid_spec.rb in uuids-0.1.0

- old
+ new

@@ -15,11 +15,22 @@ end end describe "#value=" do - it "is private" do - expect { subject.value = SecureRandom.uuid }.to raise_error + let!(:subject) { build :uuid } + let!(:value) { SecureRandom.uuid } + + it "sets #value before creation" do + subject.value = value + subject.save! + expect { subject.reload }.not_to change { subject.value }.from value + end + + it "doesn't change #value after creation" do + subject.save! + expect { subject.update_attributes! value: value } + .not_to change { subject.reload } end end describe "#record=" do