spec/expect_violation/expectation_spec.rb in rubocop-rspec-1.12.0 vs spec/expect_violation/expectation_spec.rb in rubocop-rspec-1.13.0
- old
+ new
@@ -4,13 +4,13 @@
subject(:expectation) { described_class.new(string) }
context 'when given a single assertion on class end' do
let(:string) do
<<-SRC
- class Foo
- end
- ^^^ The end of `Foo` should be annotated.
+ class Foo
+ end
+ ^^^ The end of `Foo` should be annotated.
SRC
end
let(:assertion) { expectation.assertions.first }
@@ -21,35 +21,35 @@
it 'has an assertion on line 2' do
expect(assertion.line_number).to be(2)
end
it 'has an assertion on column range 1-3' do
- expect(assertion.column_range).to eql(6...9)
+ expect(assertion.column_range).to eql(8...11)
end
it 'has an assertion with correct violation message' do
expect(assertion.message).to eql('The end of `Foo` should be annotated.')
end
it 'recreates source' do
expect(expectation.source).to eql(<<-RUBY)
- class Foo
- end
+ class Foo
+ end
RUBY
end
end
context 'when given many assertions on two lines' do
let(:string) do
<<-SRC
- foo bar
- ^ Charlie
- ^^ Charlie
- ^^ Bronco
- ^^ Alpha
- baz
- ^ Delta
+ foo bar
+ ^ Charlie
+ ^^ Charlie
+ ^^ Bronco
+ ^^ Alpha
+ baz
+ ^ Delta
SRC
end
let(:assertions) { expectation.assertions.sort }
@@ -63,11 +63,11 @@
)
end
it 'has assertions on column range 1-3' do
expect(assertions.map(&:column_range)).to eql(
- [9...11, 10...11, 10...12, 10...12, 6...7]
+ [11...13, 12...13, 12...14, 12...14, 8...9]
)
end
it 'has an assertion with correct violation message' do
expect(assertions.map(&:message)).to eql(
@@ -75,11 +75,11 @@
)
end
it 'recreates source' do
expect(expectation.source).to eql(<<-RUBY)
- foo bar
- baz
+ foo bar
+ baz
RUBY
end
end
end