diff options
| author | Robert | 2017-07-20 19:01:49 +0200 |
|---|---|---|
| committer | Robert | 2017-07-20 19:01:49 +0200 |
| commit | 4fffff70d5dc57929653ed1d1a1ce68e9769cee4 (patch) | |
| tree | 5bef175ac0e41776133535d264a68f1dbba40082 /spec/models | |
| parent | f8928e65d757414bde1c8a3b26c23b572f0e9221 (diff) | |
| download | chouette-core-4fffff70d5dc57929653ed1d1a1ce68e9769cee4.tar.bz2 | |
Refs: #3507@1h
Introduction of Presence Validation in Import model, for:
- workbench
- referential
Diffstat (limited to 'spec/models')
| -rw-r--r-- | spec/models/import_spec.rb | 5 | ||||
| -rw-r--r-- | spec/models/netex_import_spec.rb | 23 | ||||
| -rw-r--r-- | spec/models/workbench_import_spec.rb | 12 |
3 files changed, 7 insertions, 33 deletions
diff --git a/spec/models/import_spec.rb b/spec/models/import_spec.rb index 34bfb0b23..424936c58 100644 --- a/spec/models/import_spec.rb +++ b/spec/models/import_spec.rb @@ -1,11 +1,10 @@ -require 'rails_helper' - RSpec.describe Import, :type => :model do + subject{ build_stubbed :import } it { should belong_to(:referential) } it { should belong_to(:workbench) } it { should belong_to(:parent).class_name(described_class.to_s) } - it { should enumerize(:status).in(:new, :pending, :successful, :failed, :canceled, :running, :aborted ) } + it { should enumerize(:status).in("aborted", "analyzing", "canceled", "downloading", "failed", "new", "pending", "running", "successful") } it { should validate_presence_of(:file) } end diff --git a/spec/models/netex_import_spec.rb b/spec/models/netex_import_spec.rb index baffea456..066595f06 100644 --- a/spec/models/netex_import_spec.rb +++ b/spec/models/netex_import_spec.rb @@ -1,21 +1,4 @@ -RSpec.describe NetexImport do - - subject{ build :netex_import } - - it 'base case' do - expect_it.to be_valid - end - - context 'validates presence of' do - it 'referential' do - subject.referential_id = nil - expect_it.not_to be_valid - end - - - it 'workbench' do - subject.workbench_id = nil - expect_it.not_to be_valid - end - end +RSpec.describe NetexImport, type: :model do + it { should validate_presence_of(:referential) } + it { should validate_presence_of(:workbench) } end diff --git a/spec/models/workbench_import_spec.rb b/spec/models/workbench_import_spec.rb index 629973dca..24f3a2f85 100644 --- a/spec/models/workbench_import_spec.rb +++ b/spec/models/workbench_import_spec.rb @@ -1,12 +1,4 @@ RSpec.describe WorkbenchImport do - let( :workbench_import ){ build_stubbed :workbench_import } - - it 'is valid' do - expect( workbench_import ).to be_valid - end - - it 'or not...' do - expect( build_stubbed :workbench_import, status: 'what?' ).not_to be_valid - end - + it { should validate_presence_of(:referential) } + it { should validate_presence_of(:workbench) } end |
