spec/Gemfile: switch to rspec-puppet 2

The big win is that it's now possible to test the future parser with the
latest Puppet release. In the past it wasn't possible to test future parser
with anything higher than 3.5.x.
This commit is contained in:
Matthew Haughton 2014-12-02 23:07:20 -05:00
parent e6d1695f82
commit faa974b745
8 changed files with 20 additions and 20 deletions

View file

@ -11,7 +11,7 @@ group :rake, :test do
end end
group :rake do group :rake do
gem 'rspec-puppet', '~>1.0' gem 'rspec-puppet', '>=2', :require => false
gem 'rake', '>=0.9.2.2' gem 'rake', '>=0.9.2.2'
gem 'puppet-lint', '>=1.0.1' gem 'puppet-lint', '>=1.0.1'
gem 'rspec-system-serverspec', :require => false gem 'rspec-system-serverspec', :require => false

View file

@ -228,7 +228,7 @@ describe 'nginx::config' do
if matches.all? { |m| m.is_a? Regexp } if matches.all? { |m| m.is_a? Regexp }
matches.each { |item| is_expected.to contain_file('/etc/nginx/nginx.conf').with_content(item) } matches.each { |item| is_expected.to contain_file('/etc/nginx/nginx.conf').with_content(item) }
else else
lines = subject.resource('file', '/etc/nginx/nginx.conf').send(:parameters)[:content].split("\n") lines = catalogue.resource('file', '/etc/nginx/nginx.conf').send(:parameters)[:content].split("\n")
expect(lines & Array(param[:match])).to eq(Array(param[:match])) expect(lines & Array(param[:match])).to eq(Array(param[:match]))
end end
@ -298,7 +298,7 @@ describe 'nginx::config' do
if matches.all? { |m| m.is_a? Regexp } if matches.all? { |m| m.is_a? Regexp }
matches.each { |item| is_expected.to contain_file('/etc/nginx/conf.d/proxy.conf').with_content(item) } matches.each { |item| is_expected.to contain_file('/etc/nginx/conf.d/proxy.conf').with_content(item) }
else else
lines = subject.resource('file', '/etc/nginx/conf.d/proxy.conf').send(:parameters)[:content].split("\n") lines = catalogue.resource('file', '/etc/nginx/conf.d/proxy.conf').send(:parameters)[:content].split("\n")
expect(lines & Array(param[:match])).to eq(Array(param[:match])) expect(lines & Array(param[:match])).to eq(Array(param[:match]))
end end

View file

@ -99,7 +99,7 @@ describe 'nginx::resource::geo' do
it { is_expected.to contain_file("/etc/nginx/conf.d/#{title}-geo.conf").with_mode('0644') } it { is_expected.to contain_file("/etc/nginx/conf.d/#{title}-geo.conf").with_mode('0644') }
it param[:title] do it param[:title] do
verify_contents(subject, "/etc/nginx/conf.d/#{title}-geo.conf", Array(param[:match])) verify_contents(catalogue, "/etc/nginx/conf.d/#{title}-geo.conf", Array(param[:match]))
Array(param[:notmatch]).each do |item| Array(param[:notmatch]).each do |item|
is_expected.to contain_file("/etc/nginx/conf.d/#{title}-geo.conf").without_content(item) is_expected.to contain_file("/etc/nginx/conf.d/#{title}-geo.conf").without_content(item)
end end

View file

@ -162,7 +162,7 @@ describe 'nginx::resource::location' do
if matches.all? { |m| m.is_a? Regexp } if matches.all? { |m| m.is_a? Regexp }
matches.each { |item| is_expected.to contain_concat__fragment(fragment).with_content(item) } matches.each { |item| is_expected.to contain_concat__fragment(fragment).with_content(item) }
else else
lines = subject.resource('concat::fragment', fragment).send(:parameters)[:content].split("\n") lines = catalogue.resource('concat::fragment', fragment).send(:parameters)[:content].split("\n")
expect(lines & matches).to eq(matches) expect(lines & matches).to eq(matches)
end end
@ -239,7 +239,7 @@ describe 'nginx::resource::location' do
if matches.all? { |m| m.is_a? Regexp } if matches.all? { |m| m.is_a? Regexp }
matches.each { |item| is_expected.to contain_concat__fragment(fragment).with_content(item) } matches.each { |item| is_expected.to contain_concat__fragment(fragment).with_content(item) }
else else
lines = subject.resource('concat::fragment', fragment).send(:parameters)[:content].split("\n") lines = catalogue.resource('concat::fragment', fragment).send(:parameters)[:content].split("\n")
expect(lines & matches).to eq(matches) expect(lines & matches).to eq(matches)
end end
@ -250,7 +250,7 @@ describe 'nginx::resource::location' do
it "should end with a closing brace" do it "should end with a closing brace" do
fragment = Digest::MD5.hexdigest("vhost1-500-#{params[:location]}") fragment = Digest::MD5.hexdigest("vhost1-500-#{params[:location]}")
content = subject.resource('concat::fragment', fragment).send(:parameters)[:content] content = catalogue.resource('concat::fragment', fragment).send(:parameters)[:content]
expect((content.split("\n").reject {|l| l =~ /^(\s*#|$)/ }.last).strip).to eq('}') expect((content.split("\n").reject {|l| l =~ /^(\s*#|$)/ }.last).strip).to eq('}')
end end
end end
@ -342,7 +342,7 @@ describe 'nginx::resource::location' do
if matches.all? { |m| m.is_a? Regexp } if matches.all? { |m| m.is_a? Regexp }
matches.each { |item| is_expected.to contain_concat__fragment(fragment).with_content(item) } matches.each { |item| is_expected.to contain_concat__fragment(fragment).with_content(item) }
else else
lines = subject.resource('concat::fragment', fragment).send(:parameters)[:content].split("\n") lines = catalogue.resource('concat::fragment', fragment).send(:parameters)[:content].split("\n")
expect(lines & matches).to eq(matches) expect(lines & matches).to eq(matches)
end end
@ -403,7 +403,7 @@ describe 'nginx::resource::location' do
if matches.all? { |m| m.is_a? Regexp } if matches.all? { |m| m.is_a? Regexp }
matches.each { |item| is_expected.to contain_concat__fragment(fragment).with_content(item) } matches.each { |item| is_expected.to contain_concat__fragment(fragment).with_content(item) }
else else
lines = subject.resource('concat::fragment', fragment).send(:parameters)[:content].split("\n") lines = catalogue.resource('concat::fragment', fragment).send(:parameters)[:content].split("\n")
expect(lines & matches).to eq(matches) expect(lines & matches).to eq(matches)
end end
@ -467,7 +467,7 @@ describe 'nginx::resource::location' do
if matches.all? { |m| m.is_a? Regexp } if matches.all? { |m| m.is_a? Regexp }
matches.each { |item| is_expected.to contain_concat__fragment(fragment).with_content(item) } matches.each { |item| is_expected.to contain_concat__fragment(fragment).with_content(item) }
else else
lines = subject.resource('concat::fragment', fragment).send(:parameters)[:content].split("\n") lines = catalogue.resource('concat::fragment', fragment).send(:parameters)[:content].split("\n")
expect(lines & matches).to eq(matches) expect(lines & matches).to eq(matches)
end end
@ -603,7 +603,7 @@ describe 'nginx::resource::location' do
if matches.all? { |m| m.is_a? Regexp } if matches.all? { |m| m.is_a? Regexp }
matches.each { |item| is_expected.to contain_concat__fragment(fragment).with_content(item) } matches.each { |item| is_expected.to contain_concat__fragment(fragment).with_content(item) }
else else
lines = subject.resource('concat::fragment', fragment).send(:parameters)[:content].split("\n") lines = catalogue.resource('concat::fragment', fragment).send(:parameters)[:content].split("\n")
expect(lines & matches).to eq(matches) expect(lines & matches).to eq(matches)
end end

View file

@ -139,7 +139,7 @@ describe 'nginx::resource::mailhost' do
it { is_expected.to contain_concat__fragment("#{title}-header") } it { is_expected.to contain_concat__fragment("#{title}-header") }
it param[:title] do it param[:title] do
lines = subject.resource('concat::fragment', "#{title}-header").send(:parameters)[:content].split("\n") lines = catalogue.resource('concat::fragment', "#{title}-header").send(:parameters)[:content].split("\n")
expect(lines & Array(param[:match])).to eq(Array(param[:match])) expect(lines & Array(param[:match])).to eq(Array(param[:match]))
Array(param[:notmatch]).each do |item| Array(param[:notmatch]).each do |item|
is_expected.to contain_concat__fragment("#{title}-header").without_content(item) is_expected.to contain_concat__fragment("#{title}-header").without_content(item)
@ -193,7 +193,7 @@ describe 'nginx::resource::mailhost' do
it { is_expected.to contain_concat__fragment("#{title}-header") } it { is_expected.to contain_concat__fragment("#{title}-header") }
it param[:title] do it param[:title] do
lines = subject.resource('concat::fragment', "#{title}-header").send(:parameters)[:content].split("\n") lines = catalogue.resource('concat::fragment', "#{title}-header").send(:parameters)[:content].split("\n")
expect(lines & Array(param[:match])).to eq(Array(param[:match])) expect(lines & Array(param[:match])).to eq(Array(param[:match]))
Array(param[:notmatch]).each do |item| Array(param[:notmatch]).each do |item|
is_expected.to contain_concat__fragment("#{title}-header").without_content(item) is_expected.to contain_concat__fragment("#{title}-header").without_content(item)
@ -291,7 +291,7 @@ describe 'nginx::resource::mailhost' do
it { is_expected.to contain_concat__fragment("#{title}-ssl") } it { is_expected.to contain_concat__fragment("#{title}-ssl") }
it param[:title] do it param[:title] do
lines = subject.resource('concat::fragment', "#{title}-ssl").send(:parameters)[:content].split("\n") lines = catalogue.resource('concat::fragment', "#{title}-ssl").send(:parameters)[:content].split("\n")
expect(lines & Array(param[:match])).to eq(Array(param[:match])) expect(lines & Array(param[:match])).to eq(Array(param[:match]))
Array(param[:notmatch]).each do |item| Array(param[:notmatch]).each do |item|
is_expected.to contain_concat__fragment("#{title}-ssl").without_content(item) is_expected.to contain_concat__fragment("#{title}-ssl").without_content(item)

View file

@ -72,7 +72,7 @@ describe 'nginx::resource::map' do
it { is_expected.to contain_file("/etc/nginx/conf.d/#{title}-map.conf").with_mode('0644') } it { is_expected.to contain_file("/etc/nginx/conf.d/#{title}-map.conf").with_mode('0644') }
it param[:title] do it param[:title] do
verify_contents(subject, "/etc/nginx/conf.d/#{title}-map.conf", Array(param[:match])) verify_contents(catalogue, "/etc/nginx/conf.d/#{title}-map.conf", Array(param[:match]))
Array(param[:notmatch]).each do |item| Array(param[:notmatch]).each do |item|
is_expected.to contain_file("/etc/nginx/conf.d/#{title}-map.conf").without_content(item) is_expected.to contain_file("/etc/nginx/conf.d/#{title}-map.conf").without_content(item)
end end

View file

@ -99,7 +99,7 @@ describe 'nginx::resource::upstream' do
it { is_expected.to contain_file("/etc/nginx/conf.d/#{title}-upstream.conf").with_mode('0644') } it { is_expected.to contain_file("/etc/nginx/conf.d/#{title}-upstream.conf").with_mode('0644') }
it { is_expected.to contain_concat__fragment("#{title}_upstream_#{param[:fragment]}") } it { is_expected.to contain_concat__fragment("#{title}_upstream_#{param[:fragment]}") }
it param[:title] do it param[:title] do
lines = subject.resource('concat::fragment', "#{title}_upstream_#{param[:fragment]}").send(:parameters)[:content].split("\n") lines = catalogue.resource('concat::fragment', "#{title}_upstream_#{param[:fragment]}").send(:parameters)[:content].split("\n")
expect(lines & Array(param[:match])).to eq(Array(param[:match])) expect(lines & Array(param[:match])).to eq(Array(param[:match]))
Array(param[:notmatch]).each do |item| Array(param[:notmatch]).each do |item|
is_expected.to contain_concat__fragment("#{title}_upstream_#{param[:fragment]}").without_content(item) is_expected.to contain_concat__fragment("#{title}_upstream_#{param[:fragment]}").without_content(item)

View file

@ -253,7 +253,7 @@ describe 'nginx::resource::vhost' do
if matches.all? { |m| m.is_a? Regexp } if matches.all? { |m| m.is_a? Regexp }
matches.each { |item| is_expected.to contain_concat__fragment("#{title}-header").with_content(item) } matches.each { |item| is_expected.to contain_concat__fragment("#{title}-header").with_content(item) }
else else
lines = subject.resource('concat::fragment', "#{title}-header").send(:parameters)[:content].split("\n") lines = catalogue.resource('concat::fragment', "#{title}-header").send(:parameters)[:content].split("\n")
expect(lines & Array(param[:match])).to eq(Array(param[:match])) expect(lines & Array(param[:match])).to eq(Array(param[:match]))
end end
Array(param[:notmatch]).each do |item| Array(param[:notmatch]).each do |item|
@ -317,7 +317,7 @@ describe 'nginx::resource::vhost' do
if matches.all? { |m| m.is_a? Regexp } if matches.all? { |m| m.is_a? Regexp }
matches.each { |item| is_expected.to contain_concat__fragment("#{title}-footer").with_content(item) } matches.each { |item| is_expected.to contain_concat__fragment("#{title}-footer").with_content(item) }
else else
lines = subject.resource('concat::fragment', "#{title}-footer").send(:parameters)[:content].split("\n") lines = catalogue.resource('concat::fragment', "#{title}-footer").send(:parameters)[:content].split("\n")
expect(lines & Array(param[:match])).to eq(Array(param[:match])) expect(lines & Array(param[:match])).to eq(Array(param[:match]))
end end
Array(param[:notmatch]).each do |item| Array(param[:notmatch]).each do |item|
@ -571,7 +571,7 @@ describe 'nginx::resource::vhost' do
if matches.all? { |m| m.is_a? Regexp } if matches.all? { |m| m.is_a? Regexp }
matches.each { |item| is_expected.to contain_concat__fragment("#{title}-ssl-header").with_content(item) } matches.each { |item| is_expected.to contain_concat__fragment("#{title}-ssl-header").with_content(item) }
else else
lines = subject.resource('concat::fragment', "#{title}-ssl-header").send(:parameters)[:content].split("\n") lines = catalogue.resource('concat::fragment', "#{title}-ssl-header").send(:parameters)[:content].split("\n")
expect(lines & Array(param[:match])).to eq(Array(param[:match])) expect(lines & Array(param[:match])).to eq(Array(param[:match]))
end end
Array(param[:notmatch]).each do |item| Array(param[:notmatch]).each do |item|
@ -650,7 +650,7 @@ describe 'nginx::resource::vhost' do
if matches.all? { |m| m.is_a? Regexp } if matches.all? { |m| m.is_a? Regexp }
matches.each { |item| is_expected.to contain_concat__fragment("#{title}-ssl-footer").with_content(item) } matches.each { |item| is_expected.to contain_concat__fragment("#{title}-ssl-footer").with_content(item) }
else else
lines = subject.resource('concat::fragment', "#{title}-ssl-footer").send(:parameters)[:content].split("\n") lines = catalogue.resource('concat::fragment', "#{title}-ssl-footer").send(:parameters)[:content].split("\n")
expect(lines & Array(param[:match])).to eq(Array(param[:match])) expect(lines & Array(param[:match])).to eq(Array(param[:match]))
end end
Array(param[:notmatch]).each do |item| Array(param[:notmatch]).each do |item|