diff options
Diffstat (limited to 'spec/models')
| -rw-r--r-- | spec/models/concerns/error_format_spec.rb | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/spec/models/concerns/error_format_spec.rb b/spec/models/concerns/error_format_spec.rb index 7f7df22b6..9b0110bcd 100644 --- a/spec/models/concerns/error_format_spec.rb +++ b/spec/models/concerns/error_format_spec.rb @@ -3,18 +3,20 @@ RSpec.describe ErrorFormat do context '#details' do context 'are empty' do it 'if no errors are present' do - expect( described_class.details(create :referential) ).to be_empty + expect( + described_class.details(build_stubbed(:referential)) + ).to be_empty end it 'if no validation has been carried out' do - invalid = build :referential, name: nil + invalid = build_stubbed(:referential, name: nil) expect( described_class.details(invalid) ).to be_empty end end context 'are not empty' do it 'if an error is present and validation has been carried out' do - invalid = build :referential, name: nil + invalid = build_stubbed(:referential, name: nil) expect( invalid ).not_to be_valid expect( described_class.details(invalid) ).to eq([ {name: {error: 'doit ĂȘtre rempli(e)', value: nil}} @@ -22,8 +24,12 @@ RSpec.describe ErrorFormat do end it 'and can even hold many errors' do - create :referential, name: 'hello' - invalid = build :referential, name: 'hello', slug: 'hello world' + create(:referential, name: 'hello') + invalid = build_stubbed( + :referential, + name: 'hello', + slug: 'hello world' + ) expect( invalid ).not_to be_valid expect( described_class.details(invalid) ).to eq([ {name: {error: "n'est pas disponible", value: 'hello'}}, |
