Sha256: 9d8129055ff160d6855d13523ba0b2e22669c7a07a0af935dee9eff0690e0004
Contents?: true
Size: 1.79 KB
Versions: 2
Compression:
Stored size: 1.79 KB
Contents
# encoding: utf-8 describe RuboCop::Cop::RSpec::Focus do subject(:cop) { described_class.new } [ :example_group, :describe, :context, :xdescribe, :xcontext, :it, :example, :specify, :xit, :xexample, :xspecify, :feature, :scenario, :xfeature, :xscenario ].each do |block_type| it "finds `#{block_type}` blocks with `focus: true`" do inspect_source( cop, [ "#{block_type} 'test', focus: true do", 'end' ] ) expect(cop.offenses.size).to eq(1) expect(cop.offenses.map(&:line).sort).to eq([1]) expect(cop.messages).to eq(['Focused spec found.']) expect(cop.highlights).to eq(['focus: true']) end it "finds `#{block_type}` blocks with `:focus`" do inspect_source( cop, [ "#{block_type} 'test', :focus do", 'end' ] ) expect(cop.offenses.size).to eq(1) expect(cop.offenses.map(&:line).sort).to eq([1]) expect(cop.messages).to eq(['Focused spec found.']) expect(cop.highlights).to eq([':focus']) end it 'detects no offense when spec is not focused' do inspect_source( cop, [ "#{block_type} 'test' do", 'end' ] ) expect(subject.messages).to be_empty end end [ :fdescribe, :fcontext, :focus, :fexample, :fit, :fspecify, :ffeature, :fscenario ].each do |block_type| it "finds `#{block_type}` blocks" do inspect_source( cop, [ "#{block_type} 'test' do", 'end' ] ) expect(cop.offenses.size).to eq(1) expect(cop.offenses.map(&:line).sort).to eq([1]) expect(cop.messages).to eq(['Focused spec found.']) expect(cop.highlights).to eq(["#{block_type} 'test'"]) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rubocop-rspec-1.5.1 | spec/rubocop/cop/rspec/focus_spec.rb |
rubocop-rspec-1.5.0 | spec/rubocop/cop/rspec/focus_spec.rb |