dpl 1.6.1.travis.447.1 → 1.6.1.travis.449.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -10,13 +10,13 @@ describe DPL::Provider::Deis do
10
10
  :password => 'secret')
11
11
  end
12
12
 
13
- describe :needs_key? do
13
+ describe "#needs_key?" do
14
14
  example do
15
15
  expect(provider.needs_key?).to eq(true)
16
16
  end
17
17
  end
18
18
 
19
- describe :check_auth do
19
+ describe "#check_auth" do
20
20
  example do
21
21
  expect(provider.context).to receive(:shell).with(
22
22
  'deis login http://deis.deisapps.com --username=travis --password=secret'
@@ -25,7 +25,7 @@ describe DPL::Provider::Deis do
25
25
  end
26
26
  end
27
27
 
28
- describe :check_app do
28
+ describe "#check_app" do
29
29
  example do
30
30
  expect(provider.context).to receive(:shell).with(
31
31
  'deis apps:info --app=example'
@@ -34,7 +34,7 @@ describe DPL::Provider::Deis do
34
34
  end
35
35
  end
36
36
 
37
- describe :setup_key do
37
+ describe "#setup_key" do
38
38
  let(:ssh_config_handle) { double 'ssh_config_handle' }
39
39
  let(:ssh_config) { File.join(Dir.home, '.ssh', 'config') }
40
40
  let(:identity_file) { File.join(Dir.pwd, 'key_file') }
@@ -46,7 +46,7 @@ describe DPL::Provider::Deis do
46
46
  end
47
47
  end
48
48
 
49
- describe :setup_git_ssh do
49
+ describe "#setup_git_ssh" do
50
50
  let(:ssh_config_handle) { double 'ssh_config_handle' }
51
51
  let(:ssh_config) { File.join(Dir.home, '.ssh', 'config') }
52
52
  let(:identity_file) { File.join(Dir.pwd, 'key_file') }
@@ -69,7 +69,7 @@ describe DPL::Provider::Deis do
69
69
  end
70
70
  end
71
71
 
72
- describe :remove_key do
72
+ describe "#remove_key" do
73
73
  example do
74
74
  expect(provider.context).to receive(:shell).with(
75
75
  'deis keys:remove key'
@@ -78,7 +78,7 @@ describe DPL::Provider::Deis do
78
78
  end
79
79
  end
80
80
 
81
- describe :push_app do
81
+ describe "#push_app" do
82
82
  example do
83
83
  expect(provider.context).to receive(:shell).with(
84
84
  'git push deis-repo:example.git HEAD:refs/heads/master -f'
@@ -87,7 +87,7 @@ describe DPL::Provider::Deis do
87
87
  end
88
88
  end
89
89
 
90
- describe :run do
90
+ describe "#run" do
91
91
  example do
92
92
  expect(provider.context).to receive(:shell).with(
93
93
  'deis apps:run shell command'
@@ -6,22 +6,22 @@ describe DPL::Provider::Divshot do
6
6
  described_class.new DummyContext.new, :api_key => 'abc123'
7
7
  end
8
8
 
9
- describe :check_auth do
9
+ describe "#check_auth" do
10
10
  it 'should require an api key' do
11
11
  provider.options.update(:api_key => nil)
12
12
  expect{ provider.check_auth }.to raise_error("must supply an api key")
13
13
  end
14
14
  end
15
15
 
16
- describe :push_app do
16
+ describe "#push_app" do
17
17
  it 'should include the environment specified' do
18
18
  provider.options.update(:environment => 'development')
19
- provider.context.should_receive(:shell).with("divshot push development --token abc123")
19
+ expect(provider.context).to receive(:shell).with("divshot push development --token abc123")
20
20
  provider.push_app
21
21
  end
22
22
 
23
23
  it 'should default to production' do
24
- provider.context.should_receive(:shell).with("divshot push production --token abc123")
24
+ expect(provider.context).to receive(:shell).with("divshot push production --token abc123")
25
25
  provider.push_app
26
26
  end
27
27
  end
@@ -6,36 +6,36 @@ describe DPL::Provider::DotCloud do
6
6
  described_class.new(DummyContext.new, :app => 'example', :api_key => 'foo')
7
7
  end
8
8
 
9
- describe :check_auth do
9
+ describe "#check_auth" do
10
10
  example do
11
- provider.context.should_receive(:shell).with("echo foo | dotcloud setup --api-key")
11
+ expect(provider.context).to receive(:shell).with("echo foo | dotcloud setup --api-key")
12
12
  provider.check_auth
13
13
  end
14
14
  end
15
15
 
16
- describe :check_app do
16
+ describe "#check_app" do
17
17
  example do
18
- provider.context.should_receive(:shell).with("dotcloud connect example")
18
+ expect(provider.context).to receive(:shell).with("dotcloud connect example")
19
19
  provider.check_app
20
20
  end
21
21
  end
22
22
 
23
- describe :needs_key? do
23
+ describe "#needs_key?" do
24
24
  example do
25
- provider.needs_key?.should == false
25
+ expect(provider.needs_key?).to eq(false)
26
26
  end
27
27
  end
28
28
 
29
- describe :push_app do
29
+ describe "#push_app" do
30
30
  example do
31
- provider.context.should_receive(:shell).with("dotcloud push example")
31
+ expect(provider.context).to receive(:shell).with("dotcloud push example")
32
32
  provider.push_app
33
33
  end
34
34
  end
35
35
 
36
- describe :run do
36
+ describe "#run" do
37
37
  example do
38
- provider.context.should_receive(:shell).with("dotcloud -A example www test")
38
+ expect(provider.context).to receive(:shell).with("dotcloud -A example www test")
39
39
  provider.run("test")
40
40
  end
41
41
  end
@@ -6,7 +6,7 @@ describe DPL::Provider::Hackage do
6
6
  described_class.new(DummyContext.new, :username => 'FooUser', :password => 'bar')
7
7
  end
8
8
 
9
- describe :check_auth do
9
+ describe "#check_auth" do
10
10
  it 'should require username' do
11
11
  provider.options.update(:username => nil)
12
12
  expect {
@@ -22,25 +22,25 @@ describe DPL::Provider::Hackage do
22
22
  end
23
23
  end
24
24
 
25
- describe :check_app do
25
+ describe "#check_app" do
26
26
  it 'calls cabal' do
27
- provider.context.should_receive(:shell).with("cabal check").and_return(true)
27
+ expect(provider.context).to receive(:shell).with("cabal check").and_return(true)
28
28
  provider.check_app
29
29
  end
30
30
 
31
31
  it 'fails when cabal complains' do
32
- provider.context.should_receive(:shell).with("cabal check").and_return(false)
32
+ expect(provider.context).to receive(:shell).with("cabal check").and_return(false)
33
33
  expect {
34
34
  provider.check_app
35
35
  }.to raise_error(DPL::Error)
36
36
  end
37
37
  end
38
38
 
39
- describe :push_app do
39
+ describe "#push_app" do
40
40
  example do
41
- provider.context.should_receive(:shell).with("cabal sdist").and_return(true)
42
- Dir.should_receive(:glob).and_yield('dist/package-0.1.2.3.tar.gz')
43
- provider.context.should_receive(:shell).with("cabal upload --username=FooUser --password=bar dist/package-0.1.2.3.tar.gz")
41
+ expect(provider.context).to receive(:shell).with("cabal sdist").and_return(true)
42
+ expect(Dir).to receive(:glob).and_yield('dist/package-0.1.2.3.tar.gz')
43
+ expect(provider.context).to receive(:shell).with("cabal upload --username=FooUser --password=bar dist/package-0.1.2.3.tar.gz")
44
44
  provider.push_app
45
45
  end
46
46
  end
@@ -9,15 +9,15 @@ describe DPL::Provider::Heroku do
9
9
  described_class.new(DummyContext.new, :app => 'example', :api_key => 'foo', :strategy => 'anvil', :buildpack => 'git://some-buildpack.git')
10
10
  end
11
11
 
12
- describe :api do
12
+ describe "#api" do
13
13
  it 'accepts an api key' do
14
14
  api = double(:api)
15
- lambda { provider.api }.should_not raise_error
15
+ expect { provider.api }.not_to raise_error
16
16
  end
17
17
 
18
18
  it 'raises an error if an api key is not present' do
19
19
  provider.options.delete :api_key
20
- lambda { provider.api }.should raise_error(DPL::Error)
20
+ expect { provider.api }.to raise_error(DPL::Error)
21
21
  end
22
22
  end
23
23
 
@@ -29,49 +29,49 @@ describe DPL::Provider::Heroku do
29
29
  end
30
30
 
31
31
  before do
32
- ::Heroku::API.should_receive(:new).and_return(api)
32
+ expect(::Heroku::API).to receive(:new).and_return(api)
33
33
  provider.api
34
34
  end
35
35
 
36
- describe :push_app do
36
+ describe "#push_app" do
37
37
  example do
38
38
  response = double :response
39
- response.stub(:status => 202)
40
- response.stub(:headers => {'Location' => '/blah'})
39
+ allow(response).to receive_messages(:status => 202)
40
+ allow(response).to receive_messages(:headers => {'Location' => '/blah'})
41
41
 
42
42
  second_response = double :second_response
43
- second_response.stub(:status => 200)
43
+ allow(second_response).to receive_messages(:status => 200)
44
44
 
45
- provider.stub(:slug_url => "http://slug-url")
45
+ allow(provider).to receive_messages(:slug_url => "http://slug-url")
46
46
 
47
- ENV.should_receive(:[]).with('TRAVIS_COMMIT').and_return('123')
48
- ::Excon.should_receive(:post).with(provider.release_url,
47
+ expect(ENV).to receive(:[]).with('TRAVIS_COMMIT').and_return('123')
48
+ expect(::Excon).to receive(:post).with(provider.release_url,
49
49
  :body => {"slug_url" => "http://slug-url", "description" => "Deploy 123 via Travis CI" }.to_json,
50
50
  :headers => {"Content-Type" => 'application/json', 'Accept' => 'application/json'}).and_return(response)
51
51
 
52
- ::Excon.should_receive(:get).with("https://:#{provider.options[:api_key]}@cisaurus.heroku.com/blah").and_return(second_response)
52
+ expect(::Excon).to receive(:get).with("https://:#{provider.options[:api_key]}@cisaurus.heroku.com/blah").and_return(second_response)
53
53
  provider.push_app
54
54
  end
55
55
  end
56
56
 
57
- describe :slug_url do
57
+ describe "#slug_url" do
58
58
 
59
59
  before(:each) do
60
60
  headers = double(:headers)
61
- ::Anvil.should_receive(:headers).at_least(:twice).and_return(headers)
62
- headers.should_receive(:[]=).at_least(:once).with('X-Heroku-User', "foo@bar.com")
63
- headers.should_receive(:[]=).at_least(:once).with('X-Heroku-App', "example")
61
+ expect(::Anvil).to receive(:headers).at_least(:twice).and_return(headers)
62
+ expect(headers).to receive(:[]=).at_least(:once).with('X-Heroku-User', "foo@bar.com")
63
+ expect(headers).to receive(:[]=).at_least(:once).with('X-Heroku-App', "example")
64
64
  end
65
65
 
66
66
  example "with full buildpack url" do
67
- ::Anvil::Engine.should_receive(:build).with(".", :buildpack=>"git://some-buildpack.git")
67
+ expect(::Anvil::Engine).to receive(:build).with(".", :buildpack=>"git://some-buildpack.git")
68
68
  provider.slug_url
69
69
  end
70
70
 
71
71
  example "with buildpack name expansion" do
72
72
  DPL::Provider::Heroku::Anvil::HEROKU_BUILDPACKS.each do |b|
73
73
  provider.options.update(:buildpack => b)
74
- ::Anvil::Engine.should_receive(:build).with(".", :buildpack=>described_class::Anvil::HEROKU_BUILDPACK_PREFIX + b + ".git")
74
+ expect(::Anvil::Engine).to receive(:build).with(".", :buildpack=>described_class::Anvil::HEROKU_BUILDPACK_PREFIX + b + ".git")
75
75
  provider.slug_url
76
76
  end
77
77
  end
@@ -7,9 +7,9 @@ describe DPL::Provider::Heroku do
7
7
  described_class.new(DummyContext.new, :app => 'example', :key_name => 'key', :api_key => "foo", :strategy => "gitdeploykey")
8
8
  end
9
9
 
10
- describe :ssh do
10
+ describe "#ssh" do
11
11
  it "doesn't require an ssh key" do
12
- provider.needs_key?.should == false
12
+ expect(provider.needs_key?).to eq(false)
13
13
  end
14
14
  end
15
15
  end
@@ -7,18 +7,18 @@ describe DPL::Provider::Heroku do
7
7
  described_class.new(DummyContext.new, :app => 'example', :key_name => 'key', :api_key => "foo", :strategy => "git")
8
8
  end
9
9
 
10
- describe :api do
10
+ describe "#api" do
11
11
  it 'accepts an api key' do
12
12
  api = double(:api)
13
- ::Heroku::API.should_receive(:new).with(:api_key => "foo").and_return(api)
14
- provider.api.should be == api
13
+ expect(::Heroku::API).to receive(:new).with(:api_key => "foo").and_return(api)
14
+ expect(provider.api).to eq(api)
15
15
  end
16
16
 
17
17
  it 'accepts a user and a password' do
18
18
  api = double(:api)
19
19
  provider.options.update(:user => "foo", :password => "bar")
20
- ::Heroku::API.should_receive(:new).with(:user => "foo", :password => "bar").and_return(api)
21
- provider.api.should be == api
20
+ expect(::Heroku::API).to receive(:new).with(:user => "foo", :password => "bar").and_return(api)
21
+ expect(provider.api).to eq(api)
22
22
  end
23
23
  end
24
24
 
@@ -30,74 +30,74 @@ describe DPL::Provider::Heroku do
30
30
  end
31
31
 
32
32
  before do
33
- ::Heroku::API.should_receive(:new).and_return(api)
33
+ expect(::Heroku::API).to receive(:new).and_return(api)
34
34
  provider.api
35
35
  end
36
36
 
37
37
  its(:api) { should be == api }
38
38
 
39
- describe :check_auth do
39
+ describe "#check_auth" do
40
40
  example do
41
- provider.should_receive(:log).with("authenticated as foo@bar.com")
41
+ expect(provider).to receive(:log).with("authenticated as foo@bar.com")
42
42
  provider.check_auth
43
43
  end
44
44
  end
45
45
 
46
- describe :check_app do
46
+ describe "#check_app" do
47
47
  example do
48
- provider.should_receive(:log).at_least(1).times.with(/example/)
48
+ expect(provider).to receive(:log).at_least(1).times.with(/example/)
49
49
  provider.check_app
50
- provider.options[:git].should be == "GIT URL"
50
+ expect(provider.options[:git]).to eq("GIT URL")
51
51
  end
52
52
  end
53
53
 
54
- describe :setup_key do
54
+ describe "#setup_key" do
55
55
  example do
56
- File.should_receive(:read).with("the file").and_return("foo")
57
- api.should_receive(:post_key).with("foo")
56
+ expect(File).to receive(:read).with("the file").and_return("foo")
57
+ expect(api).to receive(:post_key).with("foo")
58
58
  provider.setup_key("the file")
59
59
  end
60
60
  end
61
61
 
62
- describe :remove_key do
62
+ describe "#remove_key" do
63
63
  example do
64
- api.should_receive(:delete_key).with("key")
64
+ expect(api).to receive(:delete_key).with("key")
65
65
  provider.remove_key
66
66
  end
67
67
  end
68
68
 
69
- describe :push_app do
69
+ describe "#push_app" do
70
70
  example do
71
71
  provider.options[:git] = "git://something"
72
- provider.context.should_receive(:shell).with("git push git://something HEAD:refs/heads/master -f")
72
+ expect(provider.context).to receive(:shell).with("git push git://something HEAD:refs/heads/master -f")
73
73
  provider.push_app
74
74
  end
75
75
  end
76
76
 
77
- describe :run do
77
+ describe "#run" do
78
78
  example do
79
79
  data = double("data", :body => { "rendezvous_url" => "rendezvous url" })
80
- api.should_receive(:post_ps).with("example", "that command", :attach => true).and_return(data)
81
- Rendezvous.should_receive(:start).with(:url => "rendezvous url")
80
+ expect(api).to receive(:post_ps).with("example", "that command", :attach => true).and_return(data)
81
+ expect(Rendezvous).to receive(:start).with(:url => "rendezvous url")
82
82
  provider.run("that command")
83
83
  end
84
84
  end
85
85
 
86
- describe :restart do
86
+ describe "#restart" do
87
87
  example do
88
- api.should_receive(:post_ps_restart).with("example")
88
+ expect(api).to receive(:post_ps_restart).with("example")
89
89
  provider.restart
90
90
  end
91
91
  end
92
92
 
93
- describe :deploy do
93
+ describe "#deploy" do
94
94
  example "not found error" do
95
- provider.should_receive(:api) { raise ::Heroku::API::Errors::NotFound.new("the message", nil) }.at_least(:once)
95
+ expect(provider).to receive(:api) { raise ::Heroku::API::Errors::NotFound.new("the message", nil) }.at_least(:once)
96
96
  expect { provider.deploy }.to raise_error(DPL::Error, 'the message (wrong app "example"?)')
97
97
  end
98
98
 
99
99
  example "unauthorized error" do
100
- provider.should_receive(:api) { raise ::Heroku::API::Errors::Unauthorized.new("the message", nil) }.at_least(:once)
100
+ expect(provider).to receive(:api) { raise ::Heroku::API::Errors::Unauthorized.new("the message", nil) }.at_least(:once)
101
101
  expect { provider.deploy }.to raise_error(DPL::Error, 'the message (wrong API key?)')
102
102
  end
103
103
  end
@@ -6,23 +6,23 @@ describe DPL::Provider::Modulus do
6
6
  described_class.new(DummyContext.new, :api_key => 'test-token', :project_name => 'test-project')
7
7
  end
8
8
 
9
- describe :check_auth do
9
+ describe "#check_auth" do
10
10
  it 'should require an api key' do
11
11
  provider.options.update(:api_key => nil)
12
12
  expect{ provider.check_auth }.to raise_error("must supply an api key")
13
13
  end
14
14
  end
15
15
 
16
- describe :check_app do
16
+ describe "#check_app" do
17
17
  it 'should require a project name' do
18
18
  provider.options.update(:project_name => nil)
19
19
  expect{ provider.check_app }.to raise_error("must supply a project name")
20
20
  end
21
21
  end
22
22
 
23
- describe :push_app do
23
+ describe "#push_app" do
24
24
  it 'should include the api key and project name specified' do
25
- provider.context.should_receive(:shell).with("MODULUS_TOKEN=test-token modulus deploy -p test-project")
25
+ expect(provider.context).to receive(:shell).with("MODULUS_TOKEN=test-token modulus deploy -p test-project")
26
26
  provider.push_app
27
27
  end
28
28
  end
@@ -6,27 +6,27 @@ describe DPL::Provider::Ninefold do
6
6
  described_class.new(DummyContext.new, :auth_token => "123456789", :app_id => "1234")
7
7
  end
8
8
 
9
- describe :check_auth do
9
+ describe "#check_auth" do
10
10
  it 'requires an auth token' do
11
11
  provider.options.update(:auth_token => nil)
12
12
  expect{ provider.check_auth }.to raise_error "must supply an auth token"
13
13
  end
14
14
  end
15
15
 
16
- describe :check_app do
16
+ describe "#check_app" do
17
17
  it 'requires an app ID' do
18
18
  provider.options.update(:app_id => nil)
19
19
  expect{ provider.check_app }.to raise_error "must supply an app ID"
20
20
  end
21
21
  end
22
22
 
23
- describe :needs_key? do
23
+ describe "#needs_key?" do
24
24
  it 'returns false' do
25
- expect(provider.needs_key?).to be_false
25
+ expect(provider.needs_key?).to be_falsey
26
26
  end
27
27
  end
28
28
 
29
- describe :push_app do
29
+ describe "#push_app" do
30
30
  it 'includes the auth token and app ID specified' do
31
31
  expect(provider.context).to receive(:shell).with("AUTH_TOKEN=123456789 APP_ID=1234 ninefold app redeploy --sure")
32
32
  provider.push_app