fix rspec deprecation warnings in cucumber setup
This commit is contained in:
parent
c8b0acb231
commit
e796725a15
|
@ -1,15 +1,16 @@
|
|||
Given(/^I have catalog meta\-data$/) do
|
||||
JPM.stub(:repository_path).and_return(
|
||||
File.expand_path(File.dirname(__FILE__) + '/../../spec/fixtures/update-center.json'))
|
||||
allow(JPM).to receive(:repository_path) do
|
||||
File.expand_path(File.dirname(__FILE__) + '/../../spec/fixtures/update-center.json')
|
||||
end
|
||||
end
|
||||
|
||||
Given(/^an update\-center\.json doesn't already exist$/) do
|
||||
# Found in Aruba::Api
|
||||
in_current_dir do
|
||||
cd('.') do
|
||||
|
||||
# Relative path, since our Dir.pwd will be tmp/aruba already
|
||||
repo = './update-center.json'
|
||||
JPM.stub(:repository_path).and_return(repo)
|
||||
allow(JPM).to receive(:repository_path) { repo }
|
||||
|
||||
# If the thing exists already, nuke it!
|
||||
if File.exists? repo
|
||||
|
@ -20,11 +21,11 @@ end
|
|||
|
||||
Given(/^an update\-center\.json already exists$/) do
|
||||
# Found in Aruba::Api
|
||||
in_current_dir do
|
||||
cd('.') do
|
||||
|
||||
# Relative path, since our Dir.pwd will be tmp/aruba already
|
||||
repo = './update-center.json'
|
||||
JPM.stub(:repository_path).and_return(repo)
|
||||
allow(JPM).to receive(:repository_path) { repo }
|
||||
File.open(repo, 'w+') do |fd|
|
||||
fd.write("\n{}\n")
|
||||
end
|
||||
|
@ -34,7 +35,7 @@ end
|
|||
Given(/^I have a site with a custom update\-center\.json$/) do
|
||||
# Relative path, since our Dir.pwd will be tmp/aruba already
|
||||
repo = './update-center.json'
|
||||
JPM.stub(:repository_path).and_return(repo)
|
||||
allow(JPM).to receive(:repository_path) { repo }
|
||||
|
||||
# If the thing exists already, nuke it!
|
||||
if File.exists? repo
|
||||
|
@ -43,6 +44,6 @@ Given(/^I have a site with a custom update\-center\.json$/) do
|
|||
|
||||
response = double('Mock HTTPResponse', :body => '')
|
||||
|
||||
JPM.should_receive(:fetch).with('http://aruba.bdd/update-center.json').and_return(response)
|
||||
expect(JPM).to receive(:fetch).with('http://aruba.bdd/update-center.json') { response }
|
||||
end
|
||||
|
||||
|
|
|
@ -1,25 +1,27 @@
|
|||
Given(/^Jenkins isn't installed$/) do
|
||||
JPM.stub(:installed? => false)
|
||||
allow(JPM).to receive(:installed?) { false }
|
||||
end
|
||||
|
||||
Given(/^Jenkins is installed$/) do
|
||||
JPM.stub(:installed? => true)
|
||||
allow(JPM).to receive(:installed?) { false }
|
||||
end
|
||||
|
||||
Given(/^there are no plugins available$/) do
|
||||
JPM.stub(:plugins => [])
|
||||
allow(JPM).to receive(:plugins) { [] }
|
||||
end
|
||||
|
||||
Given(/^there are plugins available$/) do
|
||||
JPM.stub(:has_plugins? => true)
|
||||
JPM.stub(:plugins => [
|
||||
{
|
||||
:name => 'greenballs',
|
||||
:version => '1.0'
|
||||
},
|
||||
{
|
||||
:name => 'ant',
|
||||
:version => '1.1'
|
||||
},
|
||||
])
|
||||
allow(JPM).to receive(:has_plugins?) { true }
|
||||
allow(JPM).to receive(:plugins) do
|
||||
[
|
||||
{
|
||||
:name => 'greenballs',
|
||||
:version => '1.0'
|
||||
},
|
||||
{
|
||||
:name => 'ant',
|
||||
:version => '1.1'
|
||||
},
|
||||
]
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
|
||||
Before '@install-success' do
|
||||
JPM::Catalog.any_instance.stub(:download).and_return(true)
|
||||
expect(JPM::Catalog).to receive(:download) { true }
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue