aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/select2s/CompanySelect2.js2
-rw-r--r--app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/select2s/MissionSelect2.js4
-rw-r--r--app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/select2s/TimetableSelect2.js4
-rw-r--r--app/assets/stylesheets/components/_select2.sass4
-rw-r--r--app/controllers/api/v1/netex_imports_controller.rb26
-rw-r--r--app/controllers/companies_controller.rb23
-rw-r--r--app/controllers/import_tasks_controller.rb1
-rw-r--r--app/controllers/networks_controller.rb23
-rw-r--r--app/controllers/referential_companies_controller.rb23
-rw-r--r--app/controllers/referential_networks_controller.rb23
-rw-r--r--app/controllers/time_tables_controller.rb24
-rw-r--r--app/models/import.rb2
-rw-r--r--app/models/netex_import.rb2
-rw-r--r--app/policies/referential_policy.rb6
-rw-r--r--app/views/api/v1/netex_imports/create.json.rabl3
-rw-r--r--config/environments/development.rb24
-rw-r--r--config/routes.rb37
-rw-r--r--db/migrate/20170715041954_add_parent_type_and_parent_id_to_imports.rb6
-rw-r--r--db/schema.rb4
-rw-r--r--spec/decorators/referential_decorator_spec.rb5
-rw-r--r--spec/factories/imports.rb4
-rw-r--r--spec/models/api/v1/api_key_spec.rb2
-rw-r--r--spec/models/import_spec.rb1
-rw-r--r--spec/policies/referential_policy_spec.rb2
-rw-r--r--spec/requests/api/v1/netex_import_spec.rb72
-rw-r--r--spec/routing/api/v1/access_links_routes_spec.rb9
-rw-r--r--spec/routing/group_of_lines_spec.rb4
27 files changed, 252 insertions, 88 deletions
diff --git a/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/select2s/CompanySelect2.js b/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/select2s/CompanySelect2.js
index a6b8dcfa1..d277be003 100644
--- a/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/select2s/CompanySelect2.js
+++ b/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/select2s/CompanySelect2.js
@@ -51,7 +51,7 @@ class BSelect4 extends React.Component{
},
cache: true
},
- minimumInputLength: 3,
+ minimumInputLength: 1,
templateResult: formatRepo
}}
/>
diff --git a/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/select2s/MissionSelect2.js b/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/select2s/MissionSelect2.js
index 89746da02..c04a1d642 100644
--- a/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/select2s/MissionSelect2.js
+++ b/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/select2s/MissionSelect2.js
@@ -43,14 +43,14 @@ class BSelect4 extends React.Component{
item => _.assign(
{},
item,
- { text: '<strong>' + _.last(_.split(item.object_id, ':')) + " - " + item.published_name + "</strong><br/><small>" + item.registration_number + "</small>" }
+ { text: "<strong>" + item.published_name + _.last(_.split(item.object_id, ':')) + "</strong><br/><small>" + item.registration_number + "</small>" }
)
)
};
},
cache: true
},
- minimumInputLength: 0,
+ minimumInputLength: 1,
escapeMarkup: function (markup) { return markup; },
templateResult: formatRepo
}}
diff --git a/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/select2s/TimetableSelect2.js b/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/select2s/TimetableSelect2.js
index dd098053e..3e81290f5 100644
--- a/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/select2s/TimetableSelect2.js
+++ b/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/select2s/TimetableSelect2.js
@@ -43,14 +43,14 @@ class BSelect4 extends React.Component{
item => _.assign(
{},
item,
- {text: '<strong>' + item.short_id + ' - ' + (item.color ? "<span class='fa fa-circle' style='color:" + item.color + "'></span> - " : '') + item.comment + '</strong><br/><small>' + item.day_types.match(/[A-Z]?[a-z]+/g).join(', ') + '</small>'}
+ {text: '<strong>' + (item.color ? "<span class='fa fa-circle' style='color:" + item.color + "'></span> " : '') + item.comment + ' - ' + item.short_id + '</strong><br/><small>' + item.day_types.match(/[A-Z]?[a-z]+/g).join(', ') + '</small>'}
)
)
};
},
cache: true
},
- minimumInputLength: 3,
+ minimumInputLength: 1,
escapeMarkup: function (markup) { return markup; },
templateResult: formatRepo
}}
diff --git a/app/assets/stylesheets/components/_select2.sass b/app/assets/stylesheets/components/_select2.sass
index 960e8b10b..332af16cd 100644
--- a/app/assets/stylesheets/components/_select2.sass
+++ b/app/assets/stylesheets/components/_select2.sass
@@ -7,6 +7,10 @@
// .select2-results__message, .loading-results
// display: none
+.select2-container, .select2-container--bootstrap
+ .select2-selection--single .select2-selection__rendered
+ height: 100%
+
.select2-selection__placeholder
color: rgba($grey, 0.65)
font-style: italic
diff --git a/app/controllers/api/v1/netex_imports_controller.rb b/app/controllers/api/v1/netex_imports_controller.rb
new file mode 100644
index 000000000..16a7cef69
--- /dev/null
+++ b/app/controllers/api/v1/netex_imports_controller.rb
@@ -0,0 +1,26 @@
+module Api
+ module V1
+ class NetexImportsController < ChouetteController
+
+ def create
+ respond_to do | format |
+ format.json do
+ @import = NetexImport.create(netex_import_params)
+ unless @import.valid?
+ render json: {errors: @import.errors}, status: 406
+ end
+ end
+ end
+ end
+
+
+ private
+
+ def netex_import_params
+ params
+ .require('netex_import')
+ .permit(:file, :name, :referential_id)
+ end
+ end
+ end
+end
diff --git a/app/controllers/companies_controller.rb b/app/controllers/companies_controller.rb
index 07a732fc9..cf27c39cf 100644
--- a/app/controllers/companies_controller.rb
+++ b/app/controllers/companies_controller.rb
@@ -16,14 +16,13 @@ class CompaniesController < BreadcrumbController
redirect_to params.merge(:page => 1)
end
- @companies = ModelDecorator.decorate(
- @companies,
- with: CompanyDecorator,
- context: {
- referential: line_referential
- }
- )
+ @companies = decorate_companies(@companies)
}
+
+ format.json {
+ @companies = decorate_companies(@companies)
+ }
+
build_breadcrumb :index
end
end
@@ -77,4 +76,14 @@ class CompaniesController < BreadcrumbController
%w[asc desc].include?(params[:direction]) ? params[:direction] : 'asc'
end
+ def decorate_companies(companies)
+ ModelDecorator.decorate(
+ companies,
+ with: CompanyDecorator,
+ context: {
+ referential: line_referential
+ }
+ )
+ end
+
end
diff --git a/app/controllers/import_tasks_controller.rb b/app/controllers/import_tasks_controller.rb
index 0e3ed6445..cb377ec5a 100644
--- a/app/controllers/import_tasks_controller.rb
+++ b/app/controllers/import_tasks_controller.rb
@@ -1,4 +1,3 @@
-# coding: utf-8
class ImportTasksController < ChouetteController
defaults :resource_class => ImportTask
diff --git a/app/controllers/networks_controller.rb b/app/controllers/networks_controller.rb
index d1f83340e..5dae1ba3f 100644
--- a/app/controllers/networks_controller.rb
+++ b/app/controllers/networks_controller.rb
@@ -37,14 +37,13 @@ class NetworksController < BreadcrumbController
redirect_to params.merge(:page => 1)
end
- @networks = ModelDecorator.decorate(
- @networks,
- with: NetworkDecorator,
- context: {
- line_referential: line_referential
- }
- )
+ @networks = decorate_networks(@networks)
}
+
+ format.js {
+ @networks = decorate_networks(@networks)
+ }
+
build_breadcrumb :index
end
end
@@ -87,4 +86,14 @@ class NetworksController < BreadcrumbController
%w[asc desc].include?(params[:direction]) ? params[:direction] : 'asc'
end
+ def decorate_networks(networks)
+ ModelDecorator.decorate(
+ networks,
+ with: NetworkDecorator,
+ context: {
+ line_referential: line_referential
+ }
+ )
+ end
+
end
diff --git a/app/controllers/referential_companies_controller.rb b/app/controllers/referential_companies_controller.rb
index 53dde93bb..482f74ea0 100644
--- a/app/controllers/referential_companies_controller.rb
+++ b/app/controllers/referential_companies_controller.rb
@@ -14,14 +14,13 @@ class ReferentialCompaniesController < ChouetteController
redirect_to params.merge(:page => 1)
end
- @companies = ModelDecorator.decorate(
- @companies,
- with: CompanyDecorator,
- context: {
- referential: referential
- }
- )
+ @companies = decorate_companies(@companies)
}
+
+ format.js {
+ @companies = decorate_companies(@companies)
+ }
+
build_breadcrumb :index
end
end
@@ -70,4 +69,14 @@ class ReferentialCompaniesController < ChouetteController
%w[asc desc].include?(params[:direction]) ? params[:direction] : 'asc'
end
+ def decorate_companies(companies)
+ ModelDecorator.decorate(
+ companies,
+ with: CompanyDecorator,
+ context: {
+ referential: referential
+ }
+ )
+ end
+
end
diff --git a/app/controllers/referential_networks_controller.rb b/app/controllers/referential_networks_controller.rb
index e0ce71ce4..ee2db8008 100644
--- a/app/controllers/referential_networks_controller.rb
+++ b/app/controllers/referential_networks_controller.rb
@@ -30,14 +30,13 @@ class ReferentialNetworksController < ChouetteController
redirect_to params.merge(:page => 1)
end
- @networks = ModelDecorator.decorate(
- @networks,
- with: ReferentialNetworkDecorator,
- context: {
- referential: referential
- }
- )
+ @networks = decorate_networks(@networks)
}
+
+ format.js {
+ @networks = decorate_networks(@networks)
+ }
+
build_breadcrumb :index
end
end
@@ -81,4 +80,14 @@ class ReferentialNetworksController < ChouetteController
%w[asc desc].include?(params[:direction]) ? params[:direction] : 'asc'
end
+ def decorate_networks(networks)
+ ModelDecorator.decorate(
+ networks,
+ with: ReferentialNetworkDecorator,
+ context: {
+ referential: referential
+ }
+ )
+ end
+
end
diff --git a/app/controllers/time_tables_controller.rb b/app/controllers/time_tables_controller.rb
index 20d500ea9..edeb5a32f 100644
--- a/app/controllers/time_tables_controller.rb
+++ b/app/controllers/time_tables_controller.rb
@@ -37,7 +37,7 @@ class TimeTablesController < ChouetteController
tt_params = time_table_params
if tt_params[:calendar_id]
%i(monday tuesday wednesday thursday friday saturday sunday).map { |d| tt_params[d] = true }
- calendar = current_organisation.calendars.find_by_id(tt_params[:calendar_id])
+ calendar = Calendar.find(tt_params[:calendar_id])
tt_params[:calendar_id] = nil if tt_params.has_key?(:dates_attributes) || tt_params.has_key?(:periods_attributes)
end
@@ -86,16 +86,14 @@ class TimeTablesController < ChouetteController
redirect_to params.merge(:page => 1)
end
- @time_tables = ModelDecorator.decorate(
- @time_tables,
- with: TimeTableDecorator,
- context: {
- referential: @referential
- }
- )
+ @time_tables = decorate_time_tables(@time_tables)
build_breadcrumb :index
}
+
+ format.js {
+ @time_tables = decorate_time_tables(@time_tables)
+ }
end
end
@@ -195,6 +193,16 @@ class TimeTablesController < ChouetteController
Chouette::TimeTable.find(from_id) if from_id
end
+ def decorate_time_tables(time_tables)
+ ModelDecorator.decorate(
+ time_tables,
+ with: TimeTableDecorator,
+ context: {
+ referential: @referential
+ }
+ )
+ end
+
def time_table_params
params.require(:time_table).permit(
:objectid,
diff --git a/app/models/import.rb b/app/models/import.rb
index 1a5062e2a..3d276c4ae 100644
--- a/app/models/import.rb
+++ b/app/models/import.rb
@@ -3,6 +3,8 @@ class Import < ActiveRecord::Base
belongs_to :workbench
belongs_to :referential
+ belongs_to :parent, class_name: to_s
+
extend Enumerize
enumerize :status, in: %i(new downloading analyzing pending successful failed running aborted canceled)
diff --git a/app/models/netex_import.rb b/app/models/netex_import.rb
index de5b84537..0cf4d0a7c 100644
--- a/app/models/netex_import.rb
+++ b/app/models/netex_import.rb
@@ -7,7 +7,7 @@ class NetexImport < Import
begin
Net::HTTP.get(URI("#{Rails.configuration.iev_url}/boiv_iev/referentials/importer/new?id=#{id}"))
rescue Exception => e
- logger.error "IEV server error : e.message"
+ logger.error "IEV server error : #{e.message}"
logger.error e.backtrace.inspect
end
end
diff --git a/app/policies/referential_policy.rb b/app/policies/referential_policy.rb
index 9d0a92093..fdc80516c 100644
--- a/app/policies/referential_policy.rb
+++ b/app/policies/referential_policy.rb
@@ -20,7 +20,7 @@ class ReferentialPolicy < ApplicationPolicy
def clone?
- !archived? && organisation_match? && create?
+ !archived? && create?
end
def archive?
@@ -37,7 +37,3 @@ class ReferentialPolicy < ApplicationPolicy
end
end
-
-
-
-
diff --git a/app/views/api/v1/netex_imports/create.json.rabl b/app/views/api/v1/netex_imports/create.json.rabl
new file mode 100644
index 000000000..1361cdb80
--- /dev/null
+++ b/app/views/api/v1/netex_imports/create.json.rabl
@@ -0,0 +1,3 @@
+
+object @import
+attributes :id, :type
diff --git a/config/environments/development.rb b/config/environments/development.rb
index 79fec2d35..648a9a82c 100644
--- a/config/environments/development.rb
+++ b/config/environments/development.rb
@@ -61,15 +61,17 @@ Rails.application.configure do
config.reflex_api_url = "https://pprod.reflex.stif.info/ws/reflex/V1/service=getData"
config.codifligne_api_url = "https://pprod.codifligne.stif.info/rest/v1/lc/getlist"
- # config.chouette_authentication_settings = {
- # type: "database"
- # }
- config.chouette_authentication_settings = {
- type: "cas",
- cas_server: "http://stif-portail-dev.af83.priv/sessions"
- }
- config.stif_portail_api =
- {
+ if Rails.env.development? && ENV['NO_VPN']
+ config.chouette_authentication_settings = {
+ type: "database"
+ }
+ else
+ config.chouette_authentication_settings = {
+ type: "cas",
+ cas_server: "http://stif-portail-dev.af83.priv/sessions"
+ }
+ end
+ config.stif_portail_api = {
key: "Ohphie1Voo6the5hohpi",
url: "http://stif-portail-dev.af83.priv"
}
@@ -80,8 +82,8 @@ Rails.application.configure do
config.portal_url = "http://stif-boiv-staging.af83.priv"
# IEV url
- config.iev_url = "http://localhost:8080"
- config.fe_url = "http://localhost:3000"
+ config.iev_url = ENV.fetch('IEV_URL', 'http://localhost:8080')
+ config.front_end_url = ENV.fetch('FRONT_END_URL', 'http://localhost:3000')
# file to data for demo
config.demo_data = "tmp/demo.zip"
diff --git a/config/routes.rb b/config/routes.rb
index 28c092e6a..0ed401cf5 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -32,25 +32,26 @@ ChouetteIhm::Application.routes.draw do
namespace :api do
namespace :v1 do
- resources :time_tables, :only => [:index, :show]
- resources :connection_links, :only => [:index, :show]
- resources :companies, :only => [:index, :show]
- resources :networks, :only => [:index, :show]
- resources :stop_areas, :only => [:index, :show]
- resources :group_of_lines, :only => [:index, :show]
- resources :access_points, :only => [:index, :show]
- resources :access_links, :only => [:index, :show]
- resources :lines, :only => [:index, :show] do
- resources :journey_patterns, :only => [:index, :show]
- resources :routes, :only => [:index, :show] do
- resources :vehicle_journeys, :only => [:index, :show]
- resources :journey_patterns, :only => [:index, :show]
- resources :stop_areas, :only => [:index, :show]
+ resources :access_links, only: [:index, :show]
+ resources :access_points, only: [:index, :show]
+ resources :connection_links, only: [:index, :show]
+ resources :companies, only: [:index, :show]
+ resources :group_of_lines, only: [:index, :show]
+ resources :netex_imports, only: :create
+ resources :journey_patterns, only: :show
+ resources :lines, only: [:index, :show] do
+ resources :journey_patterns, only: [:index, :show]
+ resources :routes, only: [:index, :show] do
+ resources :vehicle_journeys, only: [:index, :show]
+ resources :journey_patterns, only: [:index, :show]
+ resources :stop_areas, only: [:index, :show]
end
end
- resources :routes, :only => :show
- resources :journey_patterns, :only => :show
- resources :vehicle_journeys, :only => :show
+ resources :networks, only: [:index, :show]
+ resources :routes, only: :show
+ resources :stop_areas, only: [:index, :show]
+ resources :time_tables, only: [:index, :show]
+ resources :vehicle_journeys, only: :show
end
end
@@ -180,7 +181,7 @@ ChouetteIhm::Application.routes.draw do
resources :timebands
resources :access_points do
- resources :access_links
+ resources :access_links
end
resources :stop_areas, controller: "referential_stop_areas" do
diff --git a/db/migrate/20170715041954_add_parent_type_and_parent_id_to_imports.rb b/db/migrate/20170715041954_add_parent_type_and_parent_id_to_imports.rb
new file mode 100644
index 000000000..96c1c2a59
--- /dev/null
+++ b/db/migrate/20170715041954_add_parent_type_and_parent_id_to_imports.rb
@@ -0,0 +1,6 @@
+class AddParentTypeAndParentIdToImports < ActiveRecord::Migration
+ def change
+ add_column :imports, :parent_id, :bigint
+ add_column :imports, :parent_type, :string
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index e64e5c04a..b56027f48 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema.define(version: 20170607141317) do
+ActiveRecord::Schema.define(version: 20170715041954) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -285,6 +285,8 @@ ActiveRecord::Schema.define(version: 20170607141317) do
t.datetime "ended_at"
t.string "token_download"
t.string "type", limit: 255
+ t.integer "parent_id", limit: 8
+ t.string "parent_type"
end
add_index "imports", ["referential_id"], name: "index_imports_on_referential_id", using: :btree
diff --git a/spec/decorators/referential_decorator_spec.rb b/spec/decorators/referential_decorator_spec.rb
index 5de6b7e95..16da8d30b 100644
--- a/spec/decorators/referential_decorator_spec.rb
+++ b/spec/decorators/referential_decorator_spec.rb
@@ -25,7 +25,7 @@ RSpec.describe ReferentialDecorator, type: [:helper, :decorator] do
end
end
- context 'all rights and different organisation' do
+ context 'all rights and different organisation' do
let( :user ){ build_stubbed :allmighty_user }
@@ -33,10 +33,11 @@ RSpec.describe ReferentialDecorator, type: [:helper, :decorator] do
expect_action_link_elements.to be_empty
expect_action_link_hrefs.to eq([
referential_time_tables_path(object),
+ new_referential_path(from: object),
])
end
end
- context 'all rights and same organisation' do
+ context 'all rights and same organisation' do
let( :user ){ build_stubbed :allmighty_user, organisation: referential.organisation }
diff --git a/spec/factories/imports.rb b/spec/factories/imports.rb
index 6db4b6b5f..e19fe92bb 100644
--- a/spec/factories/imports.rb
+++ b/spec/factories/imports.rb
@@ -10,8 +10,8 @@ FactoryGirl.define do
started_at nil
ended_at nil
- factory :workbench_import do
- type 'WorkbenchImport'
+ factory :netex_import, class: NetexImport do
+ file {File.open(Rails.root.join('spec', 'fixtures', 'terminated_job.json'))}
end
end
end
diff --git a/spec/models/api/v1/api_key_spec.rb b/spec/models/api/v1/api_key_spec.rb
index eb8826c0e..8a34c9221 100644
--- a/spec/models/api/v1/api_key_spec.rb
+++ b/spec/models/api/v1/api_key_spec.rb
@@ -1,5 +1,3 @@
-require 'spec_helper'
-
describe Api::V1::ApiKey, :type => :model do
let!(:referential){create(:referential)}
subject { Api::V1::ApiKey.create( :name => "test", :referential => referential)}
diff --git a/spec/models/import_spec.rb b/spec/models/import_spec.rb
index a2855d086..34bfb0b23 100644
--- a/spec/models/import_spec.rb
+++ b/spec/models/import_spec.rb
@@ -3,6 +3,7 @@ require 'rails_helper'
RSpec.describe Import, :type => :model do
it { should belong_to(:referential) }
it { should belong_to(:workbench) }
+ it { should belong_to(:parent).class_name(described_class.to_s) }
it { should enumerize(:status).in(:new, :pending, :successful, :failed, :canceled, :running, :aborted ) }
diff --git a/spec/policies/referential_policy_spec.rb b/spec/policies/referential_policy_spec.rb
index 33d8e13e8..69d0eb17b 100644
--- a/spec/policies/referential_policy_spec.rb
+++ b/spec/policies/referential_policy_spec.rb
@@ -46,7 +46,7 @@ RSpec.describe ReferentialPolicy, type: :policy do
# ------------------
permissions :clone? do
- it_behaves_like 'permitted policy and same organisation', 'referentials.create', archived: true
+ it_behaves_like 'permitted policy', 'referentials.create', archived: true
end
permissions :archive? do
diff --git a/spec/requests/api/v1/netex_import_spec.rb b/spec/requests/api/v1/netex_import_spec.rb
new file mode 100644
index 000000000..9fbf8f801
--- /dev/null
+++ b/spec/requests/api/v1/netex_import_spec.rb
@@ -0,0 +1,72 @@
+RSpec.describe "NetexImport", type: :request do
+
+ describe 'POST netex_imports' do
+
+ let( :referential ){ create :referential }
+
+ let( :file_path ){'spec/fixtures/neptune.zip'}
+ let( :file ){ fixture_file_upload( file_path ) }
+
+ let( :post_request ) do
+ -> (attributes) do
+ post "/api/v1/netex_imports.json",
+ attributes,
+ authorization
+ end
+ end
+
+ let( :legal_attributes ) do
+ {
+ name: 'hello world',
+ file: file,
+ referential_id: referential.id
+ }
+ end
+
+ let( :illegal_attributes ) do
+ { referential_id: referential.id }
+ end
+
+ context 'with correct credentials and correct request' do
+ let( :authorization ){ authorization_token_header( get_api_key.token ) }
+
+
+ it 'succeeds' do
+ post_request.(netex_import: legal_attributes)
+ expect( response ).to be_success
+ expect( json_response_body ).to eq({'id' => NetexImport.last.id, 'type' => 'NetexImport'})
+ end
+
+ it 'creates a NetexImport object in the DB' do
+ expect{ post_request.(netex_import: legal_attributes) }.to change{NetexImport.count}.by(1)
+ end
+ end
+
+ context 'with incorrect credentials and correct request' do
+ let( :authorization ){ authorization_token_header( "#{referential.id}-incorrect_token") }
+
+ it 'does not succeed' do
+ post_request.(netex_import: legal_attributes)
+ expect( response.status ).to eq(401)
+ end
+
+ it 'does not create an Import object' do
+ expect{ post_request.(netex_import: legal_attributes) }.not_to change{Import.count}
+ end
+ end
+
+ context 'with correct credentials and incorrect request' do
+ let( :authorization ){ authorization_token_header( get_api_key.token ) }
+
+ it 'does not succeed' do
+ post_request.(netex_import: illegal_attributes)
+ expect( response.status ).to eq(406)
+ expect( json_response_body['errors']['file'] ).not_to be_empty
+ end
+
+ it 'does not create an Import object' do
+ expect{ post_request.(netex_import: illegal_attributes) }.not_to change{Import.count}
+ end
+ end
+ end
+end
diff --git a/spec/routing/api/v1/access_links_routes_spec.rb b/spec/routing/api/v1/access_links_routes_spec.rb
new file mode 100644
index 000000000..9164d3f05
--- /dev/null
+++ b/spec/routing/api/v1/access_links_routes_spec.rb
@@ -0,0 +1,9 @@
+RSpec.describe Api::V1::AccessLinksController, type: :controller do
+
+ it 'routes to index' do
+ expect( get: '/api/v1/access_links' ).to route_to(
+ controller: 'api/v1/access_links',
+ action: 'index'
+ )
+ end
+end
diff --git a/spec/routing/group_of_lines_spec.rb b/spec/routing/group_of_lines_spec.rb
index 2a7262893..01ebeefe4 100644
--- a/spec/routing/group_of_lines_spec.rb
+++ b/spec/routing/group_of_lines_spec.rb
@@ -1,6 +1,4 @@
-require 'spec_helper'
-
-describe GroupOfLinesController do
+RSpec.describe GroupOfLinesController do
describe "routing" do
it "not recognize #routes" do
expect(get( "/line_referentials/1/group_of_lines/2/routes")).not_to route_to(