pinch_hitter 0.5.6 → 0.6.0

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: 61b0f448b1236a0470c64ffdd3015e536db68cf9
4
- data.tar.gz: a451b062d54056d41397a2d187d260bf7ec00162
3
+ metadata.gz: 0c0e017cec57427c43e8e5d00fdbf6f5824a811d
4
+ data.tar.gz: 4f08b9678da6946f6775d3bf61c874b081982f21
5
5
  SHA512:
6
- metadata.gz: b266a49251d14f0adb19d9103f9a750eaec21073f32986723d8687aeb8f331d63fb91b61e6dd4baf559d7f16ce3ab088fa13cc3ef7d79bb00a86fb44d9e459aa
7
- data.tar.gz: 664117aff93c40d35fd9b09b1cf5257d35c5050c70869c70ae6df49ef64b9c7f7f96a01653f7b52176d41f7b46bb28e189f2e3b01d821e1901c267c193b5314b
6
+ metadata.gz: 3132ce9f63afd12c4a4efeb632a8d1d339aba116708f060586090108e3f2d879d1135bf2f35f89122d5c55fe287230c43f333cd1e6f60f50118166e932f5cf99
7
+ data.tar.gz: b086e13074d4362d6ebd7e910818eaffcb48c9eb1370175970c3fb984f6bba0775437f321132171aa719b743a8092801cc65b5a41bb49137f5632b70ecd72310
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- ruby-2.0.0-p353
1
+ ruby-2.3.1
data/.travis.yml CHANGED
@@ -1,8 +1,7 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 1.9.3
4
- - 2.0.0
5
- - 2.1.5
6
- - 2.2.2
3
+ - 2.1.9
4
+ - 2.2.5
5
+ - 2.3.1
7
6
  before_install:
8
7
  - gem update bundler
data/Changelog CHANGED
@@ -37,3 +37,7 @@ test logs.
37
37
  * Add ability to disable cache control (useful for IE testing)
38
38
  * Allow client to register a module that will hydrate the response object.
39
39
  * Break apart recording and responding to better support full response payloads
40
+
41
+ === Release 0.6.0 / 2016-06-14
42
+ * Removed references to 1.9.2 which has long been EOL'd. - Thanks @garyjohnson!
43
+ * Remove dependency on nokogiri
data/README.md CHANGED
@@ -1,6 +1,8 @@
1
- # Pinch Hitter
1
+ # Pinch Hitter [![Build Status](https://travis-ci.org/stevenjackson/pinch_hitter.svg?branch=master)](https://travis-ci.org/stevenjackson/pinch_hitter)
2
+
2
3
  Simple replay mock for web service testing
3
4
 
5
+
4
6
  ## Installation
5
7
 
6
8
  Add this line to your application's Gemfile:
@@ -36,3 +38,7 @@ Start the service using rackup
36
38
  3. Commit your changes (`git commit -am 'Added some feature'`)
37
39
  4. Push to the branch (`git push origin my-new-feature`)
38
40
  5. Create new Pull Request
41
+
42
+ ## Notes
43
+
44
+ If the `json` gem fails to install on OSX, try running `brew install coreutils`.
data/Rakefile CHANGED
@@ -10,11 +10,7 @@ Rake::TestTask.new(:unit) do |t|
10
10
  end
11
11
 
12
12
  Cucumber::Rake::Task.new(:features) do |t|
13
- if RUBY_VERSION == '1.9.2'
14
- t.profile = '1.9.2'
15
- else
16
- t.profile = 'default'
17
- end
13
+ t.profile = 'default'
18
14
  end
19
15
 
20
16
  desc 'Run all unit tests and features'
data/cucumber.yml CHANGED
@@ -1,2 +1 @@
1
1
  default: --no-source --color --format pretty
2
- 1.9.2: --no-source --color --format pretty --tags ~@not_1.9.2
@@ -18,7 +18,6 @@ Feature: Verify application's output
18
18
  | POST | /poster |
19
19
  | PUT | /putter |
20
20
 
21
- @not_1.9.2
22
21
  Scenario Outline: HTTP methods
23
22
  When I do a <method> on "<endpoint>"
24
23
  Then the service has recieved a request on "<endpoint>"
@@ -1,4 +1,5 @@
1
- require 'nokogiri'
1
+ require 'rexml/document'
2
+ require 'rexml/xpath'
2
3
 
3
4
  module PinchHitter::Message
4
5
  module Xml
@@ -12,7 +13,8 @@ module PinchHitter::Message
12
13
 
13
14
  private
14
15
  def load_xml_file(filename)
15
- Nokogiri::XML File.open filename
16
+ file = File.new filename
17
+ REXML::Document.new file
16
18
  end
17
19
 
18
20
  def replace_xml(xml, key, text)
@@ -21,15 +23,15 @@ module PinchHitter::Message
21
23
 
22
24
  if parts.length == 1
23
25
  #match text node
24
- tag.content = text
26
+ tag.text = text
25
27
  else
26
28
  #match attribute
