spec/unit/project_spec.rb in omnibus-4.0.0.beta.1 vs spec/unit/project_spec.rb in omnibus-4.0.0.rc.1

- old
+ new

@@ -21,10 +21,11 @@ end end it_behaves_like 'a cleanroom setter', :name, %|name 'chef'| it_behaves_like 'a cleanroom setter', :friendly_name, %|friendly_name 'Chef'| + it_behaves_like 'a cleanroom setter', :package_name, %|package_name 'chef.package'| it_behaves_like 'a cleanroom setter', :maintainer, %|maintainer 'Chef Software, Inc'| it_behaves_like 'a cleanroom setter', :homepage, %|homepage 'https://getchef.com'| it_behaves_like 'a cleanroom setter', :description, %|description 'Installs the thing'| it_behaves_like 'a cleanroom setter', :replace, %|replace 'old-chef'| it_behaves_like 'a cleanroom setter', :conflict, %|conflict 'puppet'| @@ -39,10 +40,12 @@ it_behaves_like 'a cleanroom setter', :runtime_dependency, %|runtime_dependency 'libxslt'| it_behaves_like 'a cleanroom setter', :exclude, %|exclude 'hamlet'| it_behaves_like 'a cleanroom setter', :config_file, %|config_file '/path/to/config.rb'| it_behaves_like 'a cleanroom setter', :extra_package_file, %|extra_package_file '/path/to/asset'| + it_behaves_like 'a cleanroom getter', :files_path + describe 'basics' do it 'returns a name' do expect(subject.name).to eq('sample') end @@ -121,29 +124,37 @@ expect(subject).to have_exposed_method(:default_root) end end describe '#dirty!' do + let(:software) { double(Omnibus::Software) } + it 'dirties the cache' do - subject.instance_variable_set(:@dirty, nil) - subject.dirty! + subject.instance_variable_set(:@culprit, nil) + subject.dirty!(software) expect(subject).to be_dirty end + + it 'sets the culprit' do + subject.instance_variable_set(:@culprit, nil) + subject.dirty!(software) + expect(subject.culprit).to be(software) + end end describe '#dirty?' do it 'returns true by default' do - subject.instance_variable_set(:@dirty, nil) + subject.instance_variable_set(:@culprit, nil) expect(subject).to_not be_dirty end it 'returns true when the cache is dirty' do - subject.instance_variable_set(:@dirty, true) + subject.instance_variable_set(:@culprit, true) expect(subject).to be_dirty end it 'returns false when the cache is not dirty' do - subject.instance_variable_set(:@dirty, false) + subject.instance_variable_set(:@culprit, false) expect(subject).to_not be_dirty end end describe '#<=>' do