From 0de87c19c68a43ee9bd9ff959760d61475760ddf Mon Sep 17 00:00:00 2001 From: rgarcia Date: Fri, 15 Sep 2017 15:55:35 +0200 Subject: [PATCH] fixes flaky spec Maybe using `build` instead of `create` was confusing the spec --- spec/models/geozone_spec.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spec/models/geozone_spec.rb b/spec/models/geozone_spec.rb index 1a7bf6b09..0eeb331b7 100644 --- a/spec/models/geozone_spec.rb +++ b/spec/models/geozone_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -RSpec.describe Geozone, type: :model do +describe Geozone do let(:geozone) { build(:geozone) } it "should be valid" do @@ -13,6 +13,8 @@ RSpec.describe Geozone, type: :model do end describe "#safe_to_destroy?" do + let(:geozone) { create(:geozone) } + it "is true when not linked to other models" do expect(geozone.safe_to_destroy?).to be_truthy end