aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--db/schema.rb8
-rw-r--r--spec/models/import/netex_import_spec.rb7
-rw-r--r--spec/support/with_commit.rb10
3 files changed, 20 insertions, 5 deletions
diff --git a/db/schema.rb b/db/schema.rb
index af6a51f7a..21aa73cd8 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -408,9 +408,9 @@ ActiveRecord::Schema.define(version: 20171114102438) do
t.string "type"
t.integer "parent_id", limit: 8
t.string "parent_type"
- t.datetime "notified_parent_at"
t.integer "current_step", default: 0
t.integer "total_steps", default: 0
+ t.datetime "notified_parent_at"
t.string "creator"
end
@@ -491,7 +491,8 @@ ActiveRecord::Schema.define(version: 20171114102438) do
t.string "name"
t.datetime "created_at"
t.datetime "updated_at"
- t.integer "sync_interval", default: 1
+ t.integer "sync_interval", default: 1
+ t.string "objectid_format"
end
create_table "lines", id: :bigserial, force: :cascade do |t|
@@ -635,6 +636,7 @@ ActiveRecord::Schema.define(version: 20171114102438) do
t.integer "created_from_id", limit: 8
t.boolean "ready", default: false
t.integer "referential_suite_id", limit: 8
+ t.string "objectid_format"
end
add_index "referentials", ["created_from_id"], name: "index_referentials_on_created_from_id", using: :btree
@@ -712,6 +714,7 @@ ActiveRecord::Schema.define(version: 20171114102438) do
t.string "name"
t.datetime "created_at"
t.datetime "updated_at"
+ t.string "objectid_format"
end
create_table "stop_areas", id: :bigserial, force: :cascade do |t|
@@ -950,6 +953,7 @@ ActiveRecord::Schema.define(version: 20171114102438) do
t.integer "line_referential_id", limit: 8
t.integer "stop_area_referential_id", limit: 8
t.integer "output_id", limit: 8
+ t.string "objectid_format"
end
add_index "workbenches", ["line_referential_id"], name: "index_workbenches_on_line_referential_id", using: :btree
diff --git a/spec/models/import/netex_import_spec.rb b/spec/models/import/netex_import_spec.rb
index 4548bd7cc..8ffeed1f4 100644
--- a/spec/models/import/netex_import_spec.rb
+++ b/spec/models/import/netex_import_spec.rb
@@ -1,7 +1,8 @@
-RSpec.describe NetexImport, type: :model do
+RSpec.describe NetexImport, type: [:model, :with_commit] do
let( :boiv_iev_uri ){ URI("#{Rails.configuration.iev_url}/boiv_iev/referentials/importer/new?id=#{subject.id}")}
+
before do
allow(Thread).to receive(:new).and_yield
end
@@ -11,7 +12,7 @@ RSpec.describe NetexImport, type: :model do
it 'will trigger the Java API' do
with_stubbed_request(:get, boiv_iev_uri) do |request|
- subject.save!
+ with_commit{ subject.save! }
expect(request).to have_been_requested
end
end
@@ -22,7 +23,7 @@ RSpec.describe NetexImport, type: :model do
it 'its status is forced to aborted and the Java API is not callled' do
with_stubbed_request(:get, boiv_iev_uri) do |request|
- subject.save!
+ with_commit{ subject.save! }
expect(subject.reload.status).to eq('aborted')
expect(request).not_to have_been_requested
end
diff --git a/spec/support/with_commit.rb b/spec/support/with_commit.rb
new file mode 100644
index 000000000..2b4725f89
--- /dev/null
+++ b/spec/support/with_commit.rb
@@ -0,0 +1,10 @@
+module WithCommit
+ def with_commit
+ yield
+ subject._run_commit_callbacks
+ end
+end
+
+RSpec.configure do |conf|
+ conf.include WithCommit, type: :with_commit
+end