erithmetic-mountebank 0.0.1 → 0.0.2

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
  SHA256:
3
- metadata.gz: 5dae41e4f0fcd04086d1d174fac9a46f6b5dc4872e214a81cc5311284a67d5fc
4
- data.tar.gz: 8d29433c98194dea11895138e880af203651e78453316b2c4270720d8c168110
3
+ metadata.gz: 43f45bb4ede71f2ca3c446723798ff47f617626aa2a5b193c92fa1b9ef95ab1f
4
+ data.tar.gz: 6c6d6823b5b3f6e1ca6564348822e2705a8f7d209b9218ae56c4975417471045
5
5
  SHA512:
6
- metadata.gz: 21bfbc0344bb4e8a0fc4f3ffe0af91007b731ae32a0a6c072e94448ccc1dda30510b73999482474fbc9b8f80abb2f3602ffa96f9a2b80c26dd73fac0b747600d
7
- data.tar.gz: 5d1b8b87cd02c468500211e1bd5a67e713cd6cad2b6d71560c548f6d7bd5861e258b4863aafdbaa3d65714fcf4b74cb54002d7931cab03d840e22046c64f442e
6
+ metadata.gz: 60362e15d8884216a90d8dd8abf6e22ef47ab477f1a6bcce0a2d580cb30e2cb85342e6f99c0a539ae4a4b68ba87a20e809c07cbd3fea714a31ee787a4b6c1ed1
7
+ data.tar.gz: d23b5e3f6c24ba2ca3b0489d133b1ceda4815c9076a7383c95c17a63ee06ac14b31587c2e75816ea41a87706aa2ac65916fbe9bdc27d02537fa431a59455780f
@@ -42,6 +42,12 @@ module Mountebank
42
42
  def self.create(port, protocol=PROTOCOL_HTTP, options={})
43
43
  self.build(port, protocol, options).save!
44
44
  end
45
+
46
+ def self.find_all
47
+ response = Network.get("/imposters")
48
+ list = response.success? ? response.body[:imposters] : []
49
+ list.map { |i| Mountebank::Imposter.new(i) }
50
+ end
45
51
 
46
52
  def self.find(port)
47
53
  imposter_data = Imposter.get_imposter_config(port)
@@ -1,3 +1,3 @@
1
1
  module Mountebank
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -121,6 +121,29 @@ RSpec.describe Mountebank::Imposter do
121
121
  end
122
122
  end
123
123
 
124
+ describe '.find_all' do
125
+ context '0 existing imposters' do
126
+ it 'returns an empty array' do
127
+ expect(Mountebank::Imposter.find_all).to be_empty
128
+ end
129
+ end
130
+
131
+ context '1 existing imposter' do
132
+ it 'returns a single imposter' do
133
+ Mountebank::Imposter.create(4546)
134
+ expect(Mountebank::Imposter.find_all.map(&:port)).to eq([4546])
135
+ end
136
+ end
137
+
138
+ context '3 existing imposters' do
139
+ it 'returns all three imposters' do
140
+ Mountebank::Imposter.create(4546)
141
+ Mountebank::Imposter.create(4547)
142
+ expect(Mountebank::Imposter.find_all.map(&:port).sort).to eq([4546, 4547])
143
+ end
144
+ end
145
+ end
146
+
124
147
  describe '.delete' do
125
148
  before do
126
149
  Mountebank::Imposter.create(port)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: erithmetic-mountebank
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Cheng
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-03-21 00:00:00.000000000 Z
12
+ date: 2019-03-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: faraday