Skip to content

Commit

Permalink
swap out standalone_migrations for combustion
Browse files Browse the repository at this point in the history
https://github.com/pat/combustion
preparing to use combustion for an integration test with a dummy rails app
  • Loading branch information
jrochkind committed Apr 14, 2018
1 parent 5079f2e commit 2e8011a
Show file tree
Hide file tree
Showing 11 changed files with 40 additions and 76 deletions.
4 changes: 1 addition & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ source 'https://rubygems.org'
# Specify your gem's dependencies in json_attribute.gemspec
gemspec

# Hopefully temporary, so we can test under rails 5.2
# https://github.com/thuss/standalone-migrations/pull/142
gem 'standalone_migrations', git: "https://github.com/jrochkind/standalone-migrations.git", branch: "ar_5_2"
gem 'combustion', '~> 0.9.0', :group => :test

if ENV['RAILS_GEM']
gem "activerecord", ENV['RAILS_GEM'].split(",")
Expand Down
3 changes: 0 additions & 3 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ require "rubygems"
require "bundler/setup"
require "bundler/gem_tasks"
require "rspec/core/rake_task"
require "standalone_migrations"

StandaloneMigrations::Tasks.load_tasks

RSpec::Core::RakeTask.new

Expand Down
22 changes: 0 additions & 22 deletions db/migrate/20170427212958_set_up_testing_db.rb

This file was deleted.

36 changes: 0 additions & 36 deletions db/schema.rb

This file was deleted.

1 change: 0 additions & 1 deletion json_attribute.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,4 @@ existing ActiveRecord architecture as we can.}
spec.add_development_dependency "rake", ">= 10.0"
spec.add_development_dependency "rspec", "~> 3.5"
spec.add_development_dependency "database_cleaner", "~> 1.5"
spec.add_development_dependency "standalone_migrations", "~> 5.2"
end
3 changes: 0 additions & 3 deletions db/config.yml → spec/internal/config/database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,5 @@ default: &default
adapter: postgresql
database: json_attribute_project

development:
<<: *default

test:
<<: *default
5 changes: 5 additions & 0 deletions spec/internal/config/routes.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# frozen_string_literal: true

Rails.application.routes.draw do
#
end
24 changes: 24 additions & 0 deletions spec/internal/db/schema.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
ActiveRecord::Schema.define do

# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"

create_table "product_categories", force: :cascade do |t|
t.jsonb "options"
end

create_table "products", force: :cascade do |t|
t.jsonb "json_attributes"
t.jsonb "other_attributes"
t.string "string_type"
t.integer "integer_type"
t.integer "product_category_id"
t.boolean "boolean_type"
t.float "float_type"
t.time "time_type"
t.date "date_type"
t.datetime "datetime_type"
t.decimal "decimal_type"
end

end
1 change: 1 addition & 0 deletions spec/internal/log/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.log
Empty file.
17 changes: 9 additions & 8 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,20 @@
# users commonly want.
#
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
require 'yaml'
require 'bundler'
# replace manual requires with? :
# #Bundler.require :default, :development, :test

require 'yaml'
require "database_cleaner"

require 'byebug'

require 'json_attribute'

require 'combustion'
Combustion.initialize! :active_record



RSpec.configure do |config|
# rspec-expectations config goes here. You can use an alternate
# assertion/expectation library such as wrong or the stdlib/minitest
Expand Down Expand Up @@ -108,11 +114,6 @@
# as the one that triggered the failure.
Kernel.srand config.seed

config.before :suite do
dbconfig = YAML.load(File.open("db/config.yml"))
ActiveRecord::Base.establish_connection(dbconfig["test"])
end

config.before do
DatabaseCleaner.clean_with(:truncation)
end
Expand Down

0 comments on commit 2e8011a

Please sign in to comment.