aboutsummaryrefslogtreecommitdiffstats
path: root/spec/requests
diff options
context:
space:
mode:
authorLuc Donnet2015-01-05 14:56:12 +0100
committerLuc Donnet2015-01-05 14:56:12 +0100
commit3bc6d313bebdc1f03e4021aabbc774a0cd97d938 (patch)
treeac5b8c6d8309012136606d9fd9b9a00290f486a8 /spec/requests
parente632a4634b1762f4c73d11f1e5b127de9832a1ff (diff)
downloadchouette-core-3bc6d313bebdc1f03e4021aabbc774a0cd97d938.tar.bz2
Initialize rails 4 migration
Diffstat (limited to 'spec/requests')
-rw-r--r--spec/requests/companies_spec.rb51
-rw-r--r--spec/requests/connection_links_spec.rb56
-rw-r--r--spec/requests/journey_pattern_spec.rb60
-rw-r--r--spec/requests/lines_spec.rb60
-rw-r--r--spec/requests/networks_spec.rb72
-rw-r--r--spec/requests/referentials_spec.rb62
-rw-r--r--spec/requests/routes_spec.rb60
-rw-r--r--spec/requests/stop_areas_spec.rb56
-rw-r--r--spec/requests/stop_points_spec.rb30
-rw-r--r--spec/requests/time_tables_spec.rb49
-rw-r--r--spec/requests/vehicle_journey_imports_spec.rb68
11 files changed, 0 insertions, 624 deletions
diff --git a/spec/requests/companies_spec.rb b/spec/requests/companies_spec.rb
deleted file mode 100644
index fdcff4cab..000000000
--- a/spec/requests/companies_spec.rb
+++ /dev/null
@@ -1,51 +0,0 @@
-# -*- coding: utf-8 -*-
-require 'spec_helper'
-
-describe "Companies" do
- login_user
-
- let!(:companies) { Array.new(2) { create :company } }
- subject { companies.first }
-
- describe "list" do
- it "display companies" do
- visit referential_companies_path(referential)
- page.should have_content(companies.first.name)
- page.should have_content(companies.last.name)
- end
-
- end
-
- describe "show" do
- it "display company" do
- visit referential_companies_path(referential)
- click_link "#{companies.first.name}"
- page.should have_content(companies.first.name)
- end
-
- end
-
- describe "new" do
- it "creates company and return to show" do
- visit referential_companies_path(referential)
- click_link "Ajouter un transporteur"
- fill_in "Nom", :with => "Company 1"
- fill_in "Numéro d'enregistrement", :with => "test-1"
- fill_in "Identifiant Neptune", :with => "test:Company:1"
- click_button("Créer transporteur")
- page.should have_content("Company 1")
- end
- end
-
- describe "edit and return to show" do
- it "edit company" do
- visit referential_company_path(referential, subject)
- click_link "Modifier ce transporteur"
- fill_in "Nom", :with => "Company Modified"
- fill_in "Numéro d'enregistrement", :with => "test-1"
- click_button("Modifier transporteur")
- page.should have_content("Company Modified")
- end
- end
-
-end
diff --git a/spec/requests/connection_links_spec.rb b/spec/requests/connection_links_spec.rb
deleted file mode 100644
index 74fe17c2e..000000000
--- a/spec/requests/connection_links_spec.rb
+++ /dev/null
@@ -1,56 +0,0 @@
-# -*- coding: utf-8 -*-
-require 'spec_helper'
-
-describe "ConnectionLinks" do
- login_user
-
- let!(:connection_links) { Array.new(2) { create(:connection_link) } }
- subject { connection_links.first }
-
- describe "list" do
- it "display connection_links" do
- visit referential_connection_links_path(referential)
- page.should have_content(connection_links.first.name)
- page.should have_content(connection_links.last.name)
- end
-
- end
-
- describe "show" do
- it "display connection_link" do
- visit referential_connection_links_path(referential)
- click_link "#{connection_links.first.name}"
- page.should have_content(connection_links.first.name)
- end
-
- it "display map" do
- subject.stub(:stop_areas).and_return(Array.new(2) { Factory(:stop_area) })
- visit referential_connection_links_path(referential)
- click_link "#{connection_links.first.name}"
- page.should have_selector("#map", :class => 'connection_link')
- end
-
- end
-
- describe "new" do
- it "creates connection_link and return to show" do
- visit referential_connection_links_path(referential)
- click_link "Ajouter une correspondance"
- fill_in "Nom", :with => "ConnectionLink 1"
- fill_in "Identifiant Neptune", :with => "test:ConnectionLink:1"
- click_button("Créer correspondance")
- page.should have_content("ConnectionLink 1")
- end
- end
-
- describe "edit and return to show" do
- it "edit connection_link" do
- visit referential_connection_link_path(referential, subject)
- click_link "Modifier cette correspondance"
- fill_in "Nom", :with => "ConnectionLink Modified"
- click_button("Modifier correspondance")
- page.should have_content("ConnectionLink Modified")
- end
- end
-
-end
diff --git a/spec/requests/journey_pattern_spec.rb b/spec/requests/journey_pattern_spec.rb
deleted file mode 100644
index d5afcfbf0..000000000
--- a/spec/requests/journey_pattern_spec.rb
+++ /dev/null
@@ -1,60 +0,0 @@
-# -*- coding: utf-8 -*-
-require 'spec_helper'
-
-describe "JourneyPatterns" do
- login_user
-
- let(:line) { Factory(:line) }
- let(:route) { Factory(:route, :line => line) }
- let(:journey_pattern) { Factory(:journey_pattern, :route => route) }
-
- describe "from routes page to a journey_pattern page" do
- it "display route's journey_patterns" do
- pending
- visit referential_line_route_path(referential,line,route)
- page.should have_content(journey_pattern.name)
- end
- end
- describe "from route's page to journey_pattern's page" do
- it "display journey_pattern properties" do
- pending
- visit referential_line_route_path(referential,line,route)
- click_link "#{journey_pattern.name}"
- page.should have_content(journey_pattern.published_name)
- page.should have_content(journey_pattern.comment)
- page.should have_content(journey_pattern.registration_number)
- end
- end
- describe "from route's page, create a new journey_pattern" do
- it "return to route's page that display new journey_pattern" do
- pending
- visit referential_line_route_path(referential,line,route)
- click_link "Ajouter une mission"
- fill_in "Nom", :with => "A to B"
- fill_in "Comment", :with => "AB"
- click_button("Créer mission")
- page.should have_content("A to B")
- end
- end
- describe "from route's page, select a journey_pattern and edit it" do
- it "return to route's page with changed name" do
- pending
- visit referential_line_route_path(referential,line,route)
- click_link "#{journey_pattern.name}"
- click_link "Modifier cette mission"
- fill_in "Nom", :with => "#{journey_pattern.name}-changed"
- click_button("Modifier mission")
- page.should have_content("#{journey_pattern.name}-changed")
- end
- end
- describe "from route's page, select a journey_pattern and delete it" do
- it "return to route's page without journey_pattern name" do
- pending
- visit referential_line_route_path(referential,line,route)
- click_link "#{journey_pattern.name}"
- click_link "Supprimer cette mission"
- page.should_not have_content(journey_pattern.name)
- end
- end
-end
-
diff --git a/spec/requests/lines_spec.rb b/spec/requests/lines_spec.rb
deleted file mode 100644
index b851f522a..000000000
--- a/spec/requests/lines_spec.rb
+++ /dev/null
@@ -1,60 +0,0 @@
-# -*- coding: utf-8 -*-
-require 'spec_helper'
-
-describe "Lines" do
- login_user
-
- let!(:network) { Factory(:network) }
- let!(:company) { Factory(:company) }
- let!(:lines) { Array.new(2) { Factory(:line_with_stop_areas, :network => network, :company => company) } }
- subject { lines.first }
-
- describe "list" do
- it "display lines" do
- visit referential_lines_path(referential)
- page.should have_content(lines.first.name)
- page.should have_content(lines.last.name)
- end
-
- end
-
-
- describe "show" do
- it "display line" do
- visit referential_lines_path(referential)
- click_link "#{lines.first.name}"
- page.should have_content(lines.first.name)
- end
-
- it "display map" do
- visit referential_lines_path(referential)
- click_link "#{lines.first.name}"
- page.should have_selector("#map", :class => 'line')
- end
-
- end
-
- describe "new" do
- it "creates line and return to show" do
- visit referential_lines_path(referential)
- click_link "Ajouter une ligne"
- fill_in "Nom", :with => "Line 1"
- fill_in "Numéro d'enregistrement", :with => "1"
- fill_in "Identifiant Neptune", :with => "test:Line:999"
- click_button("Créer ligne")
- page.should have_content("Line 1")
- end
- end
-
- describe "edit and return to show" do
- it "edit line" do
- visit referential_line_path(referential, subject)
- click_link "Modifier cette ligne"
- fill_in "Nom", :with => "Line Modified"
- fill_in "Numéro d'enregistrement", :with => "test-1"
- click_button("Modifier ligne")
- page.should have_content("Line Modified")
- end
- end
-
-end
diff --git a/spec/requests/networks_spec.rb b/spec/requests/networks_spec.rb
deleted file mode 100644
index 662e5e830..000000000
--- a/spec/requests/networks_spec.rb
+++ /dev/null
@@ -1,72 +0,0 @@
-# -*- coding: utf-8 -*-
-require 'spec_helper'
-
-describe "Networks" do
- login_user
-
- let!(:networks) { Array.new(2) { Factory(:network) } }
- subject { networks.first }
-
- describe "list" do
- it "display networks" do
- visit referential_networks_path(referential)
- page.should have_content(networks.first.name)
- page.should have_content(networks.last.name)
- end
-
- end
-
- describe "show" do
- it "display network" do
- subject.stub(:stop_areas).and_return(Array.new(2) { Factory(:stop_area) })
- visit referential_networks_path(referential)
- click_link "#{networks.first.name}"
- page.should have_content(networks.first.name)
- end
-
- it "display map" do
- subject.stub(:stop_areas).and_return(Array.new(2) { Factory(:stop_area) })
- visit referential_networks_path(referential)
- click_link "#{networks.first.name}"
- page.should have_selector("#map", :class => 'network')
- end
-
- end
-
- describe "new" do
- it "creates network and return to show" do
- subject.stub(:stop_areas).and_return(Array.new(2) { Factory(:stop_area) })
- visit referential_networks_path(referential)
- click_link "Ajouter un réseau"
- fill_in "Nom", :with => "Network 1"
- fill_in "Numéro d'enregistrement", :with => "test-1"
- fill_in "Identifiant Neptune", :with => "test:GroupOfLine:1"
- click_button("Créer réseau")
- page.should have_content("Network 1")
- end
- end
-
- describe "edit and return to show" do
- it "edit network" do
- subject.stub(:stop_areas).and_return(Array.new(2) { Factory(:stop_area) })
- visit referential_network_path(referential, subject)
- click_link "Modifier ce réseau"
- fill_in "Nom", :with => "Network Modified"
- fill_in "Numéro d'enregistrement", :with => "test-1"
- click_button("Modifier réseau")
- page.should have_content("Network Modified")
- end
- end
-
- # describe "delete", :js => true do
- # it "delete network and return to the list" do
- # subject.stub(:stop_areas).and_return(Array.new(2) { Factory(:stop_area) })
- # visit referential_network_path(referential, subject)
- # click_link "Supprimer ce réseau"
- # page.evaluate_script('window.confirm = function() { return true; }')
- # click_button "Valider"
- # page.should have_no_content(subject.name)
- # end
-
- # end
-end
diff --git a/spec/requests/referentials_spec.rb b/spec/requests/referentials_spec.rb
deleted file mode 100644
index 975248375..000000000
--- a/spec/requests/referentials_spec.rb
+++ /dev/null
@@ -1,62 +0,0 @@
-# -*- coding: utf-8 -*-
-require 'spec_helper'
-
-describe "Referentials" do
- login_user
-
- describe "index" do
-
- it "should support no referential" do
- visit referentials_path
- page.should have_content("Espaces de Données")
- end
-
- context "when several referentials exist" do
-
- def retrieve_referential_by_slug( slug)
- @user.organisation.referentials.find_by_slug(slug) ||
- create(:referential, :slug => slug, :name => slug, :organisation => @user.organisation)
- end
-
- let!(:referentials) { [ retrieve_referential_by_slug("aa"),
- retrieve_referential_by_slug("bb")] }
-
- it "should show n referentials" do
- visit referentials_path
- page.should have_content(referentials.first.name)
- page.should have_content(referentials.last.name)
- end
-
- end
-
- end
-
- describe "create" do
-
- it "should" do
- visit new_referential_path
- fill_in "Nom", :with => "Test"
- fill_in "Code", :with => "test"
- fill_in "Point haut/droite de l'emprise par défaut", :with => "0.0, 0.0"
- fill_in "Point bas/gauche de l'emprise par défaut", :with => "1.0, 1.0"
- click_button "Créer Espace de Données"
-
- Referential.where(:name => "Test").should_not be_nil
- # CREATE SCHEMA
- end
-
- end
-
- describe "destroy" do
- let(:referential) { create(:referential, :organisation => @user.organisation) }
-
- it "should remove referential" do
- pending "Unauthorized DELETE (ticket #14)"
- visit referential_path(referential)
- click_link "Supprimer"
- Referential.where(:slug => referential.slug).should be_blank
- end
-
- end
-
-end
diff --git a/spec/requests/routes_spec.rb b/spec/requests/routes_spec.rb
deleted file mode 100644
index 5e24b8492..000000000
--- a/spec/requests/routes_spec.rb
+++ /dev/null
@@ -1,60 +0,0 @@
-# -*- coding: utf-8 -*-
-require 'spec_helper'
-
-describe "Routes" do
- login_user
-
- let!(:line) { Factory(:line) }
- let!(:route) { Factory(:route, :line => line) }
- let!(:route2) { Factory(:route, :line => line) }
-
- describe "from lines page to a line page" do
- it "display line's routes" do
- pending
- visit referential_lines_path(referential)
- click_link "#{line.name}"
- page.should have_content(route.name)
- page.should have_content(route2.name)
- end
- end
- describe "from line's page to route's page" do
- it "display route properties" do
- pending
- visit referential_line_path(referential,line)
- click_link "#{route.name}"
- page.should have_content(route.name)
- page.should have_content(route.number)
- end
- end
- describe "from line's page, create a new route" do
- it "return to line's page that display new route" do
- pending
- visit referential_line_path(referential,line)
- click_link "Ajouter une séquence d'arrêts"
- fill_in "Nom", :with => "A to B"
- fill_in "Indice", :with => "AB"
- click_button("Créer Séquence d'arrêts")
- page.should have_content("A to B")
- end
- end
- describe "from line's page, select a route and edit it" do
- it "return to line's page with changed name" do
- pending
- visit referential_line_path(referential,line)
- click_link "#{route.name}"
- click_link "Modifier cette séquence d'arrêts"
- fill_in "Nom", :with => "#{route.name}-changed"
- click_button("Modifier Séquence d'arrêts")
- page.should have_content("#{route.name}-changed")
- end
- end
- describe "from line's page, select a route and delete it" do
- it "return to line's page without route name" do
- pending
- visit referential_line_path(referential,line)
- click_link "#{route.name}"
- #click_link "Supprimer cette séquence d'arrêts"
- #page.should_not have_content(route.name)
- end
- end
-end
diff --git a/spec/requests/stop_areas_spec.rb b/spec/requests/stop_areas_spec.rb
deleted file mode 100644
index ef3ca9275..000000000
--- a/spec/requests/stop_areas_spec.rb
+++ /dev/null
@@ -1,56 +0,0 @@
-# -*- coding: utf-8 -*-
-require 'spec_helper'
-
-describe "StopAreas" do
- login_user
-
- let!(:stop_areas) { Array.new(2) { Factory(:stop_area) } }
- subject { stop_areas.first }
-
- describe "list" do
- it "display stop_areas" do
- visit referential_stop_areas_path(referential)
- page.should have_content(stop_areas.first.name)
- page.should have_content(stop_areas.last.name)
- end
- end
-
- describe "show" do
- it "display stop_area" do
- visit referential_stop_areas_path(referential)
- click_link "#{stop_areas.first.name}"
- page.should have_content(stop_areas.first.name)
- end
-
- it "display map" do
- visit referential_stop_areas_path(referential)
- click_link "#{stop_areas.first.name}"
- page.should have_selector("#map", :class => 'stop_area')
- end
-
- end
-
- describe "new" do
- it "creates stop_area and return to show" do
- visit referential_stop_areas_path(referential)
- click_link "Ajouter un arrêt"
- fill_in "Nom", :with => "StopArea 1"
- fill_in "Numéro d'enregistrement", :with => "test-1"
- fill_in "Identifiant Neptune", :with => "test:StopArea:1"
- click_button("Créer arrêt")
- page.should have_content("StopArea 1")
- end
- end
-
- describe "edit and return to show" do
- it "edit stop_area" do
- visit referential_stop_area_path(referential, subject)
- click_link "Modifier cet arrêt"
- fill_in "Nom", :with => "StopArea Modified"
- fill_in "Numéro d'enregistrement", :with => "test-1"
- click_button("Modifier arrêt")
- page.should have_content("StopArea Modified")
- end
- end
-
-end
diff --git a/spec/requests/stop_points_spec.rb b/spec/requests/stop_points_spec.rb
deleted file mode 100644
index 263711497..000000000
--- a/spec/requests/stop_points_spec.rb
+++ /dev/null
@@ -1,30 +0,0 @@
-# -*- coding: utf-8 -*-
-require 'spec_helper'
-
-describe "StopPoints" do
- login_user
-
- let(:line) { Factory(:line) }
- let(:route) { Factory(:route, :line => line) }
- let(:route2) { Factory(:route, :line => line) }
-
- describe "from route's page to a stop points page" do
- it "display route's stop points" do
- pending
- visit referential_line_route_path(referential,line,route)
- click_link "Gérer les arrêts de la séquence"
- route.stop_areas.each do |sa|
- page.should have_content(sa.name)
- end
- end
- end
- describe "from route's page, go to new stop point page" do
- it "display route's stop points" do
- pending
- visit referential_line_route_path(referential,line,route)
- click_link "Gérer les arrêts de la séquence"
- click_link "Ajouter un arrêt à la séquence"
- page.should have_content( "Sélectionner un arrêt")
- end
- end
-end
diff --git a/spec/requests/time_tables_spec.rb b/spec/requests/time_tables_spec.rb
deleted file mode 100644
index fbe03db2b..000000000
--- a/spec/requests/time_tables_spec.rb
+++ /dev/null
@@ -1,49 +0,0 @@
-# -*- coding: utf-8 -*-
-require 'spec_helper'
-
-describe "TimeTables" do
- login_user
-
- let!(:time_tables) { Array.new(2) { create(:time_table) } }
- subject { time_tables.first }
-
- describe "list" do
- it "display time_tables" do
- visit referential_time_tables_path(referential)
- page.should have_content(time_tables.first.comment)
- page.should have_content(time_tables.last.comment)
- end
-
- end
-
- describe "show" do
- it "display time_table" do
- visit referential_time_tables_path(referential)
- click_link "#{time_tables.first.comment}"
- page.should have_content(time_tables.first.comment)
- end
-
- end
-
- describe "new" do
- it "creates time_table and return to show" do
- visit referential_time_tables_path(referential)
- click_link "Ajouter un calendrier"
- fill_in "Nom", :with => "TimeTable 1"
- fill_in "Identifiant Neptune", :with => "test:Timetable:1"
- click_button("Créer Calendrier")
- page.should have_content("TimeTable 1")
- end
- end
-
- describe "edit and return to show" do
- it "edit time_table" do
- visit referential_time_table_path(referential, subject)
- click_link "Modifier ce calendrier"
- fill_in "Nom", :with => "TimeTable Modified"
- click_button("Modifier Calendrier")
- page.should have_content("TimeTable Modified")
- end
- end
-
-end
diff --git a/spec/requests/vehicle_journey_imports_spec.rb b/spec/requests/vehicle_journey_imports_spec.rb
deleted file mode 100644
index 68fe04e0b..000000000
--- a/spec/requests/vehicle_journey_imports_spec.rb
+++ /dev/null
@@ -1,68 +0,0 @@
-# -*- coding: utf-8 -*-
-require 'spec_helper'
-
-describe "VehicleJourneyImports" do
- login_user
-
- let!(:route) { create :route }
-
- let(:valid_file_path) {
- csv_file = update_csv_file_with_factory_data("vehicle_journey_imports_valid.csv")
- File.path(csv_file)
- }
-
- let(:invalid_file_path) {
- csv_file = update_csv_file_with_factory_data("vehicle_journey_imports_with_vjas_invalid.csv")
- File.path(csv_file)
- }
-
- def update_csv_file_with_factory_data(filename)
- csv_file = CSV.open("/tmp/#{filename}", "wb",{ :col_sep => ";"}) do |csv|
- counter = 0
- CSV.foreach( Rails.root.join("spec", "fixtures", "#{filename}").to_s , {:col_sep => ";"}) do |row|
- if counter == 0
- row2 = []
- row.each do |cell|
- cell = "" if cell == "import:VehicleJourney:1"
- cell = "" if cell == "import:VehicleJourney:2"
- cell = "" if cell == "import:VehicleJourney:3"
- row2 << cell
- end
- csv << row2
- elsif counter < 7
- csv << row
- else
- csv << ( row[0] = route.stop_points[counter - 7].id; row)
- end
- counter += 1
- end
-
- end
-
- File.open("/tmp/#{filename}")
- end
-
- describe "new" do
- it "should create vehicle journey file and return to route show page" do
- visit new_referential_line_route_vehicle_journey_import_path(referential, route.line, route)
- attach_file('Fichier', valid_file_path)
- click_button "Lancer l'import"
- expect(page).to have_content(I18n.t("vehicle_journey_imports.new.success"))
- expect(page).to have_content("Séquence d'arrêts #{route.name}")
- end
-
- it "should return error messages when file is invalid" do
- visit new_referential_line_route_vehicle_journey_import_path(referential, route.line, route)
- attach_file('Fichier', invalid_file_path)
- click_button "Lancer l'import"
- expect(page).to have_content(I18n.t("vehicle_journey_imports.errors.import_aborted"))
- end
-
- it "should return error message when file missing on upload" do
- visit new_referential_line_route_vehicle_journey_import_path(referential, route.line, route)
- click_button "Lancer l'import"
- expect(page).to have_content(I18n.t("vehicle_journey_imports.errors.import_aborted"))
- end
- end
-
-end