Sha256: d8e7bf29238ea6c0782d9d90ab72ee3feaa965604f0b2279e9b9bec6fc76b6df

Contents?: true

Size: 775 Bytes

Versions: 4

Compression:

Stored size: 775 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

4 entries across 4 versions & 1 rubygems

Version Path
simple_model_translations-0.2.1 spec/spec_helper.rb
simple_model_translations-0.2.0 spec/spec_helper.rb
simple_model_translations-0.1.9 spec/spec_helper.rb
simple_model_translations-0.1.8 spec/spec_helper.rb