service_mock 0.5 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ChangeLog +3 -0
- data/lib/service_mock.rb +9 -1
- data/lib/service_mock/server.rb +3 -0
- data/lib/service_mock/stub_creator.rb +1 -0
- data/lib/service_mock/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cd5829528cb281f708339cec427521cfe9867da9
|
4
|
+
data.tar.gz: f39cd3ccbb419a2385b99f55670bff022024ff12
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4d9531b53023c5f1687410ec0aeb2b95a4aba0777ef831754f030bdc1fe98c5d5c552f7363e0f298b4873b89cdeadf273517789dc748a01b183cbaf96a456326
|
7
|
+
data.tar.gz: e19cc0661d54fc0b9d8f69898e8314c9a338a0d8079933cb0a4fc308f076443f9cd3c101da54bf4c6426588179477f7bf59d119e552688c2cb1bce16246f1201
|
data/ChangeLog
CHANGED
data/lib/service_mock.rb
CHANGED
@@ -28,9 +28,17 @@ module ServiceMock
|
|
28
28
|
@working_directory ||= 'config/mocks'
|
29
29
|
end
|
30
30
|
|
31
|
-
def working_directory=(value)
|
31
|
+
def self.working_directory=(value)
|
32
32
|
@working_directory = value
|
33
33
|
end
|
34
|
+
|
35
|
+
def self.disable_stubs
|
36
|
+
@disable_stubs ||= false
|
37
|
+
end
|
38
|
+
|
39
|
+
def self.disable_stubs=(value)
|
40
|
+
@disable_stubs = value
|
41
|
+
end
|
34
42
|
end
|
35
43
|
|
36
44
|
|
data/lib/service_mock/server.rb
CHANGED
@@ -104,6 +104,7 @@ module ServiceMock
|
|
104
104
|
# Create a stub based on the value provided.
|
105
105
|
#
|
106
106
|
def stub(message)
|
107
|
+
return if ::ServiceMock.disable_stubs
|
107
108
|
yield self if block_given?
|
108
109
|
http.post('/__admin/mappings/new', message)
|
109
110
|
end
|
@@ -112,6 +113,7 @@ module ServiceMock
|
|
112
113
|
# Create a stub using the information in the provided filename.
|
113
114
|
#
|
114
115
|
def stub_with_file(filename)
|
116
|
+
return if ::ServiceMock.disable_stubs
|
115
117
|
yield self if block_given?
|
116
118
|
content = File.open(filename, 'rb') {|file| file.read}
|
117
119
|
stub(content)
|
@@ -122,6 +124,7 @@ module ServiceMock
|
|
122
124
|
# parameter contains the values to be inserted into the +ERB+.
|
123
125
|
#
|
124
126
|
def stub_with_erb(filename, hsh={})
|
127
|
+
return if ::ServiceMock.disable_stubs
|
125
128
|
yield self if block_given?
|
126
129
|
template = File.open(filename, 'rb') {|file| file.read}
|
127
130
|
erb_content = ERB.new(template).result(data_binding(hsh))
|
data/lib/service_mock/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: service_mock
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeffrey S. Morgan
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-08-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: childprocess
|