diff options
| author | Luc Donnet | 2017-12-19 12:18:51 +0100 |
|---|---|---|
| committer | GitHub | 2017-12-19 12:18:51 +0100 |
| commit | 0e375a231b8c83bd1dc6f1b1f27cc23cd0c3ddbf (patch) | |
| tree | 0372582fa88706ac55188c55e5bb79b79f32f213 /spec/controllers | |
| parent | bb2713b33296c857ce807e0237bf8095b65070ad (diff) | |
| parent | 1b690a6dbd7175eb29e543246a057e4a868974cd (diff) | |
| download | chouette-core-0e375a231b8c83bd1dc6f1b1f27cc23cd0c3ddbf.tar.bz2 | |
Merge pull request #159 from af83/5317-add-flash-messages-to-inform-users-when-asynchronous-jo
5317 add flash messages to inform users when asynchronous jo
Diffstat (limited to 'spec/controllers')
| -rw-r--r-- | spec/controllers/imports_controller_spec.rb | 14 | ||||
| -rw-r--r-- | spec/controllers/referentials_controller_spec.rb | 29 |
2 files changed, 43 insertions, 0 deletions
diff --git a/spec/controllers/imports_controller_spec.rb b/spec/controllers/imports_controller_spec.rb index 22be9f6ed..08495ff47 100644 --- a/spec/controllers/imports_controller_spec.rb +++ b/spec/controllers/imports_controller_spec.rb @@ -17,6 +17,20 @@ RSpec.describe ImportsController, :type => :controller do end end + describe "POST #create" do + it "displays a flash message" do + post :create, workbench_id: workbench.id, + import: { + name: 'Offre', + file: fixture_file_upload('nozip.zip') + } + + expect(controller).to set_flash[:notice].to( + I18n.t('flash.imports.create.notice') + ) + end + end + describe 'GET #download' do it 'should be successful' do get :download, workbench_id: workbench.id, id: import.id, token: import.token_download diff --git a/spec/controllers/referentials_controller_spec.rb b/spec/controllers/referentials_controller_spec.rb index fba063085..4050a8812 100644 --- a/spec/controllers/referentials_controller_spec.rb +++ b/spec/controllers/referentials_controller_spec.rb @@ -30,4 +30,33 @@ describe ReferentialsController, :type => :controller do expect(assigns[:compliance_control_sets]).to eq([compliance_control_set]) end end + + describe "POST #validate" do + it "displays a flash message" do + post :validate, id: referential.id, params: { + compliance_control_set: create(:compliance_control_set).id + } + + expect(controller).to set_flash[:notice].to( + I18n.t('notice.referentials.validate') + ) + end + end + + describe "POST #create" do + context "when duplicating" do + it "displays a flash message" do + post :create, + from: referential.id, + current_workbench_id: referential.workbench_id, + referential: { + name: 'Duplicated' + } + + expect(controller).to set_flash[:notice].to( + I18n.t('notice.referentials.duplicate') + ) + end + end + end end |
