Tests: adapt migration to sqlite

Add sqlite
Remove scenic from tests
This commit is contained in:
Simon Lehericey 2017-02-14 18:20:40 +01:00
parent 67daaa033c
commit 8bccf375e1
14 changed files with 42 additions and 39 deletions

View file

@ -64,7 +64,6 @@ gem 'fog'
gem 'fog-openstack'
gem 'pg'
gem 'scenic'
gem 'rgeo-geojson'
gem 'leaflet-rails'
@ -115,6 +114,7 @@ group :test do
gem 'guard-livereload', '~> 2.4', require: false
gem 'vcr'
gem 'rails-controller-testing'
gem 'sqlite3'
end
group :development do
@ -122,6 +122,7 @@ group :development do
gem 'web-console'
gem 'rack-handlers'
gem 'xray-rails'
gem 'scenic'
end
group :development, :test do
@ -152,5 +153,6 @@ group :development, :test do
end
group :production, :staging do
gem 'scenic'
gem 'sentry-raven'
end

View file

@ -564,6 +564,7 @@ GEM
actionpack (>= 4.0)
activesupport (>= 4.0)
sprockets (>= 3.0.0)
sqlite3 (1.3.13)
swd (1.0.1)
activesupport (>= 3)
attr_required (>= 0.0.5)
@ -695,6 +696,7 @@ DEPENDENCIES
simplecov
smart_listing
spreadsheet_architect
sqlite3
therubyracer
timecop
turbolinks (~> 2.5)
@ -708,4 +710,4 @@ DEPENDENCIES
xray-rails
BUNDLED WITH
1.13.7
1.14.4

View file

@ -10,12 +10,7 @@ development:
test:
adapter: postgresql
encoding: unicode
database: tps_test<%= ENV['TEST_ENV_NUMBER'] %>
host: localhost
adapter: sqlite3
pool: 5
username: tps
password: lol
timeout: 5000
database: db/test.sqlite3

View file

@ -16,8 +16,8 @@ class DeviseCreateUsers < ActiveRecord::Migration
t.integer :sign_in_count, default: 0, null: false
t.datetime :current_sign_in_at
t.datetime :last_sign_in_at
t.inet :current_sign_in_ip
t.inet :last_sign_in_ip
t.string :current_sign_in_ip
t.string :last_sign_in_ip
## Confirmable
# t.string :confirmation_token

View file

@ -16,8 +16,8 @@ class DeviseCreatePros < ActiveRecord::Migration
t.integer :sign_in_count, default: 0, null: false
t.datetime :current_sign_in_at
t.datetime :last_sign_in_at
t.inet :current_sign_in_ip
t.inet :last_sign_in_ip
t.string :current_sign_in_ip
t.string :last_sign_in_ip
## Confirmable
# t.string :confirmation_token

View file

@ -16,8 +16,8 @@ class DeviseCreateGestionnaires < ActiveRecord::Migration
t.integer :sign_in_count, default: 0, null: false
t.datetime :current_sign_in_at
t.datetime :last_sign_in_at
t.inet :current_sign_in_ip
t.inet :last_sign_in_ip
t.string :current_sign_in_ip
t.string :last_sign_in_ip
## Confirmable
# t.string :confirmation_token

View file

@ -16,8 +16,8 @@ class CreateUsers < ActiveRecord::Migration
t.integer :sign_in_count, default: 0, null: false
t.datetime :current_sign_in_at
t.datetime :last_sign_in_at
t.inet :current_sign_in_ip
t.inet :last_sign_in_ip
t.string :current_sign_in_ip
t.string :last_sign_in_ip
## Confirmable
# t.string :confirmation_token

View file

@ -16,8 +16,8 @@ class DeviseCreateAdministrateurs < ActiveRecord::Migration
t.integer :sign_in_count, default: 0, null: false
t.datetime :current_sign_in_at
t.datetime :last_sign_in_at
t.inet :current_sign_in_ip
t.inet :last_sign_in_ip
t.string :current_sign_in_ip
t.string :last_sign_in_ip
## Confirmable
# t.string :confirmation_token

View file

@ -1,6 +1,10 @@
class ChangeDateCreationTypeToEntreprise < ActiveRecord::Migration
def up
change_column :entreprises, :date_creation, "timestamp USING to_timestamp(date_creation) at time zone 'UTC-2'"
if Rails.env.test?
change_column :entreprises, :date_creation, "timestamp"
else
change_column :entreprises, :date_creation, "timestamp USING to_timestamp(date_creation) at time zone 'UTC-2'"
end
end
def down

