Skip to content

Commit

Permalink
chore: fix rubocop offenses
Browse files Browse the repository at this point in the history
  • Loading branch information
marcosgz committed Jul 10, 2024
1 parent c9a3b1d commit ba9fab5
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 24 deletions.
24 changes: 24 additions & 0 deletions spec/esse/active_record/callback_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
require 'spec_helper'

RSpec.describe Esse::ActiveRecord::Callback do
let(:callback_class) do
Class.new(described_class)
end
let(:repo) { double }

it 'raises an error if #call is not implemented' do
expect {
callback_class.new(repo: repo).call(nil)
}.to raise_error(NotImplementedError, 'You must implement #call method')
end

it 'has options' do
callback = callback_class.new(repo: repo, foo: 'bar')
expect(callback.options).to eq(foo: 'bar')
end

it 'has a block result' do
callback = callback_class.new(repo: repo, block_result: 'result')
expect(callback.block_result).to eq('result')
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require 'spec_helper'

RSpec.describe Esse::ActiveRecord::Callbacks::UpdateLazyAttribute do
let(:repo) { double('repo') }
let(:repo) { instance_double(Esse::Repository) }

describe '.initialize' do
it 'sets attribute_name' do
Expand Down
23 changes: 0 additions & 23 deletions spec/esse/active_record/callbacks_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,26 +62,3 @@
end
end
end

RSpec.describe Esse::ActiveRecord::Callback do
let(:callback_class) do
Class.new(described_class)
end
let(:repo) { double }

it 'raises an error if #call is not implemented' do
expect {
callback_class.new(repo: repo).call(nil)
}.to raise_error(NotImplementedError, 'You must implement #call method')
end

it 'has options' do
callback = callback_class.new(repo: repo, foo: 'bar')
expect(callback.options).to eq(foo: 'bar')
end

it 'has a block result' do
callback = callback_class.new(repo: repo, block_result: 'result')
expect(callback.block_result).to eq('result')
end
end

0 comments on commit ba9fab5

Please sign in to comment.