aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/controllers/api/v1/imports_controller.rb10
-rw-r--r--app/controllers/imports_controller.rb2
-rw-r--r--config/environments/development.rb23
-rw-r--r--config/routes.rb37
-rw-r--r--spec/models/api/v1/netex_import_spec.rb15
-rw-r--r--spec/routing/api/v1/access_links_routes_spec.rb9
-rw-r--r--spec/routing/api/v1/import_routes_spec.rb10
-rw-r--r--spec/routing/group_of_lines_spec.rb4
8 files changed, 79 insertions, 31 deletions
diff --git a/app/controllers/api/v1/imports_controller.rb b/app/controllers/api/v1/imports_controller.rb
new file mode 100644
index 000000000..7dc3021d9
--- /dev/null
+++ b/app/controllers/api/v1/imports_controller.rb
@@ -0,0 +1,10 @@
+module Api
+ module V1
+ class ImportsController < ChouetteController
+
+ def create
+
+ end
+ end
+ end
+end
diff --git a/app/controllers/imports_controller.rb b/app/controllers/imports_controller.rb
index 70c5c1a0d..01a46f064 100644
--- a/app/controllers/imports_controller.rb
+++ b/app/controllers/imports_controller.rb
@@ -23,6 +23,8 @@ class ImportsController < BreadcrumbController
end
def create
+ require 'pry'
+ binding.pry
create! { workbench_import_path(parent, resource) }
end
diff --git a/config/environments/development.rb b/config/environments/development.rb
index 59cb9eefa..35f697d04 100644
--- a/config/environments/development.rb
+++ b/config/environments/development.rb
@@ -61,17 +61,20 @@ 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"
- }
+ 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"
+ {
+ key: "Ohphie1Voo6the5hohpi",
+ url: "http://stif-portail-dev.af83.priv"
}
# Ext. apps links
diff --git a/config/routes.rb b/config/routes.rb
index aa6713857..0bfde2e25 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 :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/spec/models/api/v1/netex_import_spec.rb b/spec/models/api/v1/netex_import_spec.rb
new file mode 100644
index 000000000..f1fddc4ba
--- /dev/null
+++ b/spec/models/api/v1/netex_import_spec.rb
@@ -0,0 +1,15 @@
+RSpec.describe Api::V1::NetexImportController, type: :controller do
+
+ context 'POST create' do
+
+ let( :netex_import ){ build_stubbed(:netex_import) }
+
+ it 'creates a NetexImport record' do
+ expect_any_instance_of( ImportController ).to receive(:create).with(
+ params: netex_import.attributes
+ )
+
+ 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/api/v1/import_routes_spec.rb b/spec/routing/api/v1/import_routes_spec.rb
new file mode 100644
index 000000000..7acc0e82d
--- /dev/null
+++ b/spec/routing/api/v1/import_routes_spec.rb
@@ -0,0 +1,10 @@
+RSpec.describe Api::V1::ImportsController do
+ describe "routing" do
+ it {
+ expect(post: '/api/v1/imports').to route_to(
+ controller: 'api/v1/imports',
+ action: 'create'
+ )
+ }
+ 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(