has_guid.rb 323 B

123456789101112
  1. require 'rails_helper'
  2. shared_examples_for HasGuid do
  3. it "gets created before_save, but only if it's not present" do
  4. instance = new_instance
  5. expect(instance.guid).to be_nil
  6. instance.save!
  7. expect(instance.guid).not_to be_nil
  8. expect { instance.save! }.not_to change { instance.reload.guid }
  9. end
  10. end