aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZakaria BOUZIANE2015-02-05 14:25:01 +0100
committerZakaria BOUZIANE2015-02-05 14:25:01 +0100
commit9f6b38135146baf3b13ce03685937b6da13e3e13 (patch)
tree6f00517e1c0ed8b896a42f68ea57341dc587be73
parente39ab9fc826ecc24466ea441f636681e1c284b0b (diff)
downloadchouette-core-9f6b38135146baf3b13ce03685937b6da13e3e13.tar.bz2
Access points features specs
-rw-r--r--spec/features/access_points_spec.rb63
-rw-r--r--spec/features/group_of_lines_spec.rb19
2 files changed, 72 insertions, 10 deletions
diff --git a/spec/features/access_points_spec.rb b/spec/features/access_points_spec.rb
new file mode 100644
index 000000000..21cfec851
--- /dev/null
+++ b/spec/features/access_points_spec.rb
@@ -0,0 +1,63 @@
+# -*- coding: utf-8 -*-
+require 'spec_helper'
+
+describe "Access points", :type => :feature do
+ login_user
+
+ let!(:stop_area) { create(:stop_area) }
+ let!(:access_points) { Array.new(2) { create(:access_point, :stop_area => stop_area) } }
+ subject { access_points.first }
+
+ describe "list" do
+
+ it "displays a list of access points" do
+ visit referential_stop_area_access_points_path(referential, stop_area)
+ #save_and_open_page
+ access_points.each do |ap|
+ expect(page).to have_content(ap.name)
+ end
+ end
+
+ end
+
+ describe "show" do
+
+ it "displays an access point" do
+ access_points.each do |ap|
+ visit referential_stop_area_path(referential, stop_area)
+ click_link ap.name
+ expect(page).to have_content(ap.name)
+ end
+ end
+
+ it "displays a map" do
+ access_points.each do |ap|
+ visit referential_stop_area_path(referential, stop_area)
+ click_link ap.name
+ expect(page).to have_selector("#map.access_point")
+ end
+ end
+
+ end
+
+ describe "new" do
+ it "creates an access point" do
+ visit referential_stop_area_path(referential, stop_area)
+ click_link I18n.t("access_points.actions.new")
+ fill_in "access_point[name]", :with => "My Access Point Name"
+ click_button(I18n.t('formtastic.create',model: I18n.t('activerecord.models.access_point.one')))
+ expect(page).to have_content("My Access Point Name")
+ end
+ end
+
+ describe "edit" do
+ it "edits an acess point" do
+ visit referential_stop_area_access_point_path(referential, stop_area, subject)
+ click_link I18n.t("access_points.actions.edit")
+ fill_in "access_point[name]", :with => "My New Access Point Name"
+ click_button(I18n.t('formtastic.update',model: I18n.t('activerecord.models.access_point.one')))
+ expect(page).to have_content("My New Access Point Name")
+ end
+ end
+
+end
diff --git a/spec/features/group_of_lines_spec.rb b/spec/features/group_of_lines_spec.rb
index abcc87385..213806ed6 100644
--- a/spec/features/group_of_lines_spec.rb
+++ b/spec/features/group_of_lines_spec.rb
@@ -4,10 +4,10 @@ require 'spec_helper'
describe "Group of lines", :type => :feature do
login_user
- let!(:network) { Factory(:network) }
- let!(:company) { Factory(:company) }
- let!(:line) { Factory(:line_with_stop_areas, :network => network, :company => company) }
- let!(:group_of_lines) { Array.new(2) { Factory(:group_of_line) } }
+ let!(:network) { create(:network) }
+ let!(:company) { create(:company) }
+ let!(:line) { create(:line_with_stop_areas, :network => network, :company => company) }
+ let!(:group_of_lines) { Array.new(2) { create(:group_of_line) } }
subject { group_of_lines.first }
before :each do
@@ -39,11 +39,11 @@ describe "Group of lines", :type => :feature do
describe "new" do
it "creates group of line and return to show" do
visit referential_group_of_lines_path(referential)
- click_link "Ajouter un groupe de ligne"
+ click_link I18n.t('group_of_lines.actions.new')
fill_in "group_of_line[name]", :with => "Group of lines 1"
fill_in "group_of_line[registration_number]", :with => "1"
fill_in "group_of_line[objectid]", :with => "test:GroupOfLine:999"
- click_button("Créer groupe de ligne")
+ click_button(I18n.t('formtastic.create',model: I18n.t('activerecord.models.group_of_line.one')))
expect(page).to have_content("Group of lines 1")
end
end
@@ -51,13 +51,12 @@ describe "Group of lines", :type => :feature do
describe "edit and return to show" do
it "edit line" do
visit referential_group_of_line_path(referential, subject)
- click_link "Modifier ce groupe de lignes"
+ click_link I18n.t('group_of_lines.actions.edit')
fill_in "group_of_line[name]", :with => "Group of lines Modified"
fill_in "group_of_line[registration_number]", :with => "test-1"
- click_button("Modifier groupe de lignes")
+ click_button(I18n.t('formtastic.update',model: I18n.t('activerecord.models.group_of_line.one')))
expect(page).to have_content("Group of lines Modified")
end
end
-
-
+
end