From 9dd92e7081abc1a2adec8118909e98d64b86655e Mon Sep 17 00:00:00 2001 From: Matthew Haughton Date: Mon, 6 Apr 2015 19:43:50 -0400 Subject: [PATCH] Convert acceptance specs to RSpec 3.2.2 syntax This conversion is done by Transpec 3.1.0 with the following command: transpec spec/acceptance/ * 16 conversions from: it { should ... } to: it { is_expected.to ... } * 6 conversions from: obj.should to: expect(obj).to * 5 conversions from: == expected to: eq(expected) * 1 conversion from: it { should_not ... } to: it { is_expected.not_to ... } For more details: https://github.com/yujinakayama/transpec#supported-conversions --- spec/acceptance/nginx_mail_spec.rb | 4 ++-- spec/acceptance/nginx_proxy_spec.rb | 14 +++++++------- spec/acceptance/nginx_vhost_spec.rb | 28 ++++++++++++++-------------- 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/spec/acceptance/nginx_mail_spec.rb b/spec/acceptance/nginx_mail_spec.rb index 0094a10..fb3c37a 100644 --- a/spec/acceptance/nginx_mail_spec.rb +++ b/spec/acceptance/nginx_mail_spec.rb @@ -21,8 +21,8 @@ describe "nginx::resource::mailhost define:" do end describe file('/etc/nginx/conf.mail.d/domain1.example.conf') do - it { should be_file } - it { should contain "auth_http localhost/cgi-bin/auth;" } + it { is_expected.to be_file } + it { is_expected.to contain "auth_http localhost/cgi-bin/auth;" } end end diff --git a/spec/acceptance/nginx_proxy_spec.rb b/spec/acceptance/nginx_proxy_spec.rb index 9460bea..27cd906 100644 --- a/spec/acceptance/nginx_proxy_spec.rb +++ b/spec/acceptance/nginx_proxy_spec.rb @@ -23,16 +23,16 @@ describe "nginx::resource::upstream define:" do end describe file('/etc/nginx/conf.d/puppet_rack_app-upstream.conf') do - it { should be_file } - it { should contain "server localhost:3000" } - it { should contain "server localhost:3001" } - it { should contain "server localhost:3002" } - it { should_not contain "server localhost:3003" } + it { is_expected.to be_file } + it { is_expected.to contain "server localhost:3000" } + it { is_expected.to contain "server localhost:3001" } + it { is_expected.to contain "server localhost:3002" } + it { is_expected.not_to contain "server localhost:3003" } end describe file('/etc/nginx/sites-available/rack.puppetlabs.com.conf') do - it { should be_file } - it { should contain "proxy_pass http://puppet_rack_app;" } + it { is_expected.to be_file } + it { is_expected.to contain "proxy_pass http://puppet_rack_app;" } end end diff --git a/spec/acceptance/nginx_vhost_spec.rb b/spec/acceptance/nginx_vhost_spec.rb index bb58089..8224372 100644 --- a/spec/acceptance/nginx_vhost_spec.rb +++ b/spec/acceptance/nginx_vhost_spec.rb @@ -19,22 +19,22 @@ describe "nginx::resource::vhost define:" do end describe file('/etc/nginx/sites-available/www.puppetlabs.com.conf') do - it { should be_file } - it { should contain "www.puppetlabs.com" } + it { is_expected.to be_file } + it { is_expected.to contain "www.puppetlabs.com" } end describe file('/etc/nginx/sites-enabled/www.puppetlabs.com.conf') do - it { should be_linked_to '/etc/nginx/sites-available/www.puppetlabs.com.conf' } + it { is_expected.to be_linked_to '/etc/nginx/sites-available/www.puppetlabs.com.conf' } end describe service('nginx') do - it { should be_running } + it { is_expected.to be_running } end it 'should answer to www.puppetlabs.com' do shell("/usr/bin/curl http://www.puppetlabs.com:80") do |r| - r.stdout.should == "Hello from www\n" - r.exit_code.should be_zero + expect(r.stdout).to eq("Hello from www\n") + expect(r.exit_code).to be_zero end end end @@ -60,30 +60,30 @@ describe "nginx::resource::vhost define:" do end describe file('/etc/nginx/sites-available/www.puppetlabs.com.conf') do - it { should be_file } - it { should contain "ssl on;" } + it { is_expected.to be_file } + it { is_expected.to contain "ssl on;" } end describe file('/etc/nginx/sites-enabled/www.puppetlabs.com.conf') do - it { should be_linked_to '/etc/nginx/sites-available/www.puppetlabs.com.conf' } + it { is_expected.to be_linked_to '/etc/nginx/sites-available/www.puppetlabs.com.conf' } end describe service('nginx') do - it { should be_running } + it { is_expected.to be_running } end it 'should answer to http://www.puppetlabs.com' do shell("/usr/bin/curl http://www.puppetlabs.com:80") do |r| - r.stdout.should == "Hello from www\n" - r.exit_code.should == 0 + expect(r.stdout).to eq("Hello from www\n") + expect(r.exit_code).to eq(0) end end it 'should answer to https://www.puppetlabs.com' do # use --insecure because it's a self-signed cert shell("/usr/bin/curl --insecure https://www.puppetlabs.com:443") do |r| - r.stdout.should == "Hello from www\n" - r.exit_code.should == 0 + expect(r.stdout).to eq("Hello from www\n") + expect(r.exit_code).to eq(0) end end end