clarion/spec/support/matchers/has_translatable.rb

15 lines
363 B
Ruby
Raw Permalink Normal View History

RSpec::Matchers.define :have_translatable do |expected|
match do |actual|
I18n.locale = :bg
2019-04-28 21:10:54 +03:00
actual.send "#{expected}=", "Test Bulgarian"
I18n.locale = :en
2019-04-28 21:10:54 +03:00
actual.send "#{expected}=", "Test English"
2019-04-28 21:10:54 +03:00
expect(actual.send(expected)).to eq "Test English"
I18n.locale = :bg
2019-04-28 21:10:54 +03:00
expect(actual.send(expected)).to eq "Test Bulgarian"
end
end