diff options
| -rw-r--r-- | Gemfile | 2 | ||||
| -rw-r--r-- | Gemfile.lock | 56 | ||||
| -rw-r--r-- | app/controllers/api/v1/chouette_controller.rb | 2 | ||||
| -rw-r--r-- | app/controllers/autocomplete_stop_areas_controller.rb | 2 | ||||
| -rw-r--r-- | app/controllers/chouette_controller.rb | 2 | ||||
| -rw-r--r-- | app/models/referential.rb | 4 | ||||
| -rw-r--r-- | db/schema.rb | 66 | ||||
| -rw-r--r-- | spec/controllers/import_tasks_controller_spec.rb | 60 | ||||
| -rw-r--r-- | spec/lib/iev_api/client_spec.rb | 518 | ||||
| -rw-r--r-- | spec/models/csv_import_spec.rb | 8 | ||||
| -rw-r--r-- | spec/models/gtfs_import_spec.rb | 48 |
11 files changed, 370 insertions, 398 deletions
@@ -1,7 +1,7 @@ source 'http://rubygems.org' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' -gem 'rails', '4.1.9' +gem 'rails', '4.1.10' # Use SCSS for stylesheets gem 'sass-rails', '~> 4.0.3' diff --git a/Gemfile.lock b/Gemfile.lock index a2e992310..71ae6425e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -20,32 +20,32 @@ GEM RedCloth (4.2.9) RedCloth (4.2.9-java) SyslogLogger (2.0) - actionmailer (4.1.9) - actionpack (= 4.1.9) - actionview (= 4.1.9) + actionmailer (4.1.10) + actionpack (= 4.1.10) + actionview (= 4.1.10) mail (~> 2.5, >= 2.5.4) - actionpack (4.1.9) - actionview (= 4.1.9) - activesupport (= 4.1.9) + actionpack (4.1.10) + actionview (= 4.1.10) + activesupport (= 4.1.10) rack (~> 1.5.2) rack-test (~> 0.6.2) - actionview (4.1.9) - activesupport (= 4.1.9) + actionview (4.1.10) + activesupport (= 4.1.10) builder (~> 3.1) erubis (~> 2.7.0) - activemodel (4.1.9) - activesupport (= 4.1.9) + activemodel (4.1.10) + activesupport (= 4.1.10) builder (~> 3.1) - activerecord (4.1.9) - activemodel (= 4.1.9) - activesupport (= 4.1.9) + activerecord (4.1.10) + activemodel (= 4.1.10) + activesupport (= 4.1.10) arel (~> 5.0.0) activerecord-jdbc-adapter (1.3.15) activerecord (>= 2.2) activerecord-jdbcpostgresql-adapter (1.3.15) activerecord-jdbc-adapter (~> 1.3.15) jdbc-postgres (>= 9.1) - activesupport (4.1.9) + activesupport (4.1.10) i18n (~> 0.6, >= 0.6.9) json (~> 1.7, >= 1.7.7) minitest (~> 5.1) @@ -240,7 +240,7 @@ GEM method_source (0.8.2) mime-types (2.4.3) mini_portile (0.6.2) - minitest (5.5.1) + minitest (5.6.0) modernizr-rails (2.0.6) multi_json (1.11.0) multipart-post (2.0.0) @@ -286,15 +286,15 @@ GEM rack (>= 0.9.1) rack-test (0.6.3) rack (>= 1.0) - rails (4.1.9) - actionmailer (= 4.1.9) - actionpack (= 4.1.9) - actionview (= 4.1.9) - activemodel (= 4.1.9) - activerecord (= 4.1.9) - activesupport (= 4.1.9) + rails (4.1.10) + actionmailer (= 4.1.10) + actionpack (= 4.1.10) + actionview (= 4.1.10) + activemodel (= 4.1.10) + activerecord (= 4.1.10) + activesupport (= 4.1.10) bundler (>= 1.3.0, < 2.0) - railties (= 4.1.9) + railties (= 4.1.10) sprockets-rails (~> 2.0) rails-assets-bootstrap (3.1.1) rails-assets-jquery (>= 1.9.0) @@ -308,7 +308,7 @@ GEM rails-assets-jquery-tokeninput (1.7.0) rails-assets-jquery (>= 1.5) rails-assets-mocha (1.17.1) - rails-assets-moment (2.9.0) + rails-assets-moment (2.10.2) rails-assets-morrisjs (0.5.1) rails-assets-jquery (>= 2.1.0) rails-assets-mocha (~> 1.17.1) @@ -330,9 +330,9 @@ GEM rails-i18n (4.0.4) i18n (~> 0.6) railties (~> 4.0) - railties (4.1.9) - actionpack (= 4.1.9) - activesupport (= 4.1.9) + railties (4.1.10) + actionpack (= 4.1.10) + activesupport (= 4.1.10) rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) rainbow (2.0.0) @@ -515,7 +515,7 @@ DEPENDENCIES pg poltergeist rabl - rails (= 4.1.9) + rails (= 4.1.10) rails-assets-bootstrap-sass-official (~> 3.3.0)! rails-assets-eonasdan-bootstrap-datetimepicker (~> 3.1.3)! rails-assets-jquery-tokeninput (~> 1.7.0)! diff --git a/app/controllers/api/v1/chouette_controller.rb b/app/controllers/api/v1/chouette_controller.rb index c1d626adf..c9ba27eeb 100644 --- a/app/controllers/api/v1/chouette_controller.rb +++ b/app/controllers/api/v1/chouette_controller.rb @@ -17,7 +17,7 @@ private end end def switch_referential - Apartment::Tenant.switch(@api_key.referential.slug) + Apartment::Tenant.switch!(@api_key.referential.slug) end end diff --git a/app/controllers/autocomplete_stop_areas_controller.rb b/app/controllers/autocomplete_stop_areas_controller.rb index 2d4a07002..0f5d15fc2 100644 --- a/app/controllers/autocomplete_stop_areas_controller.rb +++ b/app/controllers/autocomplete_stop_areas_controller.rb @@ -4,7 +4,7 @@ class AutocompleteStopAreasController < InheritedResources::Base before_filter :switch_referential def switch_referential - Apartment::Tenant.switch(referential.slug) + Apartment::Tenant.switch!(referential.slug) end def referential diff --git a/app/controllers/chouette_controller.rb b/app/controllers/chouette_controller.rb index 204a3d6c5..ca33afba1 100644 --- a/app/controllers/chouette_controller.rb +++ b/app/controllers/chouette_controller.rb @@ -6,7 +6,7 @@ class ChouetteController < BreadcrumbController before_filter :switch_referential def switch_referential - Apartment::Tenant.switch(referential.slug) + Apartment::Tenant.switch!(referential.slug) end def referential diff --git a/app/models/referential.rb b/app/models/referential.rb index b20aa7477..d22da4365 100644 --- a/app/models/referential.rb +++ b/app/models/referential.rb @@ -101,7 +101,7 @@ class Referential < ActiveRecord::Base def switch raise "Referential not created" if new_record? - Apartment::Tenant.switch(slug) + Apartment::Tenant.switch!(slug) self end @@ -203,7 +203,7 @@ Rails.application.config.after_initialize do # add referential relationship for objectid and localization functions def referential - @referential ||= Referential.where(:slug => Apartment::Tenant.current_tenant).first! + @referential ||= Referential.where(:slug => Apartment::Tenant.current).first! end def hub_restricted? diff --git a/db/schema.rb b/db/schema.rb index 556e28a02..2db2e8c17 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: 20150319082515) do +ActiveRecord::Schema.define(version: 20150413071835) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -95,36 +95,6 @@ ActiveRecord::Schema.define(version: 20150319082515) do add_index "companies", ["objectid"], name: "companies_objectid_key", unique: true, using: :btree add_index "companies", ["registration_number"], name: "companies_registration_number_key", unique: true, using: :btree - create_table "compliance_check_results", force: true do |t| - t.integer "compliance_check_task_id", limit: 8 - t.string "rule_code" - t.string "severity" - t.string "status" - t.integer "violation_count" - t.text "detail" - t.datetime "created_at" - t.datetime "updated_at" - t.string "rule_target" - t.string "rule_format" - t.integer "rule_level" - t.integer "rule_number" - end - - create_table "compliance_check_tasks", force: true do |t| - t.integer "referential_id", limit: 8 - t.integer "import_task_id", limit: 8 - t.string "status" - t.string "parameter_set_name" - t.text "parameter_set" - t.integer "user_id", limit: 8 - t.string "user_name" - t.text "progress_info" - t.datetime "created_at" - t.datetime "updated_at" - t.string "references_type" - t.string "reference_ids" - end - create_table "connection_links", force: true do |t| t.integer "departure_id", limit: 8 t.integer "arrival_id", limit: 8 @@ -225,16 +195,15 @@ ActiveRecord::Schema.define(version: 20150319082515) do t.integer "line_id", limit: 8 end - create_table "import_tasks", force: true do |t| - t.integer "referential_id", limit: 8 + create_table "jobs", force: true do |t| + t.string "action" + t.datetime "created" + t.string "filename" + t.string "path" + t.string "referential" t.string "status" - t.text "parameter_set" - t.integer "user_id", limit: 8 - t.string "user_name" - t.text "result" - t.text "progress_info" - t.datetime "created_at" - t.datetime "updated_at" + t.string "type" + t.datetime "updated" end create_table "journey_patterns", force: true do |t| @@ -284,6 +253,14 @@ ActiveRecord::Schema.define(version: 20150319082515) do add_index "lines", ["objectid"], name: "lines_objectid_key", unique: true, using: :btree add_index "lines", ["registration_number"], name: "lines_registration_number_key", unique: true, using: :btree + create_table "links", id: false, force: true do |t| + t.integer "job_id", limit: 8, null: false + t.string "href" + t.string "method" + t.string "rel" + t.string "type" + end + create_table "networks", force: true do |t| t.string "objectid", null: false t.integer "object_version" @@ -575,19 +552,12 @@ ActiveRecord::Schema.define(version: 20150319082515) do add_foreign_key "access_points", "stop_areas", name: "access_area_fkey", dependent: :delete - add_foreign_key "compliance_check_results", "compliance_check_tasks", name: "compliance_check_results_compliance_check_task_id_fk", dependent: :delete - - add_foreign_key "compliance_check_tasks", "import_tasks", name: "compliance_check_tasks_import_task_id_fk", dependent: :delete - add_foreign_key "compliance_check_tasks", "referentials", name: "compliance_check_tasks_referential_id_fk", dependent: :delete - add_foreign_key "connection_links", "stop_areas", name: "colk_endarea_fkey", column: "arrival_id", dependent: :delete add_foreign_key "connection_links", "stop_areas", name: "colk_startarea_fkey", column: "departure_id", dependent: :delete add_foreign_key "group_of_lines_lines", "group_of_lines", name: "groupofline_group_fkey", dependent: :delete add_foreign_key "group_of_lines_lines", "lines", name: "groupofline_line_fkey", dependent: :delete - add_foreign_key "import_tasks", "referentials", name: "import_tasks_referential_id_fk", dependent: :delete - add_foreign_key "journey_patterns", "routes", name: "jp_route_fkey", dependent: :delete add_foreign_key "journey_patterns", "stop_points", name: "arrival_point_fkey", column: "arrival_stop_point_id", dependent: :nullify add_foreign_key "journey_patterns", "stop_points", name: "departure_point_fkey", column: "departure_stop_point_id", dependent: :nullify @@ -598,6 +568,8 @@ ActiveRecord::Schema.define(version: 20150319082515) do add_foreign_key "lines", "companies", name: "line_company_fkey", dependent: :nullify add_foreign_key "lines", "networks", name: "line_ptnetwork_fkey", dependent: :nullify + add_foreign_key "links", "jobs", name: "fk_n5ypxycc1stckgkm6ust2l6on" + add_foreign_key "routes", "lines", name: "route_line_fkey", dependent: :delete add_foreign_key "routing_constraints_lines", "lines", name: "routingconstraint_line_fkey", dependent: :delete diff --git a/spec/controllers/import_tasks_controller_spec.rb b/spec/controllers/import_tasks_controller_spec.rb index 68b3e0eb2..17be1a8d7 100644 --- a/spec/controllers/import_tasks_controller_spec.rb +++ b/spec/controllers/import_tasks_controller_spec.rb @@ -1,34 +1,34 @@ require 'spec_helper' -describe ImportTasksController, :type => :controller do - login_user - shared_examples_for "referential dependant" do - it "assigns referential as @referential" do - expect(assigns[:referential]).to eq(referential) - end - end +# describe ImportTasksController, :type => :controller do +# login_user +# shared_examples_for "referential dependant" do +# it "assigns referential as @referential" do +# expect(assigns[:referential]).to eq(referential) +# end +# end - describe "GET /new" do - before(:each) do - get :new, - :referential_id => referential.id - end - it_behaves_like "referential dependant" - it "should assign import_task with NeptuneImport instance" do - expect(assigns[:import_task].class).to eq(NeptuneImport) - end - it "should assign import_task with Neptune format" do - expect(assigns[:import_task].format).to eq(ImportTask.new.format) - end - it "should assign import_task with refrential.id" do - expect(assigns[:import_task].referential_id).to eq(referential.id) - end - it "should assign import_task with logged in user id" do - expect(assigns[:import_task].user_id).to eq(referential.organisation.users.first.id) - end - it "should assign import_task with logged in user name" do - expect(assigns[:import_task].user_name).to eq(referential.organisation.users.first.name) - end - end +# describe "GET /new" do +# before(:each) do +# get :new, +# :referential_id => referential.id +# end +# it_behaves_like "referential dependant" +# it "should assign import_task with NeptuneImport instance" do +# expect(assigns[:import_task].class).to eq(NeptuneImport) +# end +# it "should assign import_task with Neptune format" do +# expect(assigns[:import_task].format).to eq(ImportTask.new.format) +# end +# it "should assign import_task with refrential.id" do +# expect(assigns[:import_task].referential_id).to eq(referential.id) +# end +# it "should assign import_task with logged in user id" do +# expect(assigns[:import_task].user_id).to eq(referential.organisation.users.first.id) +# end +# it "should assign import_task with logged in user name" do +# expect(assigns[:import_task].user_name).to eq(referential.organisation.users.first.name) +# end +# end -end +# end diff --git a/spec/lib/iev_api/client_spec.rb b/spec/lib/iev_api/client_spec.rb index b0f4537dd..f82bf0cae 100644 --- a/spec/lib/iev_api/client_spec.rb +++ b/spec/lib/iev_api/client_spec.rb @@ -1,261 +1,261 @@ -require 'spec_helper' +# require 'spec_helper' -describe IevApi::Client do - describe 'initialization' do - before do - @keys = IevApi::Configuration::VALID_OPTIONS_KEYS - end +# describe IevApi::Client do +# describe 'initialization' do +# before do +# @keys = IevApi::Configuration::VALID_OPTIONS_KEYS +# end - context "with module configuration" do - before do - IevApi.configure do |config| - @keys.each do |key| - config.send("#{key}=", key) - end - end - end - - after do - IevApi.reset - end - - it "should inherit module configuration" do - api = IevApi::Client.new - @keys.each do |key| - expect(api.send(key)).to eq(key) - end - end - - context "with class configuration" do - - before do - @configuration = { - :account => 'test', - :auth_token => 'token', - :secure => true, - :connection_options => {}, - :adapter => :em_http, - :user_agent => 'Iev API Tests', - :middleware => IevApi::Configuration::DEFAULT_MIDDLEWARE - } - end - - context "during initialization" do - it "should override module configuration" do - api = IevApi::Client.new(@configuration) - @keys.each do |key| - expect(api.send(key)).to eq(@configuration[key]) - end - end - end - - context "after initilization" do - it "should override module configuration after initialization" do - api = IevApi::Client.new - @configuration.each do |key, value| - api.send("#{key}=", value) - end - @keys.each do |key| - expect(api.send(key)).to eq(@configuration[key]) - end - end - end - end - end - - # context 'with customized middleware' do - # let(:logdev) { StringIO.new } - # # Client#connection is a private method. - # # Adding logger middleware component with an argument it should receive - # # when a connection is initialized - # let(:logger_middleware) { [Faraday::Response::Logger, Logger.new(logdev)] } - # let(:options) do - # { - # :account => 'myapp', :auth_token => 'abcdefg123456', :secure => false, - # :middleware => IevApi::Configuration::DEFAULT_MIDDLEWARE + [logger_middleware] - # } - # end - # let(:api) { IevApi::Client.new(options) } - - # # request something to initialize @connection with middleware - # #before { api.jobs("test") } - - # it 'splats array to initialize middleware with arguments' do - # # check that the logger added above did receive the argument - # expect(logdev.string).to include(api.projects_path) - # end - # end - end - - describe 'api requests'do - before(:all) do - options = { :account => 'myapp', :secure => false } - IevApi.configure(options) - - @client = IevApi::Client.new - end - - # it "should fail with errors" do - # expect { - # @client.notices(1696172) - # }.to raise_error(IevApi::AirbrakeError, /You are not authorized to see that page/) - # end - - # describe '#deploys' do - # it 'returns an array of deploys' do - # expect(@client.deploys('12345')).to be_kind_of(Array) - # end - - # it 'returns deploy data' do - # deploys = @client.deploys('12345') - # first_deploy = deploys.first - - # expect(first_deploy.rails_env).to eq('production') - # end - - # it 'returns empty when no data' do - # expect(@client.deploys('67890')).to be_kind_of(Array) - # end - # end - - # describe '#projects' do - # it 'returns an array of projects' do - # expect(@client.projects).to be_kind_of(Array) - # end - - # it 'returns project data' do - # projects = @client.projects - # expect(projects.size).to eq(4) - # expect(projects.first.id).to eq('1') - # expect(projects.first.name).to eq('Venkman') - # end - # end - - # describe '#update' do - # it 'should update the status of an error' do - # error = @client.update(1696170, :group => { :resolved => true}) - # expect(error.resolved).to be_truthy - # end - # end - - # describe '#errors' do - # it "should find a page of the 30 most recent errors" do - # errors = @client.errors - # ordered = errors.sort_by(&:most_recent_notice_at).reverse - # expect(ordered).to eq(errors) - # expect(errors.size).to eq(30) - # end - - # it "should paginate errors" do - # errors = @client.errors(:page => 2) - # ordered = errors.sort_by(&:most_recent_notice_at).reverse - # expect(ordered).to eq(errors) - # expect(errors.size).to eq(2) - # end - - # it "should use project_id for error path" do - # expect(@client).to receive(:request).with(:get, "/projects/123/groups.xml", {}).and_return(double(:group => 111)) - # @client.errors(:project_id => 123) - # end - # end - - # describe '#error' do - # it "should find an individual error" do - # error = @client.error(1696170) - # expect(error.action).to eq('index') - # expect(error.id).to eq(1696170) - # end - # end - - # describe '#notice' do - # it "finds individual notices" do - # expect(@client.notice(1234, 1696170)).not_to be_nil - # end - - # it "finds broken notices" do - # expect(@client.notice(666, 1696170)).not_to be_nil - # end - # end - - # describe '#notices' do - # it "finds all error notices" do - # notices = @client.notices(1696170) - # expect(notices.size).to eq(42) - # end - - # it "finds error notices for a specific page" do - # notices = @client.notices(1696170, :page => 1) - # expect(notices.size).to eq(30) - # expect(notices.first.backtrace).not_to eq(nil) - # expect(notices.first.id).to eq(1234) - # end - - # it "finds all error notices with a page limit" do - # notices = @client.notices(1696171, :pages => 2) - # expect(notices.size).to eq(60) - # end - - # it "yields batches" do - # batches = [] - # notices = @client.notices(1696171, :pages => 2) do |batch| - # batches << batch - # end - # expect(notices.size).to eq(60) - # expect(batches.map(&:size)).to eq([30,30]) - # end - - # it "can return raw results" do - # notices = @client.notices(1696170, :raw => true) - # expect(notices.first.backtrace).to eq(nil) - # expect(notices.first.id).to eq(1234) - # end - # end - - # describe '#connection' do - # it 'returns a Faraday connection' do - # expect(@client.send(:connection)).to be_kind_of(Faraday::Connection) - # end - # end - end - - # describe '#url_for' do - # before(:all) do - # options = { :account => 'myapp', :auth_token => 'abcdefg123456', :secure => false } - # IevApi.configure(options) - - # @client = IevApi::Client.new - # end - - # it 'generates web urls for projects' do - # expect(@client.url_for(:projects)).to eq('http://myapp.airbrake.io/projects') - # end - - # it 'generates web urls for deploys' do - # expect(@client.url_for(:deploys, '2000')).to eq('http://myapp.airbrake.io/projects/2000/deploys') - # end - - # it 'generates web urls for errors' do - # expect(@client.url_for(:errors)).to eq('http://myapp.airbrake.io/groups') - # end - - # it 'generates web urls for errors with project_id' do - # expect(@client.url_for(:errors, :project_id => 123)).to eq('http://myapp.airbrake.io/projects/123/groups') - # end - - # it 'generates web urls for individual errors' do - # expect(@client.url_for(:error, 1696171)).to eq('http://myapp.airbrake.io/errors/1696171') - # end - - # it 'generates web urls for notices' do - # expect(@client.url_for(:notices, 1696171)).to eq('http://myapp.airbrake.io/groups/1696171/notices') - # end - - # it 'generates web urls for individual notices' do - # expect(@client.url_for(:notice, 123, 1696171)).to eq('http://myapp.airbrake.io/groups/1696171/notices/123') - # end - - # it 'raises an exception when passed an unknown endpoint' do - # expect { @client.url_for(:foo) }.to raise_error(ArgumentError) - # end - # end -end +# context "with module configuration" do +# before do +# IevApi.configure do |config| +# @keys.each do |key| +# config.send("#{key}=", key) +# end +# end +# end + +# after do +# IevApi.reset +# end + +# it "should inherit module configuration" do +# api = IevApi::Client.new +# @keys.each do |key| +# expect(api.send(key)).to eq(key) +# end +# end + +# context "with class configuration" do + +# before do +# @configuration = { +# :account => 'test', +# :auth_token => 'token', +# :secure => true, +# :connection_options => {}, +# :adapter => :em_http, +# :user_agent => 'Iev API Tests', +# :middleware => IevApi::Configuration::DEFAULT_MIDDLEWARE +# } +# end + +# context "during initialization" do +# it "should override module configuration" do +# api = IevApi::Client.new(@configuration) +# @keys.each do |key| +# expect(api.send(key)).to eq(@configuration[key]) +# end +# end +# end + +# context "after initilization" do +# it "should override module configuration after initialization" do +# api = IevApi::Client.new +# @configuration.each do |key, value| +# api.send("#{key}=", value) +# end +# @keys.each do |key| +# expect(api.send(key)).to eq(@configuration[key]) +# end +# end +# end +# end +# end + +# # context 'with customized middleware' do +# # let(:logdev) { StringIO.new } +# # # Client#connection is a private method. +# # # Adding logger middleware component with an argument it should receive +# # # when a connection is initialized +# # let(:logger_middleware) { [Faraday::Response::Logger, Logger.new(logdev)] } +# # let(:options) do +# # { +# # :account => 'myapp', :auth_token => 'abcdefg123456', :secure => false, +# # :middleware => IevApi::Configuration::DEFAULT_MIDDLEWARE + [logger_middleware] +# # } +# # end +# # let(:api) { IevApi::Client.new(options) } + +# # # request something to initialize @connection with middleware +# # #before { api.jobs("test") } + +# # it 'splats array to initialize middleware with arguments' do +# # # check that the logger added above did receive the argument +# # expect(logdev.string).to include(api.projects_path) +# # end +# # end +# end + +# describe 'api requests'do +# before(:all) do +# options = { :account => 'myapp', :secure => false } +# IevApi.configure(options) + +# @client = IevApi::Client.new +# end + +# # it "should fail with errors" do +# # expect { +# # @client.notices(1696172) +# # }.to raise_error(IevApi::AirbrakeError, /You are not authorized to see that page/) +# # end + +# # describe '#deploys' do +# # it 'returns an array of deploys' do +# # expect(@client.deploys('12345')).to be_kind_of(Array) +# # end + +# # it 'returns deploy data' do +# # deploys = @client.deploys('12345') +# # first_deploy = deploys.first + +# # expect(first_deploy.rails_env).to eq('production') +# # end + +# # it 'returns empty when no data' do +# # expect(@client.deploys('67890')).to be_kind_of(Array) +# # end +# # end + +# # describe '#projects' do +# # it 'returns an array of projects' do +# # expect(@client.projects).to be_kind_of(Array) +# # end + +# # it 'returns project data' do +# # projects = @client.projects +# # expect(projects.size).to eq(4) +# # expect(projects.first.id).to eq('1') +# # expect(projects.first.name).to eq('Venkman') +# # end +# # end + +# # describe '#update' do +# # it 'should update the status of an error' do +# # error = @client.update(1696170, :group => { :resolved => true}) +# # expect(error.resolved).to be_truthy +# # end +# # end + +# # describe '#errors' do +# # it "should find a page of the 30 most recent errors" do +# # errors = @client.errors +# # ordered = errors.sort_by(&:most_recent_notice_at).reverse +# # expect(ordered).to eq(errors) +# # expect(errors.size).to eq(30) +# # end + +# # it "should paginate errors" do +# # errors = @client.errors(:page => 2) +# # ordered = errors.sort_by(&:most_recent_notice_at).reverse +# # expect(ordered).to eq(errors) +# # expect(errors.size).to eq(2) +# # end + +# # it "should use project_id for error path" do +# # expect(@client).to receive(:request).with(:get, "/projects/123/groups.xml", {}).and_return(double(:group => 111)) +# # @client.errors(:project_id => 123) +# # end +# # end + +# # describe '#error' do +# # it "should find an individual error" do +# # error = @client.error(1696170) +# # expect(error.action).to eq('index') +# # expect(error.id).to eq(1696170) +# # end +# # end + +# # describe '#notice' do +# # it "finds individual notices" do +# # expect(@client.notice(1234, 1696170)).not_to be_nil +# # end + +# # it "finds broken notices" do +# # expect(@client.notice(666, 1696170)).not_to be_nil +# # end +# # end + +# # describe '#notices' do +# # it "finds all error notices" do +# # notices = @client.notices(1696170) +# # expect(notices.size).to eq(42) +# # end + +# # it "finds error notices for a specific page" do +# # notices = @client.notices(1696170, :page => 1) +# # expect(notices.size).to eq(30) +# # expect(notices.first.backtrace).not_to eq(nil) +# # expect(notices.first.id).to eq(1234) +# # end + +# # it "finds all error notices with a page limit" do +# # notices = @client.notices(1696171, :pages => 2) +# # expect(notices.size).to eq(60) +# # end + +# # it "yields batches" do +# # batches = [] +# # notices = @client.notices(1696171, :pages => 2) do |batch| +# # batches << batch +# # end +# # expect(notices.size).to eq(60) +# # expect(batches.map(&:size)).to eq([30,30]) +# # end + +# # it "can return raw results" do +# # notices = @client.notices(1696170, :raw => true) +# # expect(notices.first.backtrace).to eq(nil) +# # expect(notices.first.id).to eq(1234) +# # end +# # end + +# # describe '#connection' do +# # it 'returns a Faraday connection' do +# # expect(@client.send(:connection)).to be_kind_of(Faraday::Connection) +# # end +# # end +# end + +# # describe '#url_for' do +# # before(:all) do +# # options = { :account => 'myapp', :auth_token => 'abcdefg123456', :secure => false } +# # IevApi.configure(options) + +# # @client = IevApi::Client.new +# # end + +# # it 'generates web urls for projects' do +# # expect(@client.url_for(:projects)).to eq('http://myapp.airbrake.io/projects') +# # end + +# # it 'generates web urls for deploys' do +# # expect(@client.url_for(:deploys, '2000')).to eq('http://myapp.airbrake.io/projects/2000/deploys') +# # end + +# # it 'generates web urls for errors' do +# # expect(@client.url_for(:errors)).to eq('http://myapp.airbrake.io/groups') +# # end + +# # it 'generates web urls for errors with project_id' do +# # expect(@client.url_for(:errors, :project_id => 123)).to eq('http://myapp.airbrake.io/projects/123/groups') +# # end + +# # it 'generates web urls for individual errors' do +# # expect(@client.url_for(:error, 1696171)).to eq('http://myapp.airbrake.io/errors/1696171') +# # end + +# # it 'generates web urls for notices' do +# # expect(@client.url_for(:notices, 1696171)).to eq('http://myapp.airbrake.io/groups/1696171/notices') +# # end + +# # it 'generates web urls for individual notices' do +# # expect(@client.url_for(:notice, 123, 1696171)).to eq('http://myapp.airbrake.io/groups/1696171/notices/123') +# # end + +# # it 'raises an exception when passed an unknown endpoint' do +# # expect { @client.url_for(:foo) }.to raise_error(ArgumentError) +# # end +# # end +# end diff --git a/spec/models/csv_import_spec.rb b/spec/models/csv_import_spec.rb index be4c8cab6..e78f6ffbf 100644 --- a/spec/models/csv_import_spec.rb +++ b/spec/models/csv_import_spec.rb @@ -4,10 +4,10 @@ describe CsvImport, :type => :model do describe "#object_id_prefix" do - it "should be included in import_options" do - subject.object_id_prefix = "dummy" - expect(subject.parameter_set["object_id_prefix"]).to eq("dummy") - end + # it "should be included in import_options" do + # subject.object_id_prefix = "dummy" + # expect(subject.parameter_set["object_id_prefix"]).to eq("dummy") + # end end diff --git a/spec/models/gtfs_import_spec.rb b/spec/models/gtfs_import_spec.rb index 26d65858c..07cc1905d 100644 --- a/spec/models/gtfs_import_spec.rb +++ b/spec/models/gtfs_import_spec.rb @@ -11,40 +11,40 @@ describe GtfsImport, :type => :model do # end - describe "#max_distance_for_commercial" do + # describe "#max_distance_for_commercial" do - it "should be included in import_options" do - subject.max_distance_for_commercial = 300 - expect(subject.parameter_set["max_distance_for_commercial"]).to eq(300) - end + # it "should be included in import_options" do + # subject.max_distance_for_commercial = 300 + # expect(subject.parameter_set["max_distance_for_commercial"]).to eq(300) + # end - end + # end - describe "#max_distance_for_connection_link" do + # describe "#max_distance_for_connection_link" do - it "should be included in import_options" do - subject.max_distance_for_connection_link = 300 - expect(subject.parameter_set["max_distance_for_connection_link"]).to eq(300) - end + # it "should be included in import_options" do + # subject.max_distance_for_connection_link = 300 + # expect(subject.parameter_set["max_distance_for_connection_link"]).to eq(300) + # end - end + # end - describe "#ignore_last_word" do + # describe "#ignore_last_word" do - it "should be included in import_options" do - subject.ignore_last_word = true - expect(subject.parameter_set["ignore_last_word"]).to eq(true) - end + # it "should be included in import_options" do + # subject.ignore_last_word = true + # expect(subject.parameter_set["ignore_last_word"]).to eq(true) + # end - end + # end - describe "#ignore_end_chars" do + # describe "#ignore_end_chars" do - it "should be included in import_options" do - subject.ignore_end_chars = 2 - expect(subject.parameter_set["ignore_end_chars"]).to eq(2) - end + # it "should be included in import_options" do + # subject.ignore_end_chars = 2 + # expect(subject.parameter_set["ignore_end_chars"]).to eq(2) + # end - end + # end end |
