rumm 0.0.14 → 0.0.15

Sign up to get free protection for your applications and to get access to all the features.
data/lib/rumm/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Rumm
2
- VERSION = "0.0.14"
2
+ VERSION = "0.0.15"
3
3
  end
@@ -1,7 +1,8 @@
1
1
  require "spec_helper"
2
+ require "netrc"
2
3
 
3
4
  describe "logging in" do
4
- before do
5
+ Given do
5
6
  #@announce_dir = true
6
7
  #@announce_cmd = true
7
8
  #@announce_env = true
@@ -9,8 +10,8 @@ describe "logging in" do
9
10
  #@announce_stderr = true
10
11
  @home = Pathname(set_env "HOME", File.expand_path(current_dir))
11
12
  end
12
- describe "interactively with valid credentials" do
13
- before do
13
+ context "interactively with valid credentials" do
14
+ When do
14
15
  VCR.use_cassette('successful-login') do
15
16
  will_type ENV['RACKSPACE_USERNAME'] || "<username>"
16
17
  will_type ENV['RACKSPACE_PASSWORD'] || "<valid-password>"
@@ -18,11 +19,39 @@ describe "logging in" do
18
19
  stop_process @interactive
19
20
  end
20
21
  end
21
- it "successfully exits" do
22
- last_exit_status.should eq(0), "process failed"
22
+ Then {last_exit_status == 0}
23
+
24
+ context "places your login credentials in your .netrc" do
25
+ Then do
26
+ n = Netrc.read
27
+ user, pass = n["api.rackspace.com"]
28
+ user != nil and pass != nil
29
+ end
23
30
  end
24
- it "places your login credentials in your .netrc" do
31
+ end
32
+
33
+ context "logging out" do
34
+ When {VCR.use_cassette('successful-logout') {run "rumm logout"}}
35
+ Then {last_exit_status == 0}
25
36
 
37
+ context "removes your login credentials from .netrc" do
38
+ Then do
39
+ n = Netrc.read
40
+ user, pass = n["api.rackspace.com"]
41
+ user == nil and pass == nil
42
+ end
43
+ end
44
+ context "interactively with invalid credentials" do
45
+ When do
46
+ VCR.use_cassette("unsuccessful-login") do
47
+ will_type "nil"
48
+ will_type "nil"
49
+ run_interactive "rum login"
50
+ stop_process @interactive
51
+ end
52
+ end
53
+ Then {last_exit_status != 0}
54
+ And {all_stderr =~ /User could not be authenticated/}
26
55
  end
27
56
  end
28
57
  end
@@ -0,0 +1,37 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://identity.api.rackspacecloud.com/v2.0/tokens
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"auth":{"passwordCredentials":{"username":"nil","password":"nil"}}}'
9
+ headers:
10
+ Content-Type:
11
+ - application/json
12
+ response:
13
+ status:
14
+ code: 401
15
+ message:
16
+ headers:
17
+ Server:
18
+ - nginx/0.8.55
19
+ Date:
20
+ - Tue, 16 Jul 2013 19:52:27 GMT
21
+ Content-Type:
22
+ - application/json
23
+ Transfer-Encoding:
24
+ - chunked
25
+ Connection:
26
+ - keep-alive
27
+ vary:
28
+ - Accept, Accept-Encoding, X-Auth-Token
29
+ VIA:
30
+ - 1.0 Repose (Repose/2.3.5)
31
+ body:
32
+ encoding: UTF-8
33
+ string: '{"unauthorized":{"code":401,"message":"Unable to authenticate user
34
+ with credentials provided."}}'
35
+ http_version:
36
+ recorded_at: Tue, 16 Jul 2013 19:52:27 GMT
37
+ recorded_with: VCR 2.5.0
data/spec/spec_helper.rb CHANGED
@@ -29,6 +29,8 @@ RSpec.configure do |config|
29
29
  }
30
30
  config.include Rumm::SpecHelper
31
31
 
32
+ config.before(:each){ Aruba::InProcess.main_class.input.clear }
33
+
32
34
  config.before(:each) do
33
35
  @__aruba_original_paths = (ENV['PATH'] || '').split(File::PATH_SEPARATOR)
34
36
  ENV['PATH'] = ([File.expand_path('bin')] + @__aruba_original_paths).join(File::PATH_SEPARATOR)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rumm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.14
4
+ version: 0.0.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Charles Lowell
@@ -29,7 +29,7 @@ cert_chain:
29
29
  UgImJlChAzCoDP9zi9tdm6jAr7ttF25R9PPYr11ILb7dYe3qUzlNlM6zJx/nb31b
30
30
  IhdyRVup4qLcqYSTPsm6u7VA
31
31
  -----END CERTIFICATE-----
32
- date: 2013-07-12 00:00:00.000000000 Z
32
+ date: 2013-07-16 00:00:00.000000000 Z
33
33
  dependencies:
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: mvcli
@@ -179,6 +179,7 @@ files:
179
179
  - spec/fixtures/cassettes/show-server.yml
180
180
  - spec/fixtures/cassettes/show-servers.yml
181
181
  - spec/fixtures/cassettes/successful-login.yml
182
+ - spec/fixtures/cassettes/unsuccessful-login.yml
182
183
  - spec/spec_helper.rb
183
184
  - tmp/aruba/.gitkeep
184
185
  homepage: https://github.com/rackerlabs/rumm
@@ -214,5 +215,6 @@ test_files:
214
215
  - spec/fixtures/cassettes/show-server.yml
215
216
  - spec/fixtures/cassettes/show-servers.yml
216
217
  - spec/fixtures/cassettes/successful-login.yml
218
+ - spec/fixtures/cassettes/unsuccessful-login.yml
217
219
  - spec/spec_helper.rb
218
220
  has_rdoc: