diff options
| author | Teddy Wing | 2017-08-07 16:51:19 +0200 | 
|---|---|---|
| committer | Robert | 2017-08-11 10:03:46 +0200 | 
| commit | 51b73758486294862c47707d9b85e7cefeb0242a (patch) | |
| tree | c1882cd76952f0da5f0851431f2d703cd35773d5 /spec/controllers/routes_controller_spec.rb | |
| parent | 8cea700c7ebc1e9daf8eda4b35e9d9c28e46249c (diff) | |
| download | chouette-core-51b73758486294862c47707d9b85e7cefeb0242a.tar.bz2 | |
RoutesController: Add separate method for POST /duplicate
Send POST requests for duplication to a new controller method so we can
more easily handle them and separate setup and creation code.
Note that the test doesn't work. The `to change` part succeeds even
though it shouldn't. Still need to figure out what's going on there, but
committing this to hand off the feature to Robert.
Refs #4189
Diffstat (limited to 'spec/controllers/routes_controller_spec.rb')
| -rw-r--r-- | spec/controllers/routes_controller_spec.rb | 17 | 
1 files changed, 17 insertions, 0 deletions
| diff --git a/spec/controllers/routes_controller_spec.rb b/spec/controllers/routes_controller_spec.rb index 5c17b78b8..3862d8173 100644 --- a/spec/controllers/routes_controller_spec.rb +++ b/spec/controllers/routes_controller_spec.rb @@ -85,4 +85,21 @@ RSpec.describe RoutesController, type: :controller do        expect(response).to be_success      end    end + +  describe "POST /duplicate" do +    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') +    end +  end  end | 
