cony 1.0.1 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cony (1.0.1)
4
+ cony (1.1.0)
5
5
  activesupport (>= 3)
6
6
  bunny (~> 1.1.7)
7
7
 
data/README.md CHANGED
@@ -25,6 +25,7 @@ Cony.configure do |config|
25
25
  user: 'username',
26
26
  pass: 'secret',
27
27
  }
28
+ config.test_mode = Rails.env.test?
28
29
  # config.durable = false
29
30
  end
30
31
  ```
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.1
1
+ 1.1.0
@@ -29,6 +29,7 @@ module Cony
29
29
 
30
30
  private
31
31
  def publish(type)
32
+ return if Cony.config.test_mode
32
33
  amqp_connection.publish(
33
34
  {id: self.id, changes: cony_changes},
34
35
  "#{self.class.name.underscore}.mutation.#{type}")
data/lib/cony.rb CHANGED
@@ -13,7 +13,8 @@ module Cony
13
13
  include ActiveSupport::Configurable
14
14
 
15
15
  defaults = {
16
- durable: false
16
+ durable: false,
17
+ test_mode: false,
17
18
  }
18
19
 
19
20
  self.config.merge! defaults.deep_dup
@@ -50,4 +50,15 @@ describe Cony::ActiveRecord do
50
50
  subject.cony_send_destroy_notify
51
51
  end
52
52
  end
53
+
54
+ context 'test mode enabled' do
55
+ before do
56
+ Cony.config.stub(:test_mode).and_return(true)
57
+ end
58
+ it 'does not send the message' do
59
+ expect(Cony::AMQPConnectionHandler).to_not receive(:new)
60
+ subject.cony_send_create_notify
61
+ end
62
+ end
63
+
53
64
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cony
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -120,7 +120,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
120
120
  version: '0'
121
121
  segments:
122
122
  - 0
123
- hash: -3538813224422200676
123
+ hash: -2722824331661880657
124
124
  required_rubygems_version: !ruby/object:Gem::Requirement
125
125
  none: false
126
126
  requirements:
@@ -129,7 +129,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
129
129
  version: '0'
130
130
  segments:
131
131
  - 0
132
- hash: -3538813224422200676
132
+ hash: -2722824331661880657
133
133
  requirements: []
134
134
  rubyforge_project:
135
135
  rubygems_version: 1.8.23