Sha256: 19083ce09b522ddc13c4fc1358ddeaa4b63dac62fee2d36ee561ee6031d064bb
Contents?: true
Size: 1.59 KB
Versions: 2
Compression:
Stored size: 1.59 KB
Contents
require 'zendesk_apps_support' require 'json' describe ZendeskAppsSupport::Validations::Translations do let(:package) { mock('Package', :files => translation_files) } subject { ZendeskAppsSupport::Validations::Translations.call(package) } context 'when there are no translation files' do let(:translation_files) { [] } it 'should be valid' do subject.should be_empty end end context 'when there is file with invalid JSON' do let(:translation_files) do [ mock('AppFile', :relative_path => 'translations/en.json', :read => '}') ] end it 'should report the error' do subject.length.should == 1 subject[0].to_s.should =~ /JSON/ end end context 'when there is file with JSON representing a non-Object' do let(:translation_files) do [ mock('AppFile', :relative_path => 'translations/en.json', :read => '"foo bar"') ] end it 'should report the error' do subject.length.should == 1 subject[0].to_s.should =~ /JSON/ end end context 'when there is a file with an invalid locale for a name' do let(:translation_files) do [ mock('AppFile', :relative_path => 'translations/en-US-1.json', :read => '{}') ] end it 'should report the error' do subject.length.should == 1 subject[0].to_s.should =~ /locale/ end end context 'when there is a file with a valid locale containing valid JSON' do let(:translation_files) do [ mock('AppFile', :relative_path => 'translations/en-US.json', :read => '{}') ] end it 'should be valid' do subject.length.should == 0 end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
zendesk_apps_support-1.7.0 | spec/validations/translations_spec.rb |
zendesk_apps_support-1.6.0 | spec/validations/translations_spec.rb |