lib/rubocop/cop/rspec/implicit_subject.rb in rubocop-rspec-2.3.0 vs lib/rubocop/cop/rspec/implicit_subject.rb in rubocop-rspec-2.4.0
- old
+ new
@@ -5,19 +5,35 @@
module RSpec
# Checks for usage of implicit subject (`is_expected` / `should`).
#
# This cop can be configured using the `EnforcedStyle` option
#
- # @example `EnforcedStyle: single_line_only`
+ # @example `EnforcedStyle: single_line_only` (default)
# # bad
# it do
# is_expected.to be_truthy
# end
#
# # good
# it { is_expected.to be_truthy }
# it do
# expect(subject).to be_truthy
+ # end
+ #
+ # @example `EnforcedStyle: single_statement_only`
+ # # bad
+ # it do
+ # foo = 1
+ # is_expected.to be_truthy
+ # end
+ #
+ # # good
+ # it do
+ # foo = 1
+ # expect(subject).to be_truthy
+ # end
+ # it do
+ # is_expected.to be_truthy
# end
#
# @example `EnforcedStyle: disallow`
# # bad
# it { is_expected.to be_truthy }