27
- tag[parts.last] = text
29
+ tag.attributes[parts.last] = text
28
30
  end
29
31
  end
30
32
 
31
33
  def find_node(xml, tag)
32
- xml.at_xpath("//#{tag}", xml.collect_namespaces)
34
+ REXML::XPath.first(xml, "//#{tag}")
33
35
  end
34
36
  end
35
37
  end
@@ -1,7 +1,6 @@
1
1
  require 'bundler/setup'
2
2
  require 'sinatra/base'
3
3
  require 'sinatra/cross_origin'
4
- require 'nokogiri'
5
4
  require 'json'
6
5
 
7
6
  require 'pinch_hitter/service/endpoint_handlers'
@@ -1,3 +1,3 @@
1
1
  module PinchHitter
2
- VERSION = "0.5.6"
2
+ VERSION = "0.6.0"
3
3
  end
data/pinch_hitter.gemspec CHANGED
@@ -18,7 +18,6 @@ Gem::Specification.new do |gem|
18
18
  gem.require_paths = ["lib"]
19
19
 
20
20
  gem.add_dependency 'sinatra', '>= 1.3.3'
21
- gem.add_dependency 'nokogiri', '>= 1.5.6'
22
21
  gem.add_dependency 'json', '>= 1.7.6'
23
22
  gem.add_dependency 'sinatra-cross_origin', '~> 0.3.1'
24
23
 
data/test/test_message.rb CHANGED
@@ -26,7 +26,7 @@ class TestMessage < MiniTest::Test
26
26
  end
27
27
 
28
28
  def xml_message
