We were very inconsistent regarding these rules. Personally I prefer no empty lines around blocks, clases, etc... as recommended by the Ruby style guide [1], and they're the default values in rubocop, so those are the settings I'm applying. The exception is the `private` access modifier, since we were leaving empty lines around it most of the time. That's the default rubocop rule as well. Personally I don't have a strong preference about this one. [1] https://rubystyle.guide/#empty-lines-around-bodies
36 lines
981 B
Ruby
36 lines
981 B
Ruby
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
|
|
|
|
describe "#enqueue_remote_translation", :delay_jobs do
|
|
it "after create enqueue Delayed Job" do
|
|
expect { remote_translation.save }.to change { Delayed::Job.count }.by(1)
|
|
end
|
|
end
|
|
end
|