spec/rubocop/cop/rspec/iterated_expectation_spec.rb in rubocop-rspec-1.15.0 vs spec/rubocop/cop/rspec/iterated_expectation_spec.rb in rubocop-rspec-1.15.1
- old
+ new
@@ -57,9 +57,17 @@
[user1, user2, user3].each { |user| expect(user.name).to be }
end
RUBY
end
+ it 'ignores assignments in the iteration' do
+ expect_no_violations(<<-RUBY)
+ it 'validates users' do
+ [user1, user2, user3].each { |user| array = array.concat(user) }
+ end
+ RUBY
+ end
+
it 'ignores `each` when there is a negative expectation' do
expect_no_violations(<<-RUBY)
it 'validates users' do
[user1, user2, user3].each do |user|
expect(user).not_to receive(:method)