diff options
| author | Zog | 2018-03-07 16:15:36 +0100 |
|---|---|---|
| committer | Zog | 2018-03-12 12:00:14 +0100 |
| commit | db15dc6158939d2577ccd53aac66a283ce4f3338 (patch) | |
| tree | 797fe3dab0e2749aed38f250550f4e2e6a514a75 /spec/controllers | |
| parent | 1245099459bd3d7dce71fdf0d7c95b2377a0034e (diff) | |
| download | chouette-core-db15dc6158939d2577ccd53aac66a283ce4f3338.tar.bz2 | |
refs #6133; Add some basic specs
Diffstat (limited to 'spec/controllers')
| -rw-r--r-- | spec/controllers/exports_controller_spec.rb | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/spec/controllers/exports_controller_spec.rb b/spec/controllers/exports_controller_spec.rb index 6cd6e4c54..a1a40d571 100644 --- a/spec/controllers/exports_controller_spec.rb +++ b/spec/controllers/exports_controller_spec.rb @@ -1,22 +1,32 @@ -require 'spec_helper' - -describe ExportsController, :type => :controller do +RSpec.describe ExportsController, :type => :controller do login_user - describe "GET 'new'" do - it "returns http success" do - pending - get 'new' + let(:workbench) { create :workbench } + let(:export) { create :export, workbench: workbench } + + describe 'GET #new' do + it 'should be successful if authorized' do + get :new, workbench_id: workbench.id expect(response).to be_success end - end - describe "GET 'index'" do - it "returns http success" do - pending - get 'index' - expect(response).to be_success + it 'should be unsuccessful unless authorized' do + remove_permissions('exports.create', from_user: @user, save: true) + get :new, workbench_id: workbench.id + expect(response).not_to be_success end end + describe "POST #create" do + it "displays a flash message" do + post :create, workbench_id: workbench.id, + export: { + name: 'Offre' + } + + expect(controller).to set_flash[:notice].to( + I18n.t('flash.exports.create.notice') + ) + end + end end |
