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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 02725e586c231125f3699c7d4a7c05eb5e24f021
4
- data.tar.gz: d9b6df172a003051ef464d7238d71d0517cf4297
3
+ metadata.gz: cd5829528cb281f708339cec427521cfe9867da9
4
+ data.tar.gz: f39cd3ccbb419a2385b99f55670bff022024ff12
5
5
  SHA512:
6
- metadata.gz: b59f560562bb2faf846a365862553fbf863222461205ea1334a16101422d4e236123e7b33ee490aa045b3012814e2d8c90941c3f652d0b8804013b170b43f681
7
- data.tar.gz: 0d83e2092a146c20ed86e89f517b4f166de73c41ef9cf3e2a7e8fc2488a45a2b19b6aae2450393f1ce76fbc987d3df266efdd3bd3d12bc0031a3001c8a6b9c75
6
+ metadata.gz: 4d9531b53023c5f1687410ec0aeb2b95a4aba0777ef831754f030bdc1fe98c5d5c552f7363e0f298b4873b89cdeadf273517789dc748a01b183cbaf96a456326
7
+ data.tar.gz: e19cc0661d54fc0b9d8f69898e8314c9a338a0d8079933cb0a4fc308f076443f9cd3c101da54bf4c6426588179477f7bf59d119e552688c2cb1bce16246f1201
data/ChangeLog CHANGED
@@ -1,3 +1,6 @@
1
+ === Release 0.5.1
2
+ * Added ability to turn off all stubbing by setting disable_stubs
3
+
1
4
  === Release 0.5
2
5
  * Added new helper method to remove all whitespace
3
6
  * Added ability to merge data when creating a set of stubs with StubCreator
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
 
@@ -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))
@@ -50,6 +50,7 @@ module ServiceMock
50
50
  end
51
51
 
52
52
  def create_stubs_with(data_file, to_merge = {})
53
+ return if ::ServiceMock.disable_stubs
53
54
  read_data(data_file)
54
55
  merge_data(to_merge) unless to_merge.empty?
55
56
  create_stubs
@@ -1,3 +1,3 @@
1
1
  module ServiceMock
2
- VERSION = "0.5"
2
+ VERSION = "0.5.1"
3
3
  end
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: '0.5'
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-07-31 00:00:00.000000000 Z
11
+ date: 2016-08-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: childprocess