aboutsummaryrefslogtreecommitdiffstats
path: root/spec/views
diff options
context:
space:
mode:
authorTeddy Wing2018-01-17 11:32:26 +0100
committerTeddy Wing2018-01-17 11:32:26 +0100
commit9f3f7c5f71fee181f7f10a4a73d08fb1a0c1795b (patch)
tree0563c7e2f16bc0f81821b691e846461252599e4d /spec/views
parent93b60066cc49d699171d6a50798c5939a4644eea (diff)
downloadchouette-core-9f3f7c5f71fee181f7f10a4a73d08fb1a0c1795b.tar.bz2
offer_workbenches/show.html.erb_spec: Give workbenches same workgroup5592-workbenches-show--filter-by-workgroup-on-initial-load
I was getting the following test failures after having modified `Workbench#all_referentials` in 93b60066cc49d699171d6a50798c5939a4644eea: Failures: 1) workbenches/show should include #<Referential id: 5, name: "Test 4", slug: "test_4", created_at: "2018-01-17 10:18:47", updated_at: "...from_id: nil, ready: true, referential_suite_id: nil, objectid_format: "stif_netex", merged_at: nil> Failure/Error: expect(workbench.all_referentials).to include different_organisation_referential expected #<ActiveRecord::AssociationRelation [#<Referential id: 3, name: "Test 2", slug: "test_2", created_at:...om_id: nil, ready: true, referential_suite_id: nil, objectid_format: "stif_netex", merged_at: nil>]> to include #<Referential id: 5, name: "Test 4", slug: "test_4", created_at: "2018-01-17 10:18:47", updated_at: "...from_id: nil, ready: true, referential_suite_id: nil, objectid_format: "stif_netex", merged_at: nil> Diff: @@ -1,2 +1,25 @@ -[#<Referential id: 5, name: "Test 4", slug: "test_4", created_at: "2018-01-17 10:18:47", updated_at: "2018-01-17 10:18:49", prefix: "organisation_5", projection_type: nil, time_zone: "Europe/Paris", bounds: nil, organisation_id: 6, geographical_bounds: nil, user_id: nil, user_name: nil, data_format: "netex", line_referential_id: 14, stop_area_referential_id: 10, workbench_id: 3, archived_at: nil, created_from_id: nil, ready: true, referential_suite_id: nil, objectid_format: "stif_netex", merged_at: nil>] +[#<Referential:0x007fd30e897428 + id: 3, + name: "Test 2", + slug: "test_2", + created_at: Wed, 17 Jan 2018 11:18:42 CET +01:00, + updated_at: Wed, 17 Jan 2018 11:18:44 CET +01:00, + prefix: "organisation_3", + projection_type: nil, + time_zone: "Europe/Paris", + bounds: nil, + organisation_id: 4, + geographical_bounds: nil, + user_id: nil, + user_name: nil, + data_format: "netex", + line_referential_id: 4, + stop_area_referential_id: 4, + workbench_id: 2, + archived_at: nil, + created_from_id: nil, + ready: true, + referential_suite_id: nil, + objectid_format: "stif_netex", + merged_at: nil>] # ./spec/views/offer_workbenches/show.html.erb_spec.rb:37:in `block (2 levels) in <top (required)>' # .../.gem/ruby/2.3.3/gems/activesupport-4.2.8/lib/active_support/dependencies.rb:268:in `load' # .../.gem/ruby/2.3.3/gems/activesupport-4.2.8/lib/active_support/dependencies.rb:268:in `block in load' # .../.gem/ruby/2.3.3/gems/activesupport-4.2.8/lib/active_support/dependencies.rb:240:in `load_dependency' # .../.gem/ruby/2.3.3/gems/activesupport-4.2.8/lib/active_support/dependencies.rb:268:in `load' # .../.gem/ruby/2.3.3/gems/spring-commands-rspec-1.0.4/lib/spring/commands/rspec.rb:18:in `call' # -e:1:in `<main>' 2) workbenches/show without permission should disable all the checkboxes Failure/Error: expect(workbench.all_referentials).to include different_organisation_referential expected #<ActiveRecord::AssociationRelation [#<Referential id: 7, name: "Test 6", slug: "test_6", created_at:...om_id: nil, ready: true, referential_suite_id: nil, objectid_format: "stif_netex", merged_at: nil>]> to include #<Referential id: 9, name: "Test 8", slug: "test_8", created_at: "2018-01-17 10:18:55", updated_at: "...from_id: nil, ready: true, referential_suite_id: nil, objectid_format: "stif_netex", merged_at: nil> Diff: @@ -1,2 +1,25 @@ -[#<Referential id: 9, name: "Test 8", slug: "test_8", created_at: "2018-01-17 10:18:55", updated_at: "2018-01-17 10:18:57", prefix: "organisation_11", projection_type: nil, time_zone: "Europe/Paris", bounds: nil, organisation_id: 12, geographical_bounds: nil, user_id: nil, user_name: nil, data_format: "netex", line_referential_id: 26, stop_area_referential_id: 18, workbench_id: 5, archived_at: nil, created_from_id: nil, ready: true, referential_suite_id: nil, objectid_format: "stif_netex", merged_at: nil>] +[#<Referential:0x007fd30eadc210 + id: 7, + name: "Test 6", + slug: "test_6", + created_at: Wed, 17 Jan 2018 11:18:52 CET +01:00, + updated_at: Wed, 17 Jan 2018 11:18:53 CET +01:00, + prefix: "organisation_9", + projection_type: nil, + time_zone: "Europe/Paris", + bounds: nil, + organisation_id: 10, + geographical_bounds: nil, + user_id: nil, + user_name: nil, + data_format: "netex", + line_referential_id: 16, + stop_area_referential_id: 12, + workbench_id: 4, + archived_at: nil, + created_from_id: nil, + ready: true, + referential_suite_id: nil, + objectid_format: "stif_netex", + merged_at: nil>] # ./spec/views/offer_workbenches/show.html.erb_spec.rb:37:in `block (2 levels) in <top (required)>' # .../.gem/ruby/2.3.3/gems/activesupport-4.2.8/lib/active_support/dependencies.rb:268:in `load' # .../.gem/ruby/2.3.3/gems/activesupport-4.2.8/lib/active_support/dependencies.rb:268:in `block in load' # .../.gem/ruby/2.3.3/gems/activesupport-4.2.8/lib/active_support/dependencies.rb:240:in `load_dependency' # .../.gem/ruby/2.3.3/gems/activesupport-4.2.8/lib/active_support/dependencies.rb:268:in `load' # .../.gem/ruby/2.3.3/gems/spring-commands-rspec-1.0.4/lib/spring/commands/rspec.rb:18:in `call' # -e:1:in `<main>' 3) workbenches/show with permission referentials.destroy should enable the checkbox for the referential which belongs to the same organisation and disable the other one Failure/Error: expect(workbench.all_referentials).to include different_organisation_referential expected #<ActiveRecord::AssociationRelation [#<Referential id: 11, name: "Test 10", slug: "test_10", created_...om_id: nil, ready: true, referential_suite_id: nil, objectid_format: "stif_netex", merged_at: nil>]> to include #<Referential id: 13, name: "Test 12", slug: "test_12", created_at: "2018-01-17 10:19:03", updated_at...from_id: nil, ready: true, referential_suite_id: nil, objectid_format: "stif_netex", merged_at: nil> Diff: @@ -1,2 +1,25 @@ -[#<Referential id: 13, name: "Test 12", slug: "test_12", created_at: "2018-01-17 10:19:03", updated_at: "2018-01-17 10:19:05", prefix: "organisation_17", projection_type: nil, time_zone: "Europe/Paris", bounds: nil, organisation_id: 18, geographical_bounds: nil, user_id: nil, user_name: nil, data_format: "netex", line_referential_id: 38, stop_area_referential_id: 26, workbench_id: 7, archived_at: nil, created_from_id: nil, ready: true, referential_suite_id: nil, objectid_format: "stif_netex", merged_at: nil>] +[#<Referential:0x007fd309268e30 + id: 11, + name: "Test 10", + slug: "test_10", + created_at: Wed, 17 Jan 2018 11:19:00 CET +01:00, + updated_at: Wed, 17 Jan 2018 11:19:02 CET +01:00, + prefix: "organisation_15", + projection_type: nil, + time_zone: "Europe/Paris", + bounds: nil, + organisation_id: 16, + geographical_bounds: nil, + user_id: nil, + user_name: nil, + data_format: "netex", + line_referential_id: 28, + stop_area_referential_id: 20, + workbench_id: 6, + archived_at: nil, + created_from_id: nil, + ready: true, + referential_suite_id: nil, + objectid_format: "stif_netex", + merged_at: nil>] # ./spec/views/offer_workbenches/show.html.erb_spec.rb:37:in `block (2 levels) in <top (required)>' # .../.gem/ruby/2.3.3/gems/activesupport-4.2.8/lib/active_support/dependencies.rb:268:in `load' # .../.gem/ruby/2.3.3/gems/activesupport-4.2.8/lib/active_support/dependencies.rb:268:in `block in load' # .../.gem/ruby/2.3.3/gems/activesupport-4.2.8/lib/active_support/dependencies.rb:240:in `load_dependency' # .../.gem/ruby/2.3.3/gems/activesupport-4.2.8/lib/active_support/dependencies.rb:268:in `load' # .../.gem/ruby/2.3.3/gems/spring-commands-rspec-1.0.4/lib/spring/commands/rspec.rb:18:in `call' # -e:1:in `<main>' Finished in 29.81 seconds (files took 1.7 seconds to load) 3 examples, 3 failures The new behaviour requires referentials to have the same workgroup in order to be displayed on this page. Modify the test to give both `same_organisation_referential` and `different_organisation_referential` the same workgroup to get the tests to pass. Refs #5592
Diffstat (limited to 'spec/views')
-rw-r--r--spec/views/offer_workbenches/show.html.erb_spec.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/spec/views/offer_workbenches/show.html.erb_spec.rb b/spec/views/offer_workbenches/show.html.erb_spec.rb
index 138a1560d..2a2642911 100644
--- a/spec/views/offer_workbenches/show.html.erb_spec.rb
+++ b/spec/views/offer_workbenches/show.html.erb_spec.rb
@@ -22,7 +22,13 @@ describe "workbenches/show", :type => :view do
}
let!(:workbench){ assign :workbench, create(:workbench) }
let!(:same_organisation_referential){ create :workbench_referential, workbench: workbench, metadatas: [create(:referential_metadata, lines: lines)] }
- let!(:different_organisation_referential){ create :workbench_referential, metadatas: [create(:referential_metadata, lines: lines)] }
+ let!(:different_organisation_referential) do
+ create(
+ :workbench_referential,
+ workbench: create(:workbench, workgroup: workbench.workgroup),
+ metadatas: [create(:referential_metadata, lines: lines)]
+ )
+ end
let!(:referentials){
same_organisation_referential && different_organisation_referential
assign :wbench_refs, paginate_collection(Referential, ReferentialDecorator)