Create RemoteTranslation model

- Each RemoteTranslation is associated with a resource (through polymorphic)
  and has the locale to we want translate.
- After create a RemoteTranslation we create a enqueue_remote_translation
  method that will be send remote translation instance to remote translation
  client
This commit is contained in:
taitus
2019-01-25 15:00:52 +01:00
committed by voodoorai2000
parent 25e9c358ad
commit 04810f5080
5 changed files with 72 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
require "rails_helper"
describe RemoteTranslation do
let(:remote_translation) { build(:remote_translation, locale: :es) }
it "is valid" do
expect(remote_translation).to be_valid
end
it "is valid without error_message" do
remote_translation.error_message = nil
expect(remote_translation).to be_valid
end
it "is not valid without to" do
remote_translation.locale = nil
expect(remote_translation).not_to be_valid
end
it "is not valid without a remote_translatable_id" do
remote_translation.remote_translatable_id = nil
expect(remote_translation).not_to be_valid
end
it "is not valid without a remote_translatable_type" do
remote_translation.remote_translatable_type = nil
expect(remote_translation).not_to be_valid
end
end
end