Sha256: b712e4093ed3c8c9ef30f7c5204eb92f358e7aec9b511e09cf1de51136885732

Contents?: true

Size: 818 Bytes

Versions: 5

Compression:

Stored size: 818 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.translation_helper.find_translation_by_locale(locale).nil?
  end
end

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
simple_model_translations-0.2.8 spec/spec_helper.rb
simple_model_translations-0.2.7 spec/spec_helper.rb
simple_model_translations-0.2.6 spec/spec_helper.rb
simple_model_translations-0.2.5 spec/spec_helper.rb
simple_model_translations-0.2.4 spec/spec_helper.rb