aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--spec/features/workbenches_spec.rb36
1 files changed, 28 insertions, 8 deletions
diff --git a/spec/features/workbenches_spec.rb b/spec/features/workbenches_spec.rb
index 4a074dad5..1b3886985 100644
--- a/spec/features/workbenches_spec.rb
+++ b/spec/features/workbenches_spec.rb
@@ -1,23 +1,43 @@
+# coding: utf-8
require 'spec_helper'
describe 'Workbenches', type: :feature do
login_user
- let!(:organisations) { Array.new(2) { create :organisation } }
- let!(:referentials) { Array.new(2) { create :referential, ready: true } }
- let!(:line_referential) { create :line_referential }
- let!(:workbenches) { Array.new(2) { create :workbench, line_referential: line_referential, organisation: @user.organisation } }
+ #let!(:organisations) { Array.new(2) { create :organisation } }
+ #let!(:referentials) { Array.new(2) { create :referential, ready: true } }
+ let(:line_referential) { create :line_referential }
+ let(:workbenches) { Array.new(2) { create :workbench, line_referential: line_referential, organisation: @user.organisation } }
+ let(:workbench) { workbenches.first }
let!(:line) { create :line, line_referential: line_referential }
- let!(:referential_metadatas) { Array.new(2) { |i| create :referential_metadata, lines: [line], referential: referentials[i] } }
- let!(:ready_referential) { create(:referential, workbench: workbenches.first, metadatas: referential_metadatas, ready: true, organisation: @user.organisation) }
- let!(:unready_referential) { create(:referential, workbench: workbenches.first) }
+ let(:referential_metadatas) { Array.new(2) { |i| create :referential_metadata, lines: [line] } }
describe 'show' do
+
+ let!(:ready_referential) { create :referential, workbench: workbench, metadatas: referential_metadatas, ready: true, organisation: @user.organisation }
+ let!(:unready_referential) { create :referential, workbench: workbench }
+
it 'shows ready referentials belonging to that workbench by default' do
- visit workbench_path(workbenches.first)
+ visit workbench_path(workbench)
expect(page).to have_content(ready_referential.name)
expect(page).not_to have_content(unready_referential.name)
end
end
+
+ describe 'create new Referential' do
+ it "create a new Referential with a specifed line and period" do
+ visit workbench_path(workbench)
+
+ click_link "Ajouter un jeu de données"
+
+ fill_in "referential[name]", with: "Referential to test creation" # Nom du JDD
+ fill_in "referential[slug]", with: "test" # Code
+ fill_in "referential[prefix]", with: "test" # Prefix Neptune
+ select workbench.lines.first.id, from: 'referential[metadatas_attributes][0][lines][]' # Lignes
+
+ click_button "Enregistrer"
+ expect(page).to have_css("h1", text: "Referential to test creation")
+ end
+ end
end