aboutsummaryrefslogtreecommitdiffstats
path: root/spec/views
diff options
context:
space:
mode:
authorVlatka Pavisic2017-02-06 11:42:12 +0100
committerVlatka Pavisic2017-02-07 11:25:29 +0100
commitd94b1271d147fdb5bbd1e616e116173198e858db (patch)
treee1b5631e72e009ffd80fdf4e47159b2b11cd899e /spec/views
parent9c3095c20aaef122212ed71ce8818e3a18b13308 (diff)
downloadchouette-core-d94b1271d147fdb5bbd1e616e116173198e858db.tar.bz2
Refs #2476 : Disable modification and deletion of resources from another referential; in progress
Diffstat (limited to 'spec/views')
-rw-r--r--spec/views/connection_links/index.html.erb_spec.rb12
-rw-r--r--spec/views/connection_links/show.html.erb_spec.rb6
-rw-r--r--spec/views/lines/show.html.erb_spec.rb5
-rw-r--r--spec/views/time_tables/index.html.erb_spec.rb12
-rw-r--r--spec/views/time_tables/show.html.erb_spec.rb8
5 files changed, 32 insertions, 11 deletions
diff --git a/spec/views/connection_links/index.html.erb_spec.rb b/spec/views/connection_links/index.html.erb_spec.rb
index 51029a2f8..a01380094 100644
--- a/spec/views/connection_links/index.html.erb_spec.rb
+++ b/spec/views/connection_links/index.html.erb_spec.rb
@@ -3,12 +3,16 @@ require 'spec_helper'
describe "/connection_links/index", :type => :view do
assign_referential
- let!(:connection_links) { assign :connection_links, Array.new(2) { create(:connection_link) }.paginate }
+ let!(:connection_links) { assign :connection_links, Array.new(2) { create(:connection_link) }.paginate }
let!(:search) { assign :q, Ransack::Search.new(Chouette::ConnectionLink) }
- it "should render a show link for each group" do
- render
- connection_links.each do |connection_link|
+ before do
+ allow(view).to receive_messages(current_organisation: referential.organisation)
+ end
+
+ it "should render a show link for each group" do
+ render
+ connection_links.each do |connection_link|
expect(rendered).to have_selector(".connection_link a[href='#{view.referential_connection_link_path(referential, connection_link)}']", :text => connection_link.name)
end
end
diff --git a/spec/views/connection_links/show.html.erb_spec.rb b/spec/views/connection_links/show.html.erb_spec.rb
index 7be74ad7c..1a7ad3d16 100644
--- a/spec/views/connection_links/show.html.erb_spec.rb
+++ b/spec/views/connection_links/show.html.erb_spec.rb
@@ -1,11 +1,15 @@
require 'spec_helper'
describe "/connection_links/show", :type => :view do
-
+
assign_referential
let!(:connection_link) { assign(:connection_link, create(:connection_link)) }
let!(:map) { assign(:map, double(:to_html => '<div id="map"/>'.html_safe)) }
+ before do
+ allow(view).to receive_messages(current_organisation: referential.organisation)
+ end
+
it "should render h2 with the connection_link name" do
render
expect(rendered).to have_selector("h2", :text => Regexp.new(connection_link.name))
diff --git a/spec/views/lines/show.html.erb_spec.rb b/spec/views/lines/show.html.erb_spec.rb
index 9f929f432..65475e296 100644
--- a/spec/views/lines/show.html.erb_spec.rb
+++ b/spec/views/lines/show.html.erb_spec.rb
@@ -2,11 +2,16 @@ require 'spec_helper'
describe "/lines/show", :type => :view do
+ assign_referential
let!(:line) { assign :line, create(:line) }
let!(:line_referential) { assign :line_referential, line.line_referential }
let!(:routes) { assign :routes, Array.new(2) { create(:route, :line => line) }.paginate }
let!(:map) { assign(:map, double(:to_html => '<div id="map"/>'.html_safe)) }
+ before do
+ allow(view).to receive_messages(current_organisation: referential.organisation)
+ end
+
it "should render h2 with the line name" do
render
expect(rendered).to have_selector("h2", :text => Regexp.new(line.name))
diff --git a/spec/views/time_tables/index.html.erb_spec.rb b/spec/views/time_tables/index.html.erb_spec.rb
index 84cea756e..2679964c1 100644
--- a/spec/views/time_tables/index.html.erb_spec.rb
+++ b/spec/views/time_tables/index.html.erb_spec.rb
@@ -3,12 +3,16 @@ require 'spec_helper'
describe "/time_tables/index", :type => :view do
assign_referential
- let!(:time_tables) { assign :time_tables, Array.new(2){ create(:time_table) }.paginate }
+ let!(:time_tables) { assign :time_tables, Array.new(2){ create(:time_table) }.paginate }
let!(:search) { assign :q, Ransack::Search.new(Chouette::TimeTable) }
- it "should render a show link for each group" do
- render
- time_tables.each do |time_table|
+ before do
+ allow(view).to receive_messages(current_organisation: referential.organisation)
+ end
+
+ it "should render a show link for each group" do
+ render
+ time_tables.each do |time_table|
expect(rendered).to have_selector(".time_table a[href='#{view.referential_time_table_path(referential, time_table)}']", :text => time_table.comment)
end
end
diff --git a/spec/views/time_tables/show.html.erb_spec.rb b/spec/views/time_tables/show.html.erb_spec.rb
index 352d67f4f..3b5d7f1f1 100644
--- a/spec/views/time_tables/show.html.erb_spec.rb
+++ b/spec/views/time_tables/show.html.erb_spec.rb
@@ -1,13 +1,17 @@
require 'spec_helper'
describe "/time_tables/show", :type => :view do
-
+
assign_referential
let!(:time_table) { assign(:time_table, create(:time_table)) }
let!(:year) { assign(:year, Date.today.cwyear) }
let!(:time_table_combination) {assign(:time_table_combination, TimeTableCombination.new)}
- it "should render h2 with the time_table comment" do
+ before do
+ allow(view).to receive_messages(current_organisation: referential.organisation)
+ end
+
+ it "should render h2 with the time_table comment" do
render
expect(rendered).to have_selector("h2", :text => Regexp.new(time_table.comment))
end