clarion/spec/support/matchers/has_translatable.rb
Petko Bordjukov 6330940a34 Add tests for translatable Conference attributes
Test if the title and the description attributes of the Conference model
are translatable. Also introduce a custom matcher for translatable
attributes as there will be many. Fix a typo in the process.
2014-11-04 21:16:06 +02:00

15 lines
371 B
Ruby

RSpec::Matchers.define :have_translatable do |expected|
match do |actual|
I18n.locale = :bg
actual.send "#{expected.to_s}=", 'Test Bulgarian'
I18n.locale = :en
actual.send "#{expected.to_s}=", 'Test English'
expect(actual.send expected).to eq 'Test English'
I18n.locale = :bg
expect(actual.send expected).to eq 'Test Bulgarian'
end
end