Skip to content

Commit

Permalink
Clean up styling comments left by rubocop
Browse files Browse the repository at this point in the history
  • Loading branch information
jebentier committed Oct 29, 2020
1 parent ded3a9b commit dfe1178
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 17 deletions.
6 changes: 3 additions & 3 deletions lib/contextual_logger/context/registry.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class DuplicateDefinitionError < StandardError; end
class MissingDefinitionError < StandardError; end

def initialize(&definitions)
@strict = true
@strict = true
@raise_on_missing_definition = true

super
Expand Down Expand Up @@ -61,11 +61,11 @@ def to_h

private

def strict(value)
def strict(value) # rubocop:disable Style/TrivialAccessors
@strict = value
end

def raise_on_missing_definition(value)
def raise_on_missing_definition(value) # rubocop:disable Style/TrivialAccessors
@raise_on_missing_definition = value
end
end
Expand Down
26 changes: 13 additions & 13 deletions spec/lib/contextual_logger/context/registry_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

require 'contextual_logger'

def itShouldDedupRegistry(&block)
def it_should_dedup_registry(&block)
context 'when defining duplicate keys' do
it 'raises a DuplicateDefinitionError' do
expect { described_class.new(&block) }.to raise_error(ContextualLogger::Context::Registry::DuplicateDefinitionError)
Expand All @@ -11,7 +11,7 @@ def itShouldDedupRegistry(&block)
end

RSpec.describe ContextualLogger::Context::Registry do
let(:registry) { described_class.new {} }
let(:registry) { described_class.new { } }

context '#strict?' do
subject { registry.strict? }
Expand Down Expand Up @@ -69,10 +69,10 @@ def itShouldDedupRegistry(&block)
{ test_context: { type: :string, formatter: :to_s } }
end

it { should eq(expected_context_shape)}
it { should eq(expected_context_shape) }
end

itShouldDedupRegistry do
it_should_dedup_registry do
string :test_context
string :test_context
end
Expand All @@ -90,10 +90,10 @@ def itShouldDedupRegistry(&block)
{ test_context: hash_including({ type: :boolean }) }
end

it { should include(expected_context_shape)}
it { should include(expected_context_shape) }
end

itShouldDedupRegistry do
it_should_dedup_registry do
boolean :test_context
boolean :test_context
end
Expand All @@ -111,10 +111,10 @@ def itShouldDedupRegistry(&block)
{ test_context: { type: :number, formatter: :to_i } }
end

it { should eq(expected_context_shape)}
it { should eq(expected_context_shape) }
end

itShouldDedupRegistry do
it_should_dedup_registry do
number :test_context
number :test_context
end
Expand All @@ -132,17 +132,17 @@ def itShouldDedupRegistry(&block)
{ test_context: hash_including({ type: :date }) }
end

it { should include(expected_context_shape)}
it { should include(expected_context_shape) }
end

itShouldDedupRegistry do
it_should_dedup_registry do
date :test_context
date :test_context
end
end

context 'when defining a hash' do
itShouldDedupRegistry do
it_should_dedup_registry do
hash :test_context do
string :test_sub_context
end
Expand Down Expand Up @@ -172,7 +172,7 @@ def itShouldDedupRegistry(&block)
}
end

it { should eq(expected_context_shape)}
it { should eq(expected_context_shape) }
end

context 'when defining nested context entries' do
Expand Down Expand Up @@ -204,7 +204,7 @@ def itShouldDedupRegistry(&block)
}
end

it { should eq(expected_context_shape)}
it { should eq(expected_context_shape) }
end
end
end
Expand Down
6 changes: 5 additions & 1 deletion spec/lib/contextual_logger/logger_with_context_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,11 @@

context "when string passed as context key" do
before do
expect(ActiveSupport::Deprecation).to receive(:warn).with('Context keys must use symbols not strings. This will be asserted as of contextual_logger v1.0.0').and_return(true)
expect(ActiveSupport::Deprecation).to(
receive(:warn)
.with('Context keys must use symbols not strings. This will be asserted as of contextual_logger v1.0.0')
.and_return(true)
)
end

it "returns context with a symbol key" do
Expand Down

0 comments on commit dfe1178

Please sign in to comment.