bunny-mock 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,79 +1,105 @@
1
1
  describe BunnyMock::Session do
2
2
 
3
- context '::new' do
3
+ before do
4
+ @session = BunnyMock::Session.new
5
+ end
4
6
 
5
- it 'should start as not connected' do
7
+ context '::new' do
6
8
 
7
- expect(@session.status).to eq(:not_connected)
8
- end
9
- end
9
+ it 'should start as not connected' do
10
10
 
11
- context '#start' do
11
+ expect(@session.status).to eq(:not_connected)
12
+ end
13
+ end
12
14
 
13
- it 'should set status to connected' do
15
+ context '#start' do
14
16
 
15
- expect(@session.start.status).to eq(:connected)
16
- end
17
- end
17
+ it 'should set status to connected' do
18
18
 
19
- context '#stop (close)' do
19
+ expect(@session.start.status).to eq(:connected)
20
+ end
21
+ end
20
22
 
21
- it 'should set status to closed' do
23
+ context '#stop (close)' do
22
24
 
23
- @session.start
25
+ it 'should set status to closed' do
24
26
 
25
- expect(@session.stop.status).to eq(:closed)
26
- end
27
- end
27
+ @session.start
28
28
 
29
- context '#open?' do
29
+ expect(@session.stop.status).to eq(:closed)
30
+ end
31
+ end
30
32
 
31
- it 'should return true if status is open' do
33
+ context '#open?' do
32
34
 
33
- @session.start
35
+ it 'should return true if status is open' do
34
36
 
35
- expect(@session.open?).to be_truthy
36
- end
37
+ @session.start
37
38
 
38
- it 'should return false otherwise' do
39
+ expect(@session.open?).to be_truthy
40
+ end
39
41
 
40
- # not_connected
41
- expect(@session.open?).to be_falsey
42
+ it 'should return false otherwise' do
42
43
 
43
- @session.stop
44
+ expect(@session.status).to eq(:not_connected)
45
+ expect(@session.open?).to be_falsey
44
46
 
45
- # closed
46
- expect(@session.open?).to be_falsey
47
- end
48
- end
47
+ @session.start
48
+ @session.stop
49
49
 
50
- context '#create_channel (channel)' do
50
+ expect(@session.status).to eq(:closed)
51
+ expect(@session.open?).to be_falsey
52
+ end
53
+ end
51
54
 
52
- it 'should create a new channel with no arguments' do
55
+ context '#create_channel (channel)' do
53
56
 
54
- first = @session.create_channel
55
- second = @session.create_channel
57
+ it 'should create a new channel with no arguments' do
56
58
 
57
- expect(first.class).to eq(BunnyMock::Channel)
58
- expect(second.class).to eq(BunnyMock::Channel)
59
+ first = @session.create_channel
60
+ second = @session.create_channel
59
61
 
60
- expect(first).to_not eq(second)
61
- end
62
+ expect(first.class).to eq(BunnyMock::Channel)
63
+ expect(second.class).to eq(BunnyMock::Channel)
62
64
 
63
- it 'should return cached channel with same identifier' do
65
+ expect(first).to_not eq(second)
66
+ end
64
67
 
65
- first = @session.create_channel 1
66
- second = @session.create_channel 1
68
+ it 'should return cached channel with same identifier' do
67
69
 
68
- expect(first.class).to eq(BunnyMock::Channel)
69
- expect(second.class).to eq(BunnyMock::Channel)
70
+ first = @session.create_channel 1
71
+ second = @session.create_channel 1
70
72
 
71
- expect(first).to eq(second)
72
- end
73
+ expect(first).to eq(second)
74
+ end
73
75
 
74
- it 'should return an ArgumentError for reserved channel' do
76
+ it 'should return an ArgumentError for reserved channel' do
75
77
 
