Sha256: d5576bbb77161468b4a1f3596eea31b4d17ef4acce29fae32cd0eab8b7c2e9a8
Contents?: true
Size: 1.9 KB
Versions: 1
Compression:
Stored size: 1.9 KB
Contents
require 'test_helper' require 'rubycritic/revision_comparator' describe RubyCritic::RevisionComparator do subject { RubyCritic::RevisionComparator.new([]) } describe '#set_statuses' do context 'in a SCS with :revision? == false' do before do RubyCritic::Config.expects(:source_control_system) .at_least_once .returns(stub(revision?: false)) end it 'does not attempt to compare with previous results' do subject.expects(:load_cached_analysed_modules).never result = subject.set_statuses([]) result.must_equal([]) end end context 'in a SCS with :revision? == true' do before do RubyCritic::Config.expects(:source_control_system) .at_least_once .returns(stub(revision?: true)) end context 'without previously cached results' do before do subject.expects(:revision_file).returns('foo') File.expects(:file?).with('foo').returns(false) end it 'does not load them' do RubyCritic::Serializer.expects(:new).never subject.set_statuses([]) end it 'does not invoke RubyCritic::SmellsStatusSetter' do RubyCritic::SmellsStatusSetter.expects(:set).never subject.set_statuses([]) end end context 'with previously cached results' do before do subject.expects(:revision_file).twice.returns('foo') File.expects(:file?).with('foo').returns(true) RubyCritic::Serializer.expects(:new).with('foo').returns(stub(load: [])) end it 'loads them' do subject.set_statuses([]) end it 'invokes RubyCritic::SmellsStatusSetter' do RubyCritic::SmellsStatusSetter.expects(:set).once subject.set_statuses([]) end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rubycritic-2.9.3 | test/lib/rubycritic/revision_comparator_test.rb |