aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Gemfile4
-rw-r--r--Gemfile.lock16
-rw-r--r--spec/controllers/routes_controller_spec.rb2
-rw-r--r--spec/exporters/chouette/kml/exporter_spec.rb24
-rw-r--r--spec/factories.rb88
-rw-r--r--spec/features/connection_links_spec.rb2
-rw-r--r--spec/features/lines_spec.rb8
-rw-r--r--spec/features/networks_spec.rb12
-rw-r--r--spec/features/stop_areas_spec.rb2
-rw-r--r--spec/models/api/v1/api_key_spec.rb2
-rw-r--r--spec/models/ninoxe_extension_spec.rb4
-rw-r--r--spec/models/referential_spec.rb2
-rw-r--r--spec/models/time_table_combination_spec.rb6
-rw-r--r--spec/models/user_spec.rb6
-rw-r--r--spec/models/vehicle_journey_import_spec.rb1
-rw-r--r--spec/models/vehicle_translation_spec.rb8
-rw-r--r--spec/views/rule_parameter_sets/index.html.erb_spec.rb4
-rw-r--r--spec/views/rule_parameter_sets/new.html.erb_spec.rb4
18 files changed, 98 insertions, 97 deletions
diff --git a/Gemfile b/Gemfile
index 2204206f9..ddc15b7d8 100644
--- a/Gemfile
+++ b/Gemfile
@@ -113,7 +113,7 @@ gem 'squeel'
gem 'ninoxe', :git => 'https://github.com/afimb/ninoxe.git', :branch => "rails4"
#gem 'ninoxe', :git => 'https://github.com/afimb/ninoxe.git'
-#gem 'ninoxe',:path => '~/workspace/chouette/ninoxe'
+#gem 'ninoxe',:path => '~/Projets/cityway/ninoxe'
gem 'acts_as_list', '~> 0.6.0'
gem "acts_as_tree", '~> 2.1.0', :require => "acts_as_tree"
@@ -137,7 +137,7 @@ group :test, :development do
gem 'capybara', "~> 2.4.0"
gem 'poltergeist'
gem 'launchy'
- gem 'factory_girl_rails', '1.7'
+ gem 'factory_girl_rails', '~> 4.0'
# gem 'i18n-tasks'
gem 'rb-inotify', :require => RUBY_PLATFORM.include?('linux') && 'rb-inotify'
gem 'rb-fsevent', :require => RUBY_PLATFORM.include?('darwin') && 'rb-fsevent'
diff --git a/Gemfile.lock b/Gemfile.lock
index 8694dcb13..467920b81 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -1,6 +1,6 @@
GIT
remote: https://github.com/afimb/ninoxe.git
- revision: 581fb0b69e22ede7b176116462848b3d2592423b
+ revision: 792ee2e41f6cec1608fb2762bb86e54e95e97e55
branch: rails4
specs:
ninoxe (1.1.3)
@@ -57,7 +57,7 @@ GEM
minitest (~> 5.1)
thread_safe (~> 0.1)
tzinfo (~> 1.1)
- acts-as-taggable-on (3.4.3)
+ acts-as-taggable-on (3.4.4)
activerecord (>= 3.2, < 5)
acts_as_list (0.6.0)
activerecord (>= 3.0)
@@ -107,7 +107,7 @@ GEM
coffee-script-source (1.8.0)
daemons (1.1.9)
database_cleaner (1.4.0)
- dbf (2.0.7)
+ dbf (2.0.8)
fastercsv (~> 1.5.4)
deep_cloneable (2.0.2)
activerecord (>= 3.1.0, < 5.0.0)
@@ -136,10 +136,10 @@ GEM
activesupport (>= 3.2)
erubis (2.7.0)
execjs (2.2.2)
- factory_girl (2.6.4)
- activesupport (>= 2.3.9)
- factory_girl_rails (1.7.0)
- factory_girl (~> 2.6.0)
+ factory_girl (4.5.0)
+ activesupport (>= 3.0.0)
+ factory_girl_rails (4.5.0)
+ factory_girl (~> 4.5.0)
railties (>= 3.0.0)
faraday (0.9.1)
multipart-post (>= 1.2, < 3)
@@ -470,7 +470,7 @@ DEPENDENCIES
devise-encryptable
devise-i18n
devise_invitable
- factory_girl_rails (= 1.7)
+ factory_girl_rails (~> 4.0)
faraday (~> 0.9.1)
faraday_middleware (~> 0.9.1)
font-awesome-sass (~> 4.2.0)
diff --git a/spec/controllers/routes_controller_spec.rb b/spec/controllers/routes_controller_spec.rb
index 06d24f3e6..eb3d353c2 100644
--- a/spec/controllers/routes_controller_spec.rb
+++ b/spec/controllers/routes_controller_spec.rb
@@ -3,7 +3,7 @@ require 'spec_helper'
describe RoutesController, :type => :controller do
login_user
- let!(:route) { Factory(:route) }
+ let!(:route) { create(:route) }
it { is_expected.to be_kind_of(ChouetteController) }
diff --git a/spec/exporters/chouette/kml/exporter_spec.rb b/spec/exporters/chouette/kml/exporter_spec.rb
index 843b2d2af..b9fd0ef98 100644
--- a/spec/exporters/chouette/kml/exporter_spec.rb
+++ b/spec/exporters/chouette/kml/exporter_spec.rb
@@ -2,22 +2,22 @@ require 'spec_helper'
describe Chouette::Kml::Exporter do
- # let(:referential) { Factory(:referential) }
+ # let(:referential) { create(:referential) }
# subject { Chouette::Kml::Exporter.new(referential) }
# let(:zip_file_path) { "#{Rails.root}/tmp/exports/test.zip" }
# let(:line) {
# referential.switch
- # Factory(:line_with_stop_areas_having_parent) }
+ # create(:line_with_stop_areas_having_parent) }
- let(:kml_export){ Factory(:kml_export)}
+ let(:kml_export){ create(:kml_export)}
subject { Chouette::Kml::Exporter.new(first_referential, kml_export) }
let(:tmp_path) { File.join( Rails.root, "tmp")}
let(:exports_path) { File.join( tmp_path, "exports")}
let(:zip_file_path) { File.join( exports_path, "test.zip")}
- let!(:line) { Factory(:line_with_stop_areas_having_parent) }
- let!(:line2) { Factory(:line_with_stop_areas_having_parent) }
+ let!(:line) { create(:line_with_stop_areas_having_parent) }
+ let!(:line2) { create(:line_with_stop_areas_having_parent) }
describe "#export" do
before(:each) do
@@ -28,25 +28,25 @@ describe Chouette::Kml::Exporter do
it "should return a zip file with nothing inside with no objects in arguments" do
subject.export(zip_file_path, {:export_id => 1, :o => "line"} )
expect(File.exists?(zip_file_path)).to be_truthy
- expect(::Zip::File.open(zip_file_path).size).to eq(6)
+ expect(::Zip::File.open(zip_file_path).size).to eq(8)
end
- it "should return a zip file with 4 kml files" do
+ it "should return a zip file with 5 kml files" do
subject.export(zip_file_path, {:export_id => 1, :o => "line", :id => "#{line.id}" } )
expect(File.exists?(zip_file_path)).to be_truthy
- expect(::Zip::File.open(zip_file_path).size).to eq(4)
+ expect(::Zip::File.open(zip_file_path).size).to eq(5)
end
- it "should return a zip file with 6 kml files" do
+ it "should return a zip file with 8 kml files" do
subject.export(zip_file_path, {:export_id => 1, :o => "line", :id => "#{line.id},#{line2.id}" } )
expect(File.exists?(zip_file_path)).to be_truthy
- expect(::Zip::File.open(zip_file_path).size).to eq(6)
+ expect(::Zip::File.open(zip_file_path).size).to eq(8)
end
- it "should return a zip file with 6 kml files" do
+ it "should return a zip file with 8 kml files" do
subject.export(zip_file_path, {:export_id => 1, :o => "", :id => "" } )
expect(File.exists?(zip_file_path)).to be_truthy
- expect(::Zip::File.open(zip_file_path).size).to eq(6)
+ expect(::Zip::File.open(zip_file_path).size).to eq(8)
end
end
diff --git a/spec/factories.rb b/spec/factories.rb
index 2599645d3..645807b28 100644
--- a/spec/factories.rb
+++ b/spec/factories.rb
@@ -1,73 +1,73 @@
FactoryGirl.define do
- factory :organisation do |f|
- f.sequence(:name) { |n| "Organisation #{n}" }
+ factory :organisation do
+ sequence(:name) { |n| "Organisation #{n}" }
end
- factory :referential do |f|
- f.sequence(:name) { |n| "Test #{n}" }
- f.sequence(:slug) { |n| "test_#{n}" }
- f.sequence(:prefix) { |n| "test_#{n}" }
- f.association :organisation
+ factory :referential do
+ sequence(:name) { |n| "Test #{n}" }
+ sequence(:slug) { |n| "test_#{n}" }
+ sequence(:prefix) { |n| "test_#{n}" }
+ association :organisation
- f.time_zone "Europe/Paris"
+ time_zone "Europe/Paris"
end
- factory :rule_parameter_set do |f|
- f.sequence(:name) { |n| "Test #{n}" }
- f.association :referential
- f.after_create do |rsp|
+ factory :rule_parameter_set do
+ sequence(:name) { |n| "Test #{n}" }
+ association :referential
+ after(:create) do |rsp|
rsp.parameters = RuleParameterSet.default_for_all_modes( rsp.referential).parameters
end
end
- factory :user do |f|
- f.association :organisation
- f.sequence(:name) { |n| "chouette#{n}" }
- f.sequence(:email) { |n| "chouette#{n}@dryade.priv" }
- f.password "secret"
- f.password_confirmation "secret"
+ factory :user do
+ association :organisation
+ sequence(:name) { |n| "chouette#{n}" }
+ sequence(:email) { |n| "chouette#{n}@dryade.priv" }
+ password "secret"
+ password_confirmation "secret"
end
factory :import_task do |f|
- f.user_name "dummy"
- f.user_id 123
- f.no_save false
- f.format "Neptune"
- f.resources { Rack::Test::UploadedFile.new 'spec/fixtures/neptune.zip', 'application/zip', false }
- f.referential { Referential.find_by_slug("first") }
+ user_name "dummy"
+ user_id 123
+ no_save false
+ format "Neptune"
+ resources { Rack::Test::UploadedFile.new 'spec/fixtures/neptune.zip', 'application/zip', false }
+ referential { Referential.find_by_slug("first") }
end
- factory :kml_export do |f|
- f.referential { Referential.find_by_slug("first") }
+ factory :kml_export do
+ referential { Referential.find_by_slug("first") }
end
- factory :export do |f|
- f.referential { Referential.find_by_slug("first") }
+ factory :export do
+ referential { Referential.find_by_slug("first") }
end
- factory :export_log_message do |f|
- f.association :export
- f.sequence(:key) { "key_#{n}" }
+ factory :export_log_message do
+ association :export
+ sequence(:key) { |n| "key_#{n}" }
end
- factory :vehicle_translation do |f|
- f.count 1
- f.duration 1
+ factory :vehicle_translation do
+ count 1
+ duration 1
end
- factory :compliance_check_result do |f|
- f.association :compliance_check_task
- f.rule_code "2-NEPTUNE-StopArea-6"
- f.severity "warning"
- f.status "nok"
+ factory :compliance_check_result do
+ association :compliance_check_task
+ rule_code "2-NEPTUNE-StopArea-6"
+ severity "warning"
+ status "nok"
end
- factory :compliance_check_task do |f|
- f.user_id 1
- f.user_name "Dummy"
- f.status "pending"
- f.referential { Referential.find_by_slug("first") }
+ factory :compliance_check_task do
+ user_id 1
+ user_name "Dummy"
+ status "pending"
+ referential { Referential.find_by_slug("first") }
end
factory :time_table_combination
diff --git a/spec/features/connection_links_spec.rb b/spec/features/connection_links_spec.rb
index d77189d41..788e58326 100644
--- a/spec/features/connection_links_spec.rb
+++ b/spec/features/connection_links_spec.rb
@@ -24,7 +24,7 @@ describe "ConnectionLinks", :type => :feature do
end
it "display map" do
- allow(subject).to receive(:stop_areas).and_return(Array.new(2) { Factory(:stop_area) })
+ allow(subject).to receive(:stop_areas).and_return(Array.new(2) { create(:stop_area) })
visit referential_connection_links_path(referential)
click_link "#{connection_links.first.name}"
expect(page).to have_selector("#map.connection_link")
diff --git a/spec/features/lines_spec.rb b/spec/features/lines_spec.rb
index 104d45b99..cdf38f97a 100644
--- a/spec/features/lines_spec.rb
+++ b/spec/features/lines_spec.rb
@@ -4,10 +4,10 @@ require 'spec_helper'
describe "Lines", :type => :feature 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) } }
- let!(:group_of_line) { Factory(:group_of_line) }
+ let!(:network) { create(:network) }
+ let!(:company) { create(:company) }
+ let!(:lines) { Array.new(2) { create(:line_with_stop_areas, :network => network, :company => company) } }
+ let!(:group_of_line) { create(:group_of_line) }
subject { lines.first }
describe "list" do
diff --git a/spec/features/networks_spec.rb b/spec/features/networks_spec.rb
index ec65209eb..c2433f04e 100644
--- a/spec/features/networks_spec.rb
+++ b/spec/features/networks_spec.rb
@@ -4,7 +4,7 @@ require 'spec_helper'
describe "Networks", :type => :feature do
login_user
- let!(:networks) { Array.new(2) { Factory(:network) } }
+ let!(:networks) { Array.new(2) { create(:network) } }
subject { networks.first }
describe "list" do
@@ -18,14 +18,14 @@ describe "Networks", :type => :feature do
describe "show" do
it "display network" do
- allow(subject).to receive(:stop_areas).and_return(Array.new(2) { Factory(:stop_area) })
+ allow(subject).to receive(:stop_areas).and_return(Array.new(2) { create(:stop_area) })
visit referential_networks_path(referential)
click_link "#{networks.first.name}"
expect(page).to have_content(networks.first.name)
end
it "display map" do
- allow(subject).to receive(:stop_areas).and_return(Array.new(2) { Factory(:stop_area) })
+ allow(subject).to receive(:stop_areas).and_return(Array.new(2) { create(:stop_area) })
visit referential_networks_path(referential)
click_link "#{networks.first.name}"
expect(page).to have_selector("#map.network")
@@ -35,7 +35,7 @@ describe "Networks", :type => :feature do
describe "new" do
it "creates network and return to show" do
- allow(subject).to receive(:stop_areas).and_return(Array.new(2) { Factory(:stop_area) })
+ allow(subject).to receive(:stop_areas).and_return(Array.new(2) { create(:stop_area) })
visit referential_networks_path(referential)
click_link "Ajouter un réseau"
fill_in "network_name", :with => "Network 1"
@@ -48,7 +48,7 @@ describe "Networks", :type => :feature do
describe "edit and return to show" do
it "edit network" do
- allow(subject).to receive(:stop_areas).and_return(Array.new(2) { Factory(:stop_area) })
+ allow(subject).to receive(:stop_areas).and_return(Array.new(2) { create(:stop_area) })
visit referential_network_path(referential, subject)
click_link "Modifier ce réseau"
fill_in "network_name", :with => "Network Modified"
@@ -60,7 +60,7 @@ describe "Networks", :type => :feature do
# 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) })
+ # subject.stub(:stop_areas).and_return(Array.new(2) { create(:stop_area) })
# visit referential_network_path(referential, subject)
# click_link "Supprimer ce réseau"
# page.evaluate_script('window.confirm = function() { return true; }')
diff --git a/spec/features/stop_areas_spec.rb b/spec/features/stop_areas_spec.rb
index ff5a73438..404298b97 100644
--- a/spec/features/stop_areas_spec.rb
+++ b/spec/features/stop_areas_spec.rb
@@ -4,7 +4,7 @@ require 'spec_helper'
describe "StopAreas", :type => :feature do
login_user
- let!(:stop_areas) { Array.new(2) { Factory(:stop_area) } }
+ let!(:stop_areas) { Array.new(2) { create(:stop_area) } }
subject { stop_areas.first }
describe "list" do
diff --git a/spec/models/api/v1/api_key_spec.rb b/spec/models/api/v1/api_key_spec.rb
index 3da11527c..eb8826c0e 100644
--- a/spec/models/api/v1/api_key_spec.rb
+++ b/spec/models/api/v1/api_key_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
describe Api::V1::ApiKey, :type => :model do
- let!(:referential){Factory(:referential)}
+ let!(:referential){create(:referential)}
subject { Api::V1::ApiKey.create( :name => "test", :referential => referential)}
it "test" do
diff --git a/spec/models/ninoxe_extension_spec.rb b/spec/models/ninoxe_extension_spec.rb
index 91d259fb6..f2970a5cb 100644
--- a/spec/models/ninoxe_extension_spec.rb
+++ b/spec/models/ninoxe_extension_spec.rb
@@ -3,7 +3,7 @@ require 'spec_helper'
describe Chouette::StopArea do
# check override methods
- subject {Factory(:stop_area)}
+ subject {create(:stop_area)}
it "should return referential projection " do
subject.referential.projection_type='27572'
@@ -31,7 +31,7 @@ end
describe Chouette::AccessPoint do
# check override methods
- subject {Factory(:access_point)}
+ subject {create(:access_point)}
it "should return referential projection " do
subject.referential.projection_type='27572'
diff --git a/spec/models/referential_spec.rb b/spec/models/referential_spec.rb
index 2b6432a2e..c503cd00f 100644
--- a/spec/models/referential_spec.rb
+++ b/spec/models/referential_spec.rb
@@ -3,7 +3,7 @@ require 'spec_helper'
describe Referential, :type => :model do
it "create a rule_parameter_set" do
- referential = Factory.create(:referential)
+ referential = create(:referential)
expect(referential.rule_parameter_sets.size).to eq(1)
end
end
diff --git a/spec/models/time_table_combination_spec.rb b/spec/models/time_table_combination_spec.rb
index a0f14bcf0..7b6f9638e 100644
--- a/spec/models/time_table_combination_spec.rb
+++ b/spec/models/time_table_combination_spec.rb
@@ -1,9 +1,9 @@
require 'spec_helper'
describe TimeTableCombination, :type => :model do
- let!(:source){ Factory(:time_table)}
- let!(:combined){Factory(:time_table)}
- subject {Factory.build(:time_table_combination)}
+ let!(:source){ create(:time_table)}
+ let!(:combined){create(:time_table)}
+ subject {build(:time_table_combination)}
describe "#combine" do
context "when operation is union" do
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index c818f9673..e22e53797 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -5,10 +5,10 @@ describe User, :type => :model do
#it { should validate_presence_of :name }
describe "#destroy" do
- let!(:organisation){Factory(:organisation)}
- let!(:user){Factory(:user, :organisation => organisation)}
+ let!(:organisation){create(:organisation)}
+ let!(:user){create(:user, :organisation => organisation)}
context "user's organisation contains many user" do
- let!(:other_user){Factory(:user, :organisation => organisation)}
+ let!(:other_user){create(:user, :organisation => organisation)}
it "should destoy also user's organisation" do
user.destroy
expect(Organisation.where(:name => organisation.name).exists?).to be_truthy
diff --git a/spec/models/vehicle_journey_import_spec.rb b/spec/models/vehicle_journey_import_spec.rb
index c2f9f473d..9d9a8e15e 100644
--- a/spec/models/vehicle_journey_import_spec.rb
+++ b/spec/models/vehicle_journey_import_spec.rb
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
require 'spec_helper'
+require 'csv'
describe VehicleJourneyImport, :type => :model do
diff --git a/spec/models/vehicle_translation_spec.rb b/spec/models/vehicle_translation_spec.rb
index a2f3e486b..7a02eaf94 100644
--- a/spec/models/vehicle_translation_spec.rb
+++ b/spec/models/vehicle_translation_spec.rb
@@ -1,9 +1,9 @@
require 'spec_helper'
describe VehicleTranslation, :type => :model do
- let!(:company){ Factory(:company )}
- let!(:journey_pattern){Factory(:journey_pattern)}
- let!(:vehicle_journey){ Factory(:vehicle_journey,
+ let!(:company){ create(:company )}
+ let!(:journey_pattern){create(:journey_pattern)}
+ let!(:vehicle_journey){ create(:vehicle_journey,
:objectid => "dummy",
:journey_pattern => journey_pattern,
:route => journey_pattern.route,
@@ -11,7 +11,7 @@ describe VehicleTranslation, :type => :model do
:transport_mode => Chouette::TransportMode.new("metro"),
:published_journey_name => "dummy"
)}
- subject {Factory.build(:vehicle_translation,
+ subject {build(:vehicle_translation,
:vehicle_journey_id => vehicle_journey.id,
:first_stop_time => "12:00",
:departure_or_arrival => "departure",
diff --git a/spec/views/rule_parameter_sets/index.html.erb_spec.rb b/spec/views/rule_parameter_sets/index.html.erb_spec.rb
index 7d2206394..a2ed45665 100644
--- a/spec/views/rule_parameter_sets/index.html.erb_spec.rb
+++ b/spec/views/rule_parameter_sets/index.html.erb_spec.rb
@@ -3,8 +3,8 @@ require 'spec_helper'
describe "/rule_parameter_sets/index", :type => :view do
assign_referential
- let!(:rule_parameter_sets) { assign :rule_parameter_sets, [ Factory(:rule_parameter_set),
- Factory(:rule_parameter_set)] }
+ let!(:rule_parameter_sets) { assign :rule_parameter_sets, [ create(:rule_parameter_set),
+ create(:rule_parameter_set)] }
it "should render a show link for each rule_parameter_set" do
render
diff --git a/spec/views/rule_parameter_sets/new.html.erb_spec.rb b/spec/views/rule_parameter_sets/new.html.erb_spec.rb
index 66e8a72bf..eed25b8f6 100644
--- a/spec/views/rule_parameter_sets/new.html.erb_spec.rb
+++ b/spec/views/rule_parameter_sets/new.html.erb_spec.rb
@@ -6,7 +6,7 @@ describe "/rule_parameter_sets/new", :type => :view do
let!(:rule_parameter_set) { assign :rule_parameter_set, build( :rule_parameter_set, :referential => referential) }
describe "form" do
-
+
it "should render input for name" do
render
expect(rendered).to have_selector("form") do
@@ -21,6 +21,6 @@ describe "/rule_parameter_sets/new", :type => :view do
end
end
-
+
end