76
- expect { @session.create_channel(0) }.to raise_error(ArgumentError)
77
- end
78
- end
78
+ expect { @session.create_channel(0) }.to raise_error(ArgumentError)
79
+ end
80
+ end
81
+
82
+ context '#with_channel' do
83
+
84
+ it 'should close the channel after the block ends' do
85
+ channel = nil
86
+
87
+ @session.with_channel { |c| channel = c }
88
+
89
+ expect(channel.closed?).to be_truthy
90
+ end
91
+
92
+ it 'should close the channel if an exception is raised' do
93
+ channel = nil
94
+
95
+ expect do
96
+ @session.with_channel do |c|
97
+ channel = c
98
+ raise 'Whoops!'
99
+ end
100
+ end.to raise_error('Whoops!')
101
+
102
+ expect(channel.closed?).to be_truthy
103
+ end
104
+ end
79
105
  end
metadata CHANGED
@@ -1,51 +1,123 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bunny-mock
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Rempe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-02 00:00:00.000000000 Z
11
+ date: 2016-02-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: amq-protocol
14
+ name: bunny
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 2.0.1
19
+ version: '2.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
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: rubocop
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: yard
57
+ requirement: !ruby/object:Gem::Requirement
23
58
  requirements:
24
59
  - - ">="
25
60
  - !ruby/object:Gem::Version
26
- version: 2.0.1
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 3.4.0
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 3.4.0
83
+ - !ruby/object:Gem::Dependency
84
+ name: coveralls
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
27
97
  description: Easy to use mocking for testing the Bunny client for RabbitMQ
28
98
  email:
29
- - |
30
- WVc1a2NtVjNjbVZ0Y0dWQVoyMWhhV3d1WTI5dFxu
99
+ - andrewrempe@gmail.com
31
100
  executables: []
32
101
  extensions: []
33
- extra_rdoc_files:
34
- - README.md
102
+ extra_rdoc_files: []
35
103
  files:
36
104
  - ".coveralls.yml"
105
+ - ".editorconfig"
37
106
  - ".gitignore"
38
107
  - ".rspec"
108
+ - ".rubocop.yml"
109
+ - ".rubocop_todo.yml"
39
110
  - ".travis.yml"
40
111
  - ".yardopts"
41
- - CHANGELOG
112
+ - CHANGELOG.md
42
113
  - Gemfile
43
114
  - LICENSE
44
115
  - README.md
116
+ - Rakefile
117
+ - UPGRADING.md
45
118
  - bunny-mock.gemspec
46
119
  - lib/bunny-mock.rb
47
120
  - lib/bunny_mock/channel.rb
48
- - lib/bunny_mock/exceptions.rb
49
121
  - lib/bunny_mock/exchange.rb
50
122
  - lib/bunny_mock/exchanges/direct.rb
51
123
  - lib/bunny_mock/exchanges/fanout.rb
@@ -83,7 +155,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
83
155
  version: '0'
84
156
  requirements: []
85
157
  rubyforge_project:
86
- rubygems_version: 2.4.6
158
+ rubygems_version: 2.5.1
87
159
  signing_key:
88
160
  specification_version: 4
89
161
  summary: Mocking for the popular Bunny client for RabbitMQ
@@ -97,4 +169,4 @@ test_files:
97
169
  - spec/unit/bunny_mock/queue_spec.rb
98
170
  - spec/unit/bunny_mock/session_spec.rb
99
171
  - spec/unit/bunny_mock_spec.rb
100
- has_rdoc: true
172
+ has_rdoc:
data/CHANGELOG DELETED
@@ -1,8 +0,0 @@
1
- ## v1.1.0
2
-
3
- * Moves queue and exchange storage to BunnyMock::Session
4
- * Adds queue_exists? and exchange_exists? methods to BunnyMock::Session
5
-
6
- ## v1.0.0
7
-
8
- First stable release!
@@ -1,16 +0,0 @@
1
- module BunnyMock
2
-
3
- ##
4
- # Base class for all exceptions
5
- #
6
- # @api public
7
- #
8
- class Exception < ::StandardError; end
9
-
10
- ##
11
- # Raised when a queue or exchange is not found
12
- #
13
- # @api public
14
- #
15
- class NotFound < Exception; end
16
- end