View file

@ -16,8 +16,8 @@ class DeviseCreateAdministrations < ActiveRecord::Migration
t.integer :sign_in_count, default: 0, null: false
t.datetime :current_sign_in_at
t.datetime :last_sign_in_at
t.inet :current_sign_in_ip
t.inet :last_sign_in_ip
t.string :current_sign_in_ip
t.string :last_sign_in_ip
## Confirmable
# t.string :confirmation_token

View file

@ -4,14 +4,14 @@ class FixDefaultTypeOnTypeDeChampTable < ActiveRecord::Migration
end
def up
TypeDeChamp.where("private = false").update_all("type = 'TypeDeChampPublic'")
TypeDeChamp.where("private = true").update_all("type = 'TypeDeChampPrivate'")
TypeDeChamp.where(private: false).update_all("type = 'TypeDeChampPublic'")
TypeDeChamp.where(private: true).update_all("type = 'TypeDeChampPrivate'")
remove_column :types_de_champ, :private
end
def down
add_column :types_de_champ, :private, :boolean, default: true
TypeDeChamp.where("type = 'TypeDeChampPublic'").update_all("private = false")
TypeDeChamp.where("type = 'TypeDeChampPrivate'").update_all("private = true")
TypeDeChamp.where("type = 'TypeDeChampPublic'").update_all(private: false)
TypeDeChamp.where("type = 'TypeDeChampPrivate'").update_all(private: true)
end
end

View file

@ -9,7 +9,7 @@ class CreateSearches < ActiveRecord::Migration
add_index :individuals, :dossier_id
add_index :pieces_justificatives, :dossier_id
add_index :rna_informations, :entreprise_id
create_view :searches #, materialized: true
create_view :searches unless Rails.env.test? #, materialized: true
end
def down
@ -22,6 +22,6 @@ class CreateSearches < ActiveRecord::Migration
remove_index :individuals, :dossier_id
remove_index :pieces_justificatives, :dossier_id
remove_index :rna_informations, :entreprise_id
drop_view :searches #, materialized: true
drop_view :searches unless Rails.env.test? #, materialized: true
end
end

View file

@ -1,9 +1,9 @@
class UpdateSearchesToVersion2 < ActiveRecord::Migration
def up
replace_view :searches, version: 2
replace_view :searches, version: 2 unless Rails.env.test?
end
def down
replace_view :searches, version: 1
replace_view :searches, version: 1 unless Rails.env.test?
end
end

View file

@ -24,8 +24,8 @@ ActiveRecord::Schema.define(version: 20170223170808) do
t.integer "sign_in_count", default: 0, null: false
t.datetime "current_sign_in_at"
t.datetime "last_sign_in_at"
t.inet "current_sign_in_ip"
t.inet "last_sign_in_ip"
t.string "current_sign_in_ip"
t.string "last_sign_in_ip"
t.datetime "created_at"
t.datetime "updated_at"
t.string "api_token"
@ -50,8 +50,8 @@ ActiveRecord::Schema.define(version: 20170223170808) do
t.integer "sign_in_count", default: 0, null: false
t.datetime "current_sign_in_at"
t.datetime "last_sign_in_at"
t.inet "current_sign_in_ip"
t.inet "last_sign_in_ip"
t.string "current_sign_in_ip"
t.string "last_sign_in_ip"
t.datetime "created_at"
t.datetime "updated_at"
t.index ["email"], name: "index_administrations_on_email", unique: true, using: :btree
@ -207,8 +207,8 @@ ActiveRecord::Schema.define(version: 20170223170808) do
t.integer "sign_in_count", default: 0, null: false
t.datetime "current_sign_in_at"
t.datetime "last_sign_in_at"
t.inet "current_sign_in_ip"
t.inet "last_sign_in_ip"
t.string "current_sign_in_ip"
t.string "last_sign_in_ip"
t.datetime "created_at"
t.datetime "updated_at"
t.integer "procedure_filter"
@ -375,8 +375,8 @@ ActiveRecord::Schema.define(version: 20170223170808) do
t.integer "sign_in_count", default: 0, null: false
t.datetime "current_sign_in_at"
t.datetime "last_sign_in_at"
t.inet "current_sign_in_ip"
t.inet "last_sign_in_ip"
t.string "current_sign_in_ip"
t.string "last_sign_in_ip"
t.datetime "created_at"
t.datetime "updated_at"
t.string "siret"