Sha256: 3c418f3a431cc4b8bcb070c9c7a78fea9a55e876792a374cdb5db5cce4c40908

Contents?: true

Size: 780 Bytes

Versions: 2

Compression:

Stored size: 780 Bytes

Contents

require 'bundler'
Bundler.require(:default, :development)

ActiveRecord::Base.establish_connection(:adapter => 'sqlite3', :database => ':memory:')
DatabaseCleaner.strategy = :transaction

require 'spec/data/schema'
require 'spec/data/models'

RSpec.configure do |config|
  config.before do
    I18n.locale = :ru
    I18n.default_locale = :ru
    
    DatabaseCleaner.start
  end
  config.after do
    DatabaseCleaner.clean
  end
  
  config.mock_with :rspec
end

RSpec::Matchers.define :have_translation do |locale|
  match do |record|
    !record.find_translation_by_locale(locale).nil?
  end
end

RSpec::Matchers.define :have_translated_attribute do |locale, attribute, value|
  match do |record|
    record.find_translation_by_locale(locale).send(attribute) == value
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
simple_model_translations-0.2.3 spec/spec_helper.rb
simple_model_translations-0.2.2 spec/spec_helper.rb