diff options
| author | Zog | 2018-03-09 10:40:01 +0100 | 
|---|---|---|
| committer | Zog | 2018-03-12 12:00:15 +0100 | 
| commit | 0cd50ea684248e13391ef4f5ee5af5550ff6491f (patch) | |
| tree | 6867d98ba08e895dfa9e97043485c470d91e64ce /spec/controllers | |
| parent | f65a9f30f600f092fe3596e9e4db3c015dd91616 (diff) | |
| download | chouette-core-0cd50ea684248e13391ef4f5ee5af5550ff6491f.tar.bz2 | |
Refs #6135; ExportsController#upload endpoint
With token-based authentication
Diffstat (limited to 'spec/controllers')
| -rw-r--r-- | spec/controllers/exports_controller_spec.rb | 18 | 
1 files changed, 17 insertions, 1 deletions
| diff --git a/spec/controllers/exports_controller_spec.rb b/spec/controllers/exports_controller_spec.rb index a070cfb1f..dbc8b3f35 100644 --- a/spec/controllers/exports_controller_spec.rb +++ b/spec/controllers/exports_controller_spec.rb @@ -2,7 +2,7 @@ RSpec.describe ExportsController, :type => :controller do    login_user    let(:workbench) { create :workbench } -  let(:export)    { create :export, workbench: workbench } +  let(:export)    { create(:netex_export, workbench: workbench) }    describe 'GET #new' do      it 'should be successful if authorized' do @@ -76,4 +76,20 @@ RSpec.describe ExportsController, :type => :controller do        end      end    end + +  describe 'POST #upload' do +    context "with the token" do +      it 'should be successful' do +        post :upload, workbench_id: workbench.id, id: export.id, token: export.token_upload +        expect(response).to be_redirect +      end +    end + +    context "without the token" do +      it 'should be unsuccessful' do +        post :upload, workbench_id: workbench.id, id: export.id, token: "foo" +        expect(response).to_not be_success +      end +    end +  end  end | 
