spec/puppet-check_spec.rb in puppet-check-1.0.0 vs spec/puppet-check_spec.rb in puppet-check-1.1.0
- old
+ new
@@ -22,26 +22,28 @@
expect(PuppetCheck.rubocop_args).to eql(['--rubocop-arg-one', '--rubocop-arg-two'])
end
end
context '.parse_paths' do
+ before(:each) { Dir.chdir(fixtures_dir) }
+
let(:no_files) { puppetcheck.parse_paths(%w(foo bar baz)) }
- let(:file) { puppetcheck.parse_paths([fixtures_dir + 'lib/good.rb']) }
- let(:dir) { puppetcheck.parse_paths([fixtures_dir]) }
- let(:multi_dir) { puppetcheck.parse_paths([fixtures_dir + 'hieradata', fixtures_dir + 'lib', fixtures_dir + 'manifests']) }
- let(:repeats) { puppetcheck.parse_paths([fixtures_dir + 'hieradata', fixtures_dir + 'hieradata', fixtures_dir + 'lib', fixtures_dir + 'hieradata/good.json', fixtures_dir + 'manifests/good.pp', fixtures_dir + 'manifests/good.pp']) }
+ let(:file) { puppetcheck.parse_paths(['lib/good.rb']) }
+ let(:dir) { puppetcheck.parse_paths(['.']) }
+ let(:multi_dir) { puppetcheck.parse_paths(%w(hieradata lib manifests)) }
+ let(:repeats) { puppetcheck.parse_paths(['hieradata', 'hieradata', 'lib', 'hieradata/good.json', 'manifests/good.pp', 'manifests/good.pp']) }
it 'raises an error if no files were found' do
expect { no_files }.to raise_error(RuntimeError, 'No files found in supplied paths foo, bar, baz.')
end
it 'correctly parses one file and returns it' do
- expect(file[0]).to match(%r{spec/fixtures/lib/good.rb})
+ expect(file[0]).to eql('lib/good.rb')
end
it 'correctly parses one directory and returns all of its files' do
dir.each { |file| expect(File.file?(file)).to be true }
- expect(dir.length).to eql(26)
+ expect(dir.length).to eql(27)
end
it 'correctly parses multiple directories and returns all of their files' do
multi_dir.each { |file| expect(File.file?(file)).to be true }
expect(multi_dir.length).to eql(13)