diff options
| author | Luc Donnet | 2018-02-19 11:04:29 +0100 |
|---|---|---|
| committer | Luc Donnet | 2018-02-19 11:04:29 +0100 |
| commit | 7b17deff51545358009cb417cbb9d796565e7540 (patch) | |
| tree | a43a5586ad39d838dd607e600dbc15ff18a58ab3 /spec/features/purchase_windows_spec.rb | |
| parent | 89428163fc93a7e09ebb0ca47939f8558afeb5eb (diff) | |
| parent | 5f6008d165df4499319a2121a71842657d6ac3c9 (diff) | |
| download | chouette-core-7b17deff51545358009cb417cbb9d796565e7540.tar.bz2 | |
Merge branch 'master' into 0000-docker
Diffstat (limited to 'spec/features/purchase_windows_spec.rb')
| -rw-r--r-- | spec/features/purchase_windows_spec.rb | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/spec/features/purchase_windows_spec.rb b/spec/features/purchase_windows_spec.rb new file mode 100644 index 000000000..f797594b7 --- /dev/null +++ b/spec/features/purchase_windows_spec.rb @@ -0,0 +1,69 @@ +describe "PurchaseWindows", type: :feature do + login_user + + before do + @user.organisation.update features: %w{purchase_windows} + end + + describe "#index" do + with_permissions('purchase_windows.create') do + it "allows users to create new purchase windows" do + name = 'Test purchase window create' + + visit(referential_purchase_windows_path(first_referential.id)) + + click_link(I18n.t('purchase_windows.actions.new')) + + fill_in('purchase_window[name]', with: name) + # select('#DD2DAA', from: 'purchase_window[color]') + + click_link(I18n.t('simple_form.labels.purchase_window.add_a_date_range')) + click_button(I18n.t('actions.submit')) + + expect(page).to have_content(name) + end + end + + with_permissions('purchase_windows.update') do + it "allows users to update purchase windows" do + actual_name = 'Existing purchase window' + expected_name = 'Updated purchase window' + create( + :purchase_window, + referential: first_referential, + name: actual_name + ) + + visit(referential_purchase_windows_path(first_referential.id)) + + click_link(actual_name) + + click_link(I18n.t('purchase_windows.actions.edit')) + fill_in('purchase_window[name]', with: expected_name) + + click_button(I18n.t('actions.submit')) + + expect(page).to have_content(expected_name) + end + end + + with_permissions('purchase_windows.destroy') do + it "allows users to destroy purchase windows" do + name = 'Existing purchase window' + create( + :purchase_window, + referential: first_referential, + name: name + ) + + visit(referential_purchase_windows_path(first_referential.id)) + + click_link(name) + + click_link(I18n.t('purchase_windows.actions.destroy')) + + expect(page).to_not have_content(name) + end + end + end +end |
