Commit db630c53 authored by alinamihaila's avatar alinamihaila

Use string for source

parent dc42bddc
...@@ -32,9 +32,7 @@ RSpec.describe RuboCop::Cop::UsageData::LargeTable, type: :rubocop do ...@@ -32,9 +32,7 @@ RSpec.describe RuboCop::Cop::UsageData::LargeTable, type: :rubocop do
context 'with large tables' do context 'with large tables' do
context 'when calling Issue.count' do context 'when calling Issue.count' do
it 'register an offence' do it 'register an offence' do
inspect_source <<~SRC inspect_source('Issue.count')
Issue.count
SRC
expect(cop.offenses.size).to eq(1) expect(cop.offenses.size).to eq(1)
end end
...@@ -42,9 +40,7 @@ RSpec.describe RuboCop::Cop::UsageData::LargeTable, type: :rubocop do ...@@ -42,9 +40,7 @@ RSpec.describe RuboCop::Cop::UsageData::LargeTable, type: :rubocop do
context 'when calling Issue.active.count' do context 'when calling Issue.active.count' do
it 'register an offence' do it 'register an offence' do
inspect_source <<~SRC inspect_source('Issue.active.count')
Issue.active.count
SRC
expect(cop.offenses.size).to eq(1) expect(cop.offenses.size).to eq(1)
end end
...@@ -52,9 +48,7 @@ RSpec.describe RuboCop::Cop::UsageData::LargeTable, type: :rubocop do ...@@ -52,9 +48,7 @@ RSpec.describe RuboCop::Cop::UsageData::LargeTable, type: :rubocop do
context 'when calling count(Issue)' do context 'when calling count(Issue)' do
it 'does not register an offence' do it 'does not register an offence' do
inspect_source <<~SRC inspect_source('count(Issue)')
count(Issue)
SRC
expect(cop.offenses).to be_empty expect(cop.offenses).to be_empty
end end
...@@ -62,9 +56,7 @@ RSpec.describe RuboCop::Cop::UsageData::LargeTable, type: :rubocop do ...@@ -62,9 +56,7 @@ RSpec.describe RuboCop::Cop::UsageData::LargeTable, type: :rubocop do
context 'when calling count(Ci::Build.active)' do context 'when calling count(Ci::Build.active)' do
it 'does not register an offence' do it 'does not register an offence' do
inspect_source <<~SRC inspect_source('count(Ci::Build.active)')
count(Ci::Build.active)
SRC
expect(cop.offenses).to be_empty expect(cop.offenses).to be_empty
end end
...@@ -72,9 +64,7 @@ RSpec.describe RuboCop::Cop::UsageData::LargeTable, type: :rubocop do ...@@ -72,9 +64,7 @@ RSpec.describe RuboCop::Cop::UsageData::LargeTable, type: :rubocop do
context 'when calling Ci::Build.active.count' do context 'when calling Ci::Build.active.count' do
it 'register an offence' do it 'register an offence' do
inspect_source <<~SRC inspect_source('Ci::Build.active.count')
Ci::Build.active.count
SRC
expect(cop.offenses.size).to eq(1) expect(cop.offenses.size).to eq(1)
end end
...@@ -82,9 +72,7 @@ RSpec.describe RuboCop::Cop::UsageData::LargeTable, type: :rubocop do ...@@ -82,9 +72,7 @@ RSpec.describe RuboCop::Cop::UsageData::LargeTable, type: :rubocop do
context 'when using allowed methods' do context 'when using allowed methods' do
it 'does not register an offence' do it 'does not register an offence' do
inspect_source <<~SRC inspect_source('Issue.minimum')
Issue.minimum
SRC
expect(cop.offenses).to be_empty expect(cop.offenses).to be_empty
end end
...@@ -93,9 +81,7 @@ RSpec.describe RuboCop::Cop::UsageData::LargeTable, type: :rubocop do ...@@ -93,9 +81,7 @@ RSpec.describe RuboCop::Cop::UsageData::LargeTable, type: :rubocop do
context 'with non related class' do context 'with non related class' do
it 'does not register an offence' do it 'does not register an offence' do
inspect_source <<~SRC inspect_source('Rails.count')
Rails.count
SRC
expect(cop.offenses).to be_empty expect(cop.offenses).to be_empty
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment