Sha256: 6509743ca9f4166fe6b276291db8353e5efc78f8658a7eae6cda4aeae2e36685
Contents?: true
Size: 1.81 KB
Versions: 2
Compression:
Stored size: 1.81 KB
Contents
require 'coveralls' require 'simplecov' SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[ SimpleCov::Formatter::HTMLFormatter, Coveralls::SimpleCov::Formatter, ] SimpleCov.start do add_filter Bundler.bundle_path.to_s add_filter File.dirname(__FILE__) end require 'switch_point' require 'models' RSpec.configure do |config| config.filter_run :focus config.run_all_when_everything_filtered = true if config.files_to_run.one? config.full_backtrace = true config.default_formatter = 'doc' end config.order = :random Kernel.srand config.seed config.expect_with :rspec do |expectations| expectations.syntax = :expect end config.mock_with :rspec do |mocks| mocks.syntax = :expect mocks.verify_partial_doubles = true end config.before(:suite) do Book.with_writable do Book.connection.execute('CREATE TABLE books (id integer primary key autoincrement)') end FileUtils.cp('main_writable.sqlite3', 'main_readonly.sqlite3') Note.connection.execute('CREATE TABLE notes (id integer primary key autoincrement)') Nanika3.connection.execute('CREATE TABLE nanika3s (id integer primary key)') end config.after(:suite) do ActiveRecord::Base.configurations.each_value do |config| FileUtils.rm_f(config[:database]) end end config.after(:each) do Book.with_writable do Book.delete_all end FileUtils.cp('main_writable.sqlite3', 'main_readonly.sqlite3') Nanika3.delete_all end end RSpec::Matchers.define :connect_to do |expected| database_name = lambda do |model| model.connection.pool.spec.config[:database] end match do |actual| database_name.call(actual) == expected end failure_message do |actual| "expected #{actual.name} to connect to #{expected} but connected to #{database_name.call(actual)}" end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
switch_point-0.4.2 | spec/spec_helper.rb |
switch_point-0.4.1 | spec/spec_helper.rb |