diff options
| author | Robert | 2017-09-11 09:41:03 +0200 | 
|---|---|---|
| committer | Robert | 2017-09-11 17:15:49 +0200 | 
| commit | f7bc874de79ff9a68aa03523cf653407663e7c55 (patch) | |
| tree | 1716586822ad9b9912e44f658193e5c1aea04e88 /spec/controllers/routes_controller_spec.rb | |
| parent | 003c4689248673fbc8922a107475caa9e059bcab (diff) | |
| download | chouette-core-f7bc874de79ff9a68aa03523cf653407663e7c55.tar.bz2 | |
Fixes #4189@4h Route Duplication
* Duplication of Route is triggered by link and UI forwarded to edit of duplicatee
     - Changing route, only POST duplicate_referential_line_route --> RoutesController#duplicate
     - Removing route       GET  duplicate_referential_line_route --> RoutesController#duplicate
     - Removing controller action RoutesController#post_duplicate
* Link in Route Decorator depends on new policy RoutePolicy#decorate?
* Adapting specs
Diffstat (limited to 'spec/controllers/routes_controller_spec.rb')
| -rw-r--r-- | spec/controllers/routes_controller_spec.rb | 27 | 
1 files changed, 9 insertions, 18 deletions
| diff --git a/spec/controllers/routes_controller_spec.rb b/spec/controllers/routes_controller_spec.rb index 3862d8173..336f20945 100644 --- a/spec/controllers/routes_controller_spec.rb +++ b/spec/controllers/routes_controller_spec.rb @@ -1,3 +1,5 @@ +Route = Chouette::Route +  RSpec.describe RoutesController, type: :controller do    login_user @@ -75,31 +77,20 @@ RSpec.describe RoutesController, type: :controller do      end    end -  describe "GET /duplicate" do -    it "returns success" do -      get :duplicate, -        referential_id: route.line.line_referential_id, -        line_id: route.line_id, -        id: route.id - -      expect(response).to be_success -    end -  end    describe "POST /duplicate" do +    let!( :route_prime ){ route } +      it "creates a new route" do        expect do          post :duplicate,            referential_id: route.line.line_referential_id,            line_id: route.line_id, -          id: route.id, -          params: { -            name: '102 Route', -            published_name: '102 route' -          } -      end.to change { Chouette::Route.count }.by(1) - -      expect(Chouette::Route.last.name).to eq('102 Route') +          id: route.id +      end.to change { Route.count }.by(1) + +      expect(Route.last.name).to eq(route.name) +      expect(Route.last.published_name).to eq(route.published_name)      end    end  end | 
