2014-11-04 21:16:06 +02:00
|
|
|
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"
|
2014-11-04 21:16:06 +02:00
|
|
|
|
|
|
|
I18n.locale = :en
|
2019-04-28 21:10:54 +03:00
|
|
|
actual.send "#{expected}=", "Test English"
|
2014-11-04 21:16:06 +02:00
|
|
|
|
2019-04-28 21:10:54 +03:00
|
|
|
expect(actual.send(expected)).to eq "Test English"
|
2014-11-04 21:16:06 +02:00
|
|
|
|
|
|
|
I18n.locale = :bg
|
2019-04-28 21:10:54 +03:00
|
|
|
expect(actual.send(expected)).to eq "Test Bulgarian"
|
2014-11-04 21:16:06 +02:00
|
|
|
end
|
|
|
|
end
|