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 +4 -4
- data/lib/mountebank/imposter.rb +6 -0
- data/lib/mountebank/version.rb +1 -1
- data/spec/mountebank/imposter_spec.rb +23 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 43f45bb4ede71f2ca3c446723798ff47f617626aa2a5b193c92fa1b9ef95ab1f
|
4
|
+
data.tar.gz: 6c6d6823b5b3f6e1ca6564348822e2705a8f7d209b9218ae56c4975417471045
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 60362e15d8884216a90d8dd8abf6e22ef47ab477f1a6bcce0a2d580cb30e2cb85342e6f99c0a539ae4a4b68ba87a20e809c07cbd3fea714a31ee787a4b6c1ed1
|
7
|
+
data.tar.gz: d23b5e3f6c24ba2ca3b0489d133b1ceda4815c9076a7383c95c17a63ee06ac14b31587c2e75816ea41a87706aa2ac65916fbe9bdc27d02537fa431a59455780f
|
data/lib/mountebank/imposter.rb
CHANGED
@@ -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)
|
data/lib/mountebank/version.rb
CHANGED
@@ -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.
|
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-
|
12
|
+
date: 2019-03-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: faraday
|