dumbwaiter 0.3.8 → 0.3.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cc87b1fc30c12a2faa171507be7097579ec077dc
4
- data.tar.gz: f7a84fbb84d7d2a5c8bf25293c33474066c2584f
3
+ metadata.gz: cfb7090316683071d3ce265c16b526bdb5572778
4
+ data.tar.gz: 9f7d7cfc83b396d190d6e183edb02c31176e489a
5
5
  SHA512:
6
- metadata.gz: dd91d3446ecd0fffc7aa82d1647c304ad6d654f54d427c2e79cd39ccb32b97d8d7f54f3e96dd413d2d24aebbe5187cc184ce1af43b54e01cb3bfcbefcbce6303
7
- data.tar.gz: 828d4537a6ad2758c77c2027ab6ec880878a1bde305137ce7c922a4bbc23e23b6928dd6d875cd60dac0388f0fe10d34b060fbb4944572407946e92a2aed685a5
6
+ metadata.gz: ea5b7c3d7f8454d9b33b4d56ae4fd4cae2b502146ee87fc06fd43124a607cafec6d284404517062b1b7b78fe60008f407fff1ce2ec2058de1cea9b42015190c3
7
+ data.tar.gz: 55768221bc46cbf6f3d5061a475eb1b4a8f993d07ca354f3de4c9743f0eabeb11f96cab645cf0bf115ebd2ffbe2f8a28c77467bcf463081b270fedc5e8664b4c
@@ -10,11 +10,17 @@ class Dumbwaiter::App
10
10
  end
11
11
 
12
12
  def self.find(stack, app_name, opsworks = Aws::OpsWorks.new(region: "us-east-1"))
13
- app = all(stack, opsworks).detect { |app| app.name == app_name}
13
+ app = all(stack, opsworks).detect { |app| app.name == app_name }
14
14
  raise NotFound.new("No app found with name #{app_name}") if app.nil?
15
15
  app
16
16
  end
17
17
 
18
+ def self.find_by_id(stack, app_id, opsworks = Aws::OpsWorks.new(region: "us-east-1"))
19
+ app = all(stack, opsworks).detect { |app| app.id == app_id }
20
+ raise NotFound.new("No app found with id #{app_id}") if app.nil?
21
+ app
22
+ end
23
+
18
24
  def initialize(stack, opsworks_app, opsworks = Aws::OpsWorks.new(region: "us-east-1"))
19
25
  @stack = stack
20
26
  @opsworks_app = opsworks_app
@@ -1,3 +1,3 @@
1
1
  module Dumbwaiter
2
- VERSION = "0.3.8"
2
+ VERSION = "0.3.9"
3
3
  end
@@ -68,4 +68,20 @@ describe Dumbwaiter::App do
68
68
  end
69
69
  end
70
70
  end
71
+
72
+ describe ".find" do
73
+ context "when the app exists" do
74
+ it "finds the app by id" do
75
+ Dumbwaiter::App.find_by_id(fake_stack, "amazing", fake_opsworks).name.should == "goose"
76
+ end
77
+ end
78
+
79
+ context "when the app does not exist" do
80
+ it "blows up" do
81
+ expect {
82
+ Dumbwaiter::App.find_by_id(fake_stack, "teeth", fake_opsworks)
83
+ }.to raise_error(Dumbwaiter::App::NotFound)
84
+ end
85
+ end
86
+ end
71
87
  end
@@ -49,7 +49,7 @@ describe Dumbwaiter::Stack do
49
49
 
50
50
  describe ".find_by_id" do
51
51
  context "when the stack exists" do
52
- it "finds the stack by name" do
52
+ it "finds the stack by id" do
53
53
  Dumbwaiter::Stack.find_by_id("cool", fake_opsworks).name.should == "ducks"
54
54
  end
55
55
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dumbwaiter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.8
4
+ version: 0.3.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Doc Ritezel