Skip to content

Commit

Permalink
Merge pull request voxpupuli#587 from 3flex/rspec-puppet-2
Browse files Browse the repository at this point in the history
Rspec puppet 2
  • Loading branch information
jfryman committed Apr 2, 2015
2 parents 89a4c9b + 995637c commit e5cd3a9
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 22 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ matrix:
- rvm: 2.1.0
env: PUPPET_GEM_VERSION="~> 3.0"
- rvm: 2.1.0
env: PUPPET_GEM_VERSION="~> 3.5.0" FUTURE_PARSER="yes"
env: PUPPET_GEM_VERSION="~> 3.0" FUTURE_PARSER="yes"
allow_failures:
- rvm: 1.8.7
env: PUPPET_GEM_VERSION="~> 2.7.0"
- rvm: 1.8.7
env: PUPPET_GEM_VERSION="~> 3.0"
- rvm: 2.1.0
env: PUPPET_GEM_VERSION="~> 3.5.0" FUTURE_PARSER="yes"
env: PUPPET_GEM_VERSION="~> 3.0" FUTURE_PARSER="yes"
notifications:
email: false
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ group :rake, :test do
end

group :rake do
gem 'rspec-puppet', '~>1.0'
gem 'rspec-puppet', '>=2', :require => false
gem 'rake', '>=0.9.2.2'
gem 'puppet-lint', '>=1.0.1'
gem 'rspec-system-serverspec', :require => false
Expand Down
4 changes: 2 additions & 2 deletions spec/classes/config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@
if matches.all? { |m| m.is_a? Regexp }
matches.each { |item| is_expected.to contain_file('/etc/nginx/nginx.conf').with_content(item) }
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]))
end

Expand Down Expand Up @@ -298,7 +298,7 @@
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) }
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]))
end

Expand Down
2 changes: 1 addition & 1 deletion spec/defines/resource_geo_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@

it { is_expected.to contain_file("/etc/nginx/conf.d/#{title}-geo.conf").with_mode('0644') }
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|
is_expected.to contain_file("/etc/nginx/conf.d/#{title}-geo.conf").without_content(item)
end
Expand Down
14 changes: 7 additions & 7 deletions spec/defines/resource_location_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@
if matches.all? { |m| m.is_a? Regexp }
matches.each { |item| is_expected.to contain_concat__fragment(fragment).with_content(item) }
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)
end

Expand Down Expand Up @@ -239,7 +239,7 @@
if matches.all? { |m| m.is_a? Regexp }
matches.each { |item| is_expected.to contain_concat__fragment(fragment).with_content(item) }
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)
end

Expand All @@ -250,7 +250,7 @@

it "should end with a closing brace" do
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('}')
end
end
Expand Down Expand Up @@ -342,7 +342,7 @@
if matches.all? { |m| m.is_a? Regexp }
matches.each { |item| is_expected.to contain_concat__fragment(fragment).with_content(item) }
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)
end

Expand Down Expand Up @@ -403,7 +403,7 @@
if matches.all? { |m| m.is_a? Regexp }
matches.each { |item| is_expected.to contain_concat__fragment(fragment).with_content(item) }
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)
end

Expand Down Expand Up @@ -467,7 +467,7 @@
if matches.all? { |m| m.is_a? Regexp }
matches.each { |item| is_expected.to contain_concat__fragment(fragment).with_content(item) }
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)
end

Expand Down Expand Up @@ -603,7 +603,7 @@
if matches.all? { |m| m.is_a? Regexp }
matches.each { |item| is_expected.to contain_concat__fragment(fragment).with_content(item) }
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)
end

Expand Down
6 changes: 3 additions & 3 deletions spec/defines/resource_mailhost_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@

it { is_expected.to contain_concat__fragment("#{title}-header") }
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]))
Array(param[:notmatch]).each do |item|
is_expected.to contain_concat__fragment("#{title}-header").without_content(item)
Expand Down Expand Up @@ -193,7 +193,7 @@

it { is_expected.to contain_concat__fragment("#{title}-header") }
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]))
Array(param[:notmatch]).each do |item|
is_expected.to contain_concat__fragment("#{title}-header").without_content(item)
Expand Down Expand Up @@ -291,7 +291,7 @@

it { is_expected.to contain_concat__fragment("#{title}-ssl") }
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]))
Array(param[:notmatch]).each do |item|
is_expected.to contain_concat__fragment("#{title}-ssl").without_content(item)
Expand Down
2 changes: 1 addition & 1 deletion spec/defines/resource_map_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@

it { is_expected.to contain_file("/etc/nginx/conf.d/#{title}-map.conf").with_mode('0644') }
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|
is_expected.to contain_file("/etc/nginx/conf.d/#{title}-map.conf").without_content(item)
end
Expand Down
2 changes: 1 addition & 1 deletion spec/defines/resource_upstream_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
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 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]))
Array(param[:notmatch]).each do |item|
is_expected.to contain_concat__fragment("#{title}_upstream_#{param[:fragment]}").without_content(item)
Expand Down
8 changes: 4 additions & 4 deletions spec/defines/resource_vhost_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@
if matches.all? { |m| m.is_a? Regexp }
matches.each { |item| is_expected.to contain_concat__fragment("#{title}-header").with_content(item) }
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]))
end
Array(param[:notmatch]).each do |item|
Expand Down Expand Up @@ -317,7 +317,7 @@
if matches.all? { |m| m.is_a? Regexp }
matches.each { |item| is_expected.to contain_concat__fragment("#{title}-footer").with_content(item) }
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]))
end
Array(param[:notmatch]).each do |item|
Expand Down Expand Up @@ -571,7 +571,7 @@
if matches.all? { |m| m.is_a? Regexp }
matches.each { |item| is_expected.to contain_concat__fragment("#{title}-ssl-header").with_content(item) }
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]))
end
Array(param[:notmatch]).each do |item|
Expand Down Expand Up @@ -650,7 +650,7 @@
if matches.all? { |m| m.is_a? Regexp }
matches.each { |item| is_expected.to contain_concat__fragment("#{title}-ssl-footer").with_content(item) }
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]))
end
Array(param[:notmatch]).each do |item|
Expand Down

0 comments on commit e5cd3a9

Please sign in to comment.