diff options
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/models/clean_up_spec.rb | 20 | 
1 files changed, 20 insertions, 0 deletions
| diff --git a/spec/models/clean_up_spec.rb b/spec/models/clean_up_spec.rb index afd2d8721..cf15ab934 100644 --- a/spec/models/clean_up_spec.rb +++ b/spec/models/clean_up_spec.rb @@ -264,4 +264,24 @@ RSpec.describe CleanUp, :type => :model do        }      end    end + +  describe "#destroy_routes_outside_referential" do +    let(:line_referential) { create(:line_referential) } +    let(:line) { create(:line, line_referential: line_referential) } +    let(:metadata) { create(:referential_metadata, lines: [line]) } +    let(:referential) { create(:workbench_referential, metadatas: [metadata]) } +    let(:cleaner) { create(:clean_up, referential: referential) } + +    it "destroys routes not in the the referential" do +      route = create(:route) + +      cleaner.destroy_routes_outside_referential + +      expect(Chouette::Route.exists?(route.id)).to be false + +      line.routes.each do |route| +        expect(route).not_to be_destroyed +      end +    end +  end  end | 
