aboutsummaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorLuc Donnet2016-11-20 16:42:59 +0100
committerLuc Donnet2016-11-20 16:42:59 +0100
commiteccecf8d2cf9c6942993f831565f55eb4943068b (patch)
treeee4a40f3ffeacf5af193368805ad8083d9659f57 /spec
parentc78b4848f74418ab3fe2e85c1d71c3c702962125 (diff)
parent0da1c38f128533a88e226e62110c9ab16777a9a4 (diff)
downloadchouette-core-eccecf8d2cf9c6942993f831565f55eb4943068b.tar.bz2
Merge branch 'master' of github.com:AF83/stif-boiv
Diffstat (limited to 'spec')
-rw-r--r--spec/features/vehicle_journey_imports_spec.rb24
-rw-r--r--spec/models/referential_spec.rb2
2 files changed, 13 insertions, 13 deletions
diff --git a/spec/features/vehicle_journey_imports_spec.rb b/spec/features/vehicle_journey_imports_spec.rb
index f18d9baf0..262d585f2 100644
--- a/spec/features/vehicle_journey_imports_spec.rb
+++ b/spec/features/vehicle_journey_imports_spec.rb
@@ -4,7 +4,7 @@ require 'csv'
describe "VehicleJourneyImports", :type => :feature do
login_user
-
+
let!(:route) { create :route }
let(:valid_file_path) {
@@ -24,16 +24,16 @@ describe "VehicleJourneyImports", :type => :feature do
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"
+ 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 < 8
csv << row
else
- csv << ( row[0] = route.stop_points[counter - 8].id; row)
+ csv << ( row[0] = route.stop_points[counter - 8].id; row)
end
counter += 1
end
@@ -42,14 +42,14 @@ describe "VehicleJourneyImports", :type => :feature do
File.open("/tmp/#{filename}")
end
-
- describe "new" do
+
+ 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}")
+ expect(page).to have_content("Itinéraire #{route.name}")
end
it "should return error messages when file is invalid" do
@@ -58,12 +58,12 @@ describe "VehicleJourneyImports", :type => :feature do
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
+ expect(page).to have_content(I18n.t("vehicle_journey_imports.errors.import_aborted"))
+ end
end
-
+
end
diff --git a/spec/models/referential_spec.rb b/spec/models/referential_spec.rb
index c1205c9f0..4c9338aa6 100644
--- a/spec/models/referential_spec.rb
+++ b/spec/models/referential_spec.rb
@@ -12,7 +12,7 @@ describe Referential, :type => :model do
it { should belong_to(:workbench) }
context "Cloning referential" do
- let(:cloned) { create(:referential, created_from: ref) }
+ let(:cloned) { Referential.new_from(ref).tap(&:save!) }
it 'should create a ReferentialCloning' do
expect { cloned }.to change{ReferentialCloning.count}.by(1)