29
- %Q{<?xml version="1.0" encoding="UTF-8"?>
29
+ %Q{<?xml version='1.0' encoding='UTF-8'?>
30
30
  <Body/>
31
31
  }
32
32
  end
@@ -42,7 +42,7 @@ class TestMessage < MiniTest::Test
42
42
  @messages.message_directory = "/foo"
43
43
  assert_equal "/foo", @messages.message_directory
44
44
  end
45
-
45
+
46
46
  def test_loads_xml
47
47
  assert_equal xml_message, @messages.load(xml_filename.to_sym)
48
48
  end
@@ -52,7 +52,7 @@ class TestMessage < MiniTest::Test
52
52
  end
53
53
 
54
54
  def test_message_no_whitespace
55
- squish = %Q{<?xml version="1.0" encoding="UTF-8"?><Body/>}
55
+ squish = %Q{<?xml version='1.0' encoding='UTF-8'?><Body/>}
56
56
  assert_equal squish, @messages.load(xml_filename.to_sym).squish
57
57
  end
58
58
 
@@ -19,18 +19,18 @@ class TestXmlMessage < MiniTest::Test
19
19
  end
20
20
 
21
21
  def our_message
22
- %Q{<?xml version="1.0" encoding="UTF-8"?>
22
+ %Q{<?xml version='1.0' encoding='UTF-8'?>
23
23
  <wrapper>
24
- <Body xmlns:ns="http://www.abc.org/OTA/2003/05">
24
+ <Body xmlns:ns='http://www.abc.org/OTA/2003/05'>
25
25
  <node>text</node>
26
- <withattrib attrib="value"/>
26
+ <withattrib attrib='value'/>
27
27
  <ns:testnode>text</ns:testnode>
28
28
  </Body>
29
29
  </wrapper>
30
30
  }
31
31
  end
32
32
 
33
- def test_message_no_overrides
33
+ def test_message_no_overrides
34
34
  assert_equal our_message, @test.xml_message(filename)
35
35
  end
36
36
 
@@ -42,7 +42,7 @@ class TestXmlMessage < MiniTest::Test
42
42
  def test_message_tag_override_attrib
43
43
  xml = @test.xml_message(filename,
44
44
  {"withattrib@attrib" => "BetterValue"})
45
- assert xml.include? "<withattrib attrib=\"BetterValue\""
45
+ assert xml.include? "<withattrib attrib='BetterValue'"
46
46
  end
47
47
 
48
48
  def test_message_tag_override_with_namespace
metadata CHANGED
@@ -1,139 +1,125 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pinch_hitter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.6
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steve Jackson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-19 00:00:00.000000000 Z
11
+ date: 2016-06-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sinatra
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: 1.3.3
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: 1.3.3
27
- - !ruby/object:Gem::Dependency
28
- name: nokogiri
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - '>='
32
- - !ruby/object:Gem::Version
33
- version: 1.5.6
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - '>='
39
- - !ruby/object:Gem::Version
40
- version: 1.5.6
41
27
  - !ruby/object:Gem::Dependency
42
28
  name: json
43
29
  requirement: !ruby/object:Gem::Requirement
44
30
  requirements:
45
- - - '>='
31
+ - - ">="
46
32
  - !ruby/object:Gem::Version
47
33
  version: 1.7.6
48
34
  type: :runtime
49
35
  prerelease: false
50
36
  version_requirements: !ruby/object:Gem::Requirement
51
37
  requirements:
52
- - - '>='
38
+ - - ">="
53
39
  - !ruby/object:Gem::Version
54
40
  version: 1.7.6
55
41
  - !ruby/object:Gem::Dependency
56
42
  name: sinatra-cross_origin
57
43
  requirement: !ruby/object:Gem::Requirement
58
44
  requirements:
59
- - - ~>
45
+ - - "~>"
60
46
  - !ruby/object:Gem::Version
61
47
  version: 0.3.1
62
48
  type: :runtime
63
49
  prerelease: false
64
50
  version_requirements: !ruby/object:Gem::Requirement
65
51
  requirements:
66
- - - ~>
52
+ - - "~>"
67
53
  - !ruby/object:Gem::Version
68
54
  version: 0.3.1
69
55
  - !ruby/object:Gem::Dependency
70
56
  name: minitest
71
57
  requirement: !ruby/object:Gem::Requirement
72
58
  requirements:
73
- - - '>='
59
+ - - ">="
74
60
  - !ruby/object:Gem::Version
75
61
  version: 4.3.3
76
62
  type: :development
77
63
  prerelease: false
78
64
  version_requirements: !ruby/object:Gem::Requirement
79
65
  requirements:
80
- - - '>='
66
+ - - ">="
81
67
  - !ruby/object:Gem::Version
82
68
  version: 4.3.3
83
69
  - !ruby/object:Gem::Dependency
84
70
  name: rack-test
85
71
  requirement: !ruby/object:Gem::Requirement
86
72
  requirements:
87
- - - '>='
73
+ - - ">="
88
74
  - !ruby/object:Gem::Version
89
75
  version: 0.6.2
90
76
  type: :development
91
77
  prerelease: false
92
78
  version_requirements: !ruby/object:Gem::Requirement
93
79
  requirements:
94
- - - '>='
80
+ - - ">="
95
81
  - !ruby/object:Gem::Version
96
82
  version: 0.6.2
97
83
  - !ruby/object:Gem::Dependency
98
84
  name: rake
99
85
  requirement: !ruby/object:Gem::Requirement
100
86
  requirements:
101
- - - '>='
87
+ - - ">="
102
88
  - !ruby/object:Gem::Version
103
89
  version: 10.0.3
104
90
  type: :development
105
91
  prerelease: false
106
92
  version_requirements: !ruby/object:Gem::Requirement
107
93
  requirements:
108
- - - '>='
94
+ - - ">="
109
95
  - !ruby/object:Gem::Version
110
96
  version: 10.0.3
111
97
  - !ruby/object:Gem::Dependency
112
98
  name: rspec
113
99
  requirement: !ruby/object:Gem::Requirement
114
100
  requirements:
115
- - - '>='
101
+ - - ">="
116
102
  - !ruby/object:Gem::Version
117
103
  version: 2.12.0
118
104
  type: :development
119
105
  prerelease: false
120
106
  version_requirements: !ruby/object:Gem::Requirement
121
107
  requirements:
122
- - - '>='
108
+ - - ">="
123
109
  - !ruby/object:Gem::Version
124
110
  version: 2.12.0
125
111
  - !ruby/object:Gem::Dependency
126
112
  name: cucumber
127
113
  requirement: !ruby/object:Gem::Requirement
128
114
  requirements:
129
- - - '>='
115
+ - - ">="
130
116
  - !ruby/object:Gem::Version
131
117
  version: 1.2.1
132
118
  type: :development
133
119
  prerelease: false
134
120
  version_requirements: !ruby/object:Gem::Requirement
135
121
  requirements:
136
- - - '>='
122
+ - - ">="
137
123
  - !ruby/object:Gem::Version
138
124
  version: 1.2.1
139
125
  description: A simple web service that returns primed responses in FIFO order
@@ -143,10 +129,10 @@ executables: []
143
129
  extensions: []
144
130
  extra_rdoc_files: []
145
131
  files:
146
- - .gitignore
147
- - .ruby-gemset
148
- - .ruby-version
149
- - .travis.yml
132
+ - ".gitignore"
133
+ - ".ruby-gemset"
134
+ - ".ruby-version"
135
+ - ".travis.yml"
150
136
  - Changelog
151
137
  - Gemfile
152
138
  - LICENSE
@@ -197,17 +183,17 @@ require_paths:
197
183
  - lib
198
184
  required_ruby_version: !ruby/object:Gem::Requirement
199
185
  requirements:
200
- - - '>='
186
+ - - ">="
201
187
  - !ruby/object:Gem::Version
202
188
  version: '0'
203
189
  required_rubygems_version: !ruby/object:Gem::Requirement
204
190
  requirements:
205
- - - '>='
191
+ - - ">="
206
192
  - !ruby/object:Gem::Version
207
193
  version: '0'
208
194
  requirements: []
209
195
  rubyforge_project:
210
- rubygems_version: 2.4.6
196
+ rubygems_version: 2.5.1
211
197
  signing_key:
212
198
  specification_version: 4
213
199
  summary: Test utility for mocking out external web responses