tcr 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/CODEOWNERS +1 -0
- data/.github/workflows/tcr.yml +12 -18
- data/.gitignore +1 -0
- data/Gemfile +6 -2
- data/README.md +1 -1
- data/Rakefile +1 -1
- data/lib/tcr/cassette.rb +1 -1
- data/lib/tcr/version.rb +1 -1
- data/lib/tcr.rb +4 -2
- data/spec/tcr_spec.rb +17 -9
- data/tcr.gemspec +0 -6
- metadata +4 -74
- data/.rvmrc +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '083e01d825d6a7807d3452e11191832b0577b30a334e22c023cd7a7d06e9eec0'
|
4
|
+
data.tar.gz: 4086810e2e1bcd060f564ed19f711035ce6e489bbe1fbb520e745428a361bd1c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 72985071944d541b1623e4593a6766fa4bf5af3a5c137bca88aee527d840c676717535eba2d5baa0727daa85d9dd74eee9040e6ca6b51937935503594aced1b5
|
7
|
+
data.tar.gz: 2c7628bd3b89708ab7a55fb937696a9d932e4a4f6b4198e4ab269091d2595fa29d1c3e818457ff868ccae6dce7a52b5fb6ab8a15fa96cff0ee690a2ecba6e0af
|
data/.github/CODEOWNERS
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
* @SalesLoft/tcr-maintainers
|
data/.github/workflows/tcr.yml
CHANGED
@@ -7,33 +7,27 @@ on:
|
|
7
7
|
|
8
8
|
jobs:
|
9
9
|
test:
|
10
|
-
name: Test
|
10
|
+
name: "Test: Ruby ${{ matrix.ruby }}"
|
11
11
|
runs-on: ubuntu-latest
|
12
|
-
|
13
12
|
strategy:
|
13
|
+
fail-fast: false
|
14
14
|
matrix:
|
15
15
|
ruby:
|
16
|
-
- "2.
|
17
|
-
- "
|
18
|
-
- "
|
19
|
-
- "
|
20
|
-
- "2.4.4"
|
21
|
-
- "2.5.1"
|
22
|
-
- "2.7.3"
|
23
|
-
- "3.0.1"
|
24
|
-
|
16
|
+
- "2.7"
|
17
|
+
- "3.0"
|
18
|
+
- "3.1"
|
19
|
+
- "3.2"
|
25
20
|
steps:
|
26
21
|
- uses: actions/checkout@v2
|
27
|
-
|
28
|
-
- name: Initial setup
|
22
|
+
- name: Set up Ruby
|
29
23
|
uses: ruby/setup-ruby@v1
|
30
24
|
with:
|
31
25
|
ruby-version: ${{ matrix.ruby }}
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
- name: Run
|
26
|
+
# runs 'bundle install' and caches installed gems automatically
|
27
|
+
bundler-cache: true
|
28
|
+
- name: Ruby Version
|
29
|
+
run: ruby --version
|
30
|
+
- name: Run Tests
|
37
31
|
run: bundle exec rspec
|
38
32
|
|
39
33
|
testall:
|
data/.gitignore
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
data/Rakefile
CHANGED
data/lib/tcr/cassette.rb
CHANGED
data/lib/tcr/version.rb
CHANGED
data/lib/tcr.rb
CHANGED
@@ -40,9 +40,10 @@ module TCR
|
|
40
40
|
def use_cassette(name, options = {}, &block)
|
41
41
|
raise ArgumentError, "`TCR.use_cassette` requires a block." unless block
|
42
42
|
TCR.cassette = Cassette.new(name)
|
43
|
-
yield
|
43
|
+
ret_val = yield
|
44
44
|
TCR.cassette.save
|
45
45
|
TCR.cassette.check_hits_all_sessions if options[:hit_all] || configuration.hit_all
|
46
|
+
ret_val
|
46
47
|
ensure
|
47
48
|
TCR.cassette = nil
|
48
49
|
end
|
@@ -51,8 +52,9 @@ module TCR
|
|
51
52
|
raise ArgumentError, "`TCR.turned_off` requires a block." unless block
|
52
53
|
current_hook_tcp_ports = configuration.hook_tcp_ports
|
53
54
|
configuration.hook_tcp_ports = []
|
54
|
-
yield
|
55
|
+
ret_val = yield
|
55
56
|
configuration.hook_tcp_ports = current_hook_tcp_ports
|
57
|
+
ret_val
|
56
58
|
end
|
57
59
|
end
|
58
60
|
|
data/spec/tcr_spec.rb
CHANGED
@@ -15,13 +15,13 @@ RSpec.describe TCR do
|
|
15
15
|
end
|
16
16
|
|
17
17
|
around(:each) do |example|
|
18
|
-
File.unlink("test.json") if File.
|
19
|
-
File.unlink("test.yaml") if File.
|
20
|
-
File.unlink("test.marshal") if File.
|
18
|
+
File.unlink("test.json") if File.exist?("test.json")
|
19
|
+
File.unlink("test.yaml") if File.exist?("test.yaml")
|
20
|
+
File.unlink("test.marshal") if File.exist?("test.marshal")
|
21
21
|
example.run
|
22
|
-
File.unlink("test.json") if File.
|
23
|
-
File.unlink("test.yaml") if File.
|
24
|
-
File.unlink("test.marshal") if File.
|
22
|
+
File.unlink("test.json") if File.exist?("test.json")
|
23
|
+
File.unlink("test.yaml") if File.exist?("test.yaml")
|
24
|
+
File.unlink("test.marshal") if File.exist?("test.marshal")
|
25
25
|
end
|
26
26
|
|
27
27
|
describe ".configuration" do
|
@@ -119,6 +119,10 @@ RSpec.describe TCR do
|
|
119
119
|
}.to raise_error(ArgumentError)
|
120
120
|
end
|
121
121
|
|
122
|
+
it "returns the value" do
|
123
|
+
expect(TCR.turned_off { :foobar }).to eq(:foobar)
|
124
|
+
end
|
125
|
+
|
122
126
|
it "disables hooks within the block" do
|
123
127
|
TCR.configure { |c| c.hook_tcp_ports = [2525] }
|
124
128
|
TCR.turned_off do
|
@@ -150,6 +154,10 @@ RSpec.describe TCR do
|
|
150
154
|
}.to raise_error(TCR::NoCassetteError)
|
151
155
|
end
|
152
156
|
|
157
|
+
it "returns the value" do
|
158
|
+
expect(TCR.use_cassette("test") { :foobar }).to eq(:foobar)
|
159
|
+
end
|
160
|
+
|
153
161
|
it "requires a block to call" do
|
154
162
|
expect {
|
155
163
|
TCR.use_cassette("test")
|
@@ -214,7 +222,7 @@ RSpec.describe TCR do
|
|
214
222
|
TCR.use_cassette("test") do
|
215
223
|
tcp_socket = TCPSocket.open("smtp.mandrillapp.com", 2525)
|
216
224
|
end
|
217
|
-
}.to change{ File.
|
225
|
+
}.to change{ File.exist?("./test.json") }.from(false).to(true)
|
218
226
|
end
|
219
227
|
|
220
228
|
it "records the tcp session data into the file" do
|
@@ -237,7 +245,7 @@ RSpec.describe TCR do
|
|
237
245
|
TCR.use_cassette("test") do
|
238
246
|
tcp_socket = TCPSocket.open("smtp.mandrillapp.com", 2525)
|
239
247
|
end
|
240
|
-
}.to change{ File.
|
248
|
+
}.to change{ File.exist?("./test.yaml") }.from(false).to(true)
|
241
249
|
end
|
242
250
|
|
243
251
|
it "records the tcp session data into the yaml file" do
|
@@ -261,7 +269,7 @@ RSpec.describe TCR do
|
|
261
269
|
TCR.use_cassette("test") do
|
262
270
|
tcp_socket = TCPSocket.open("smtp.mandrillapp.com", 2525)
|
263
271
|
end
|
264
|
-
}.to change{ File.
|
272
|
+
}.to change{ File.exist?("./test.marshal") }.from(false).to(true)
|
265
273
|
end
|
266
274
|
|
267
275
|
it "records the tcp session data into the marshalled file" do
|
data/tcr.gemspec
CHANGED
@@ -16,10 +16,4 @@ Gem::Specification.new do |gem|
|
|
16
16
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
17
17
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
18
|
gem.require_paths = ["lib"]
|
19
|
-
|
20
|
-
gem.add_development_dependency "rspec"
|
21
|
-
gem.add_development_dependency "mail"
|
22
|
-
gem.add_development_dependency "net-ldap"
|
23
|
-
gem.add_development_dependency "mime-types", "~>2.0"
|
24
|
-
gem.add_development_dependency "geminabox"
|
25
19
|
end
|
metadata
CHANGED
@@ -1,85 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tcr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rob Forman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
12
|
-
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: rspec
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ">="
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
20
|
-
type: :development
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ">="
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: mail
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: net-ldap
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: mime-types
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - "~>"
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '2.0'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - "~>"
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '2.0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: geminabox
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - ">="
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '0'
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - ">="
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '0'
|
11
|
+
date: 2023-08-29 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
83
13
|
description: TCR is a lightweight VCR for TCP sockets.
|
84
14
|
email:
|
85
15
|
- rob@robforman.com
|
@@ -87,9 +17,9 @@ executables: []
|
|
87
17
|
extensions: []
|
88
18
|
extra_rdoc_files: []
|
89
19
|
files:
|
20
|
+
- ".github/CODEOWNERS"
|
90
21
|
- ".github/workflows/tcr.yml"
|
91
22
|
- ".gitignore"
|
92
|
-
- ".rvmrc"
|
93
23
|
- Gemfile
|
94
24
|
- LICENSE.txt
|
95
25
|
- README.md
|
data/.rvmrc
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
rvm use 1.9.3@tcr --create
|