spec/spec_helper.rb in traco-0.1.0 vs spec/spec_helper.rb in traco-0.2.1

- old
+ new

@@ -4,18 +4,29 @@ config.run_all_when_everything_filtered = true # Clear class state before each spec. config.before(:each) do Object.send(:remove_const, 'Post') - load 'dummy/app/models/post.rb' + Object.send(:remove_const, 'SubPost') + load 'app/post.rb' end - end -# Rails +# Test against real ActiveRecord models. +# Very much based on the test setup in +# https://github.com/iain/translatable_columns/ -ENV["RAILS_ENV"] = "test" +require "active_record" +require "app/post.rb" -require File.expand_path("../dummy/config/environment.rb", __FILE__) -require "rails/test_help" +ActiveRecord::Base.establish_connection adapter: "sqlite3", database: ":memory:" -Rails.backtrace_cleaner.remove_silencers! +silence_stream(STDOUT) do + ActiveRecord::Schema.define(version: 0) do + create_table :posts, force: true do |t| + t.string :title_sv, :title_en, :title_fi + t.string :body_sv, :body_en, :body_fi + end + end +end + +I18n.load_path << "spec/app/sv.yml"