diff options
| author | Xinhui | 2016-09-27 11:00:55 +0200 |
|---|---|---|
| committer | Xinhui | 2016-09-27 11:11:15 +0200 |
| commit | 811d6208f4a126b08fc7ae8c4233ce8fca1eb198 (patch) | |
| tree | be59e510e87bf01303b0f3b6d67c95b68dbdccbe | |
| parent | 8c378fe9c6299ac9400ff6898702b7e0c6a64799 (diff) | |
| download | chouette-core-811d6208f4a126b08fc7ae8c4233ce8fca1eb198.tar.bz2 | |
Remove model LineSyncOperation
| -rw-r--r-- | app/models/line_sync_operation.rb | 3 | ||||
| -rw-r--r-- | db/migrate/20160818090010_add_message_to_line_sync_operation.rb | 5 | ||||
| -rw-r--r-- | db/migrate/20160927085857_drop_line_sync_operations.rb (renamed from db/migrate/20160627124541_create_line_sync_operations.rb) | 8 | ||||
| -rw-r--r-- | db/schema.rb | 17 | ||||
| -rw-r--r-- | spec/factories/line_referential_syncs.rb | 12 | ||||
| -rw-r--r-- | spec/factories/line_sync_operations.rb | 6 | ||||
| -rw-r--r-- | spec/models/line_referential_sync_spec.rb | 15 | ||||
| -rw-r--r-- | spec/models/line_sync_operation_spec.rb | 9 |
8 files changed, 10 insertions, 65 deletions
diff --git a/app/models/line_sync_operation.rb b/app/models/line_sync_operation.rb deleted file mode 100644 index 2564ae99c..000000000 --- a/app/models/line_sync_operation.rb +++ /dev/null @@ -1,3 +0,0 @@ -class LineSyncOperation < ActiveRecord::Base - belongs_to :line_referential_sync -end diff --git a/db/migrate/20160818090010_add_message_to_line_sync_operation.rb b/db/migrate/20160818090010_add_message_to_line_sync_operation.rb deleted file mode 100644 index 37b3e5af6..000000000 --- a/db/migrate/20160818090010_add_message_to_line_sync_operation.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddMessageToLineSyncOperation < ActiveRecord::Migration - def change - add_column :line_sync_operations, :message, :string - end -end diff --git a/db/migrate/20160627124541_create_line_sync_operations.rb b/db/migrate/20160927085857_drop_line_sync_operations.rb index ec32cf4ac..44e774604 100644 --- a/db/migrate/20160627124541_create_line_sync_operations.rb +++ b/db/migrate/20160927085857_drop_line_sync_operations.rb @@ -1,5 +1,9 @@ -class CreateLineSyncOperations < ActiveRecord::Migration - def change +class DropLineSyncOperations < ActiveRecord::Migration + def up + drop_table :line_sync_operations if table_exists?(:line_sync_operations) + end + + def down create_table :line_sync_operations do |t| t.string :status t.references :line_referential_sync, index: true diff --git a/db/schema.rb b/db/schema.rb index 0c7e6ee68..359e1c5f5 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,10 +11,11 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20160926134852) do +ActiveRecord::Schema.define(version: 20160927085857) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" + enable_extension "hstore" enable_extension "postgis" create_table "access_links", force: true do |t| @@ -290,16 +291,6 @@ ActiveRecord::Schema.define(version: 20160926134852) do t.integer "sync_interval", default: 1 end - create_table "line_sync_operations", force: true do |t| - t.string "status" - t.integer "line_referential_sync_id" - t.datetime "created_at" - t.datetime "updated_at" - t.string "message" - end - - add_index "line_sync_operations", ["line_referential_sync_id"], :name => "index_line_sync_operations_on_line_referential_sync_id" - create_table "lines", force: true do |t| t.integer "network_id", limit: 8 t.integer "company_id", limit: 8 @@ -410,10 +401,10 @@ ActiveRecord::Schema.define(version: 20160926134852) do t.integer "object_version" t.datetime "creation_time" t.string "creator_id" - t.float "distance" - t.boolean "no_processing" t.spatial "input_geometry", limit: {:srid=>4326, :type=>"line_string"} t.spatial "processed_geometry", limit: {:srid=>4326, :type=>"line_string"} + t.float "distance" + t.boolean "no_processing" end create_table "routes", force: true do |t| diff --git a/spec/factories/line_referential_syncs.rb b/spec/factories/line_referential_syncs.rb index 86b1a2182..8f0d1e6fb 100644 --- a/spec/factories/line_referential_syncs.rb +++ b/spec/factories/line_referential_syncs.rb @@ -1,16 +1,4 @@ FactoryGirl.define do factory :line_referential_sync do - line_referential nil - - factory :line_referential_sync_with_record do - transient do - line_sync_operations_count rand(1..30) - end - - after(:create) do |line_referential_sync, evaluator| - create_list(:line_sync_operation, evaluator.line_sync_operations_count, line_referential_sync: line_referential_sync) - end - - end end end diff --git a/spec/factories/line_sync_operations.rb b/spec/factories/line_sync_operations.rb deleted file mode 100644 index 3d353bb3b..000000000 --- a/spec/factories/line_sync_operations.rb +++ /dev/null @@ -1,6 +0,0 @@ -FactoryGirl.define do - factory :line_sync_operation do - status ["OK","KO"].sample - line_referential_sync nil - end -end diff --git a/spec/models/line_referential_sync_spec.rb b/spec/models/line_referential_sync_spec.rb index a237f4d24..0cab0389c 100644 --- a/spec/models/line_referential_sync_spec.rb +++ b/spec/models/line_referential_sync_spec.rb @@ -4,20 +4,5 @@ RSpec.describe LineReferentialSync, :type => :model do it 'should have a valid factory' do expect(FactoryGirl.build(:line_referential_sync)).to be_valid end - it { is_expected.to belong_to(:line_referential) } - - describe '.record_status' - let!(:line_ref_sync) { create(:line_referential_sync) } - let!(:line_ref_sync_with_records) { create(:line_referential_sync_with_record, line_sync_operations_count: 30) } - - it 'should add a new record' do - line_ref_sync.record_status :ok, "message" - expect(line_ref_sync.line_sync_operations.count).to eq(1) - end - - it 'should not have more than 30 records' do - line_ref_sync_with_records.record_status :ok, "message" - expect(line_ref_sync_with_records.line_sync_operations.count).to eq(30) - end end diff --git a/spec/models/line_sync_operation_spec.rb b/spec/models/line_sync_operation_spec.rb deleted file mode 100644 index dab7f1056..000000000 --- a/spec/models/line_sync_operation_spec.rb +++ /dev/null @@ -1,9 +0,0 @@ -require 'rails_helper' - -RSpec.describe LineSyncOperation, :type => :model do - it 'should have a valid factory' do - expect(FactoryGirl.build(:line_sync_operation)).to be_valid - end - - it { is_expected.to belong_to(:line_referential_sync) } -end |
