cpi-event-connector 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cpi-event-connector (0.0.3)
5
- activesupport (~> 3.1.1)
4
+ cpi-event-connector (0.0.5)
5
+ activesupport (~> 3.1.4)
6
6
  bunny
7
7
  uuidtools (~> 2.1.2)
8
8
 
@@ -21,6 +21,6 @@ Gem::Specification.new do |s|
21
21
  s.add_development_dependency "justinf-unification_assertion"
22
22
 
23
23
  s.add_runtime_dependency "bunny"
24
- s.add_runtime_dependency "activesupport", "~> 3.1.1"
24
+ s.add_runtime_dependency "activesupport", "~> 3.1.4"
25
25
  s.add_runtime_dependency "uuidtools", "~> 2.1.2"
26
26
  end
@@ -3,7 +3,7 @@ require 'bunny'
3
3
  module Cpi
4
4
  class Connector
5
5
  def initialize params={}
6
- @queue_name = params.delete("queue")
6
+ @queue_name = params.delete(:queue)
7
7
  @params = params
8
8
  end
9
9
 
@@ -4,7 +4,7 @@ module Cpi
4
4
  @@enabled = false
5
5
 
6
6
  def self.configure(params)
7
- @@enabled = !!params.delete("enabled")
7
+ @@enabled = !!params.delete(:enabled)
8
8
  return unless @@enabled
9
9
  @@connector = Cpi::Connector.new(params)
10
10
  @@connector.start
@@ -1,3 +1,3 @@
1
1
  module Cpi
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
@@ -5,7 +5,7 @@ require 'bunny'
5
5
  describe Cpi::Connector do
6
6
 
7
7
  let(:bunny) { double(Bunny) }
8
- let(:params) { {"host" => "", "port" => "", "username" => "", "password" => "", "queue" => "cpi"} }
8
+ let(:params) { {:host => "", :port => "", :username => "", :password => "", :queue => "cpi"} }
9
9
  let(:queue) { double("a queue")}
10
10
  let(:exchange) { double("an exchange")}
11
11
 
data/spec/event_spec.rb CHANGED
@@ -3,6 +3,7 @@ require 'lib/cpi_event_connector'
3
3
  require 'yaml'
4
4
  require 'active_support'
5
5
  require 'unification_assertion'
6
+ require 'active_support/core_ext/hash/keys' # for symbolize keys
6
7
 
7
8
  describe Cpi::Event do
8
9
  let(:yaml_config) { "
@@ -20,12 +21,12 @@ enabled: true
20
21
  let(:connector) { double(Cpi::Connector) }
21
22
 
22
23
  it "accepts a hash of connection information" do
23
- expected_config = YAML::load(yaml_config)
24
- expected_config.delete("enabled")
24
+ expected_config = YAML::load(yaml_config).symbolize_keys!
25
+ expected_config.delete(:enabled)
25
26
  Cpi::Connector.should_receive(:new).with(expected_config).and_return(connector)
26
27
  connector.should_receive(:start)
27
28
 
28
- Cpi::Event.configure(YAML::load(yaml_config))
29
+ Cpi::Event.configure(YAML::load(yaml_config).symbolize_keys!)
29
30
  end
30
31
 
31
32
  it "does nothing if enabled is false" do
@@ -43,7 +44,7 @@ enabled: false"
43
44
  let(:content) { "<test />" }
44
45
 
45
46
  it "generates and sends an event" do
46
- Cpi::Event.configure(YAML::load(yaml_config))
47
+ Cpi::Event.configure(YAML::load(yaml_config).symbolize_keys!)
47
48
 
48
49
  Cpi::Event.transmit("shipment_shipped", "stuff", content)
49
50
 
@@ -58,8 +59,8 @@ enabled: false"
58
59
  end
59
60
 
60
61
  it "does not transmit when it is not enabled" do
61
- config = YAML::load(yaml_config)
62
- config["enabled"] = false
62
+ config = YAML::load(yaml_config).symbolize_keys!
63
+ config[:enabled] = false
63
64
 
64
65
  Cpi::Event.configure(config)
65
66
  Cpi::Generator.should_not_receive(:create_event)
@@ -2,6 +2,7 @@ require 'spec_helper'
2
2
  require 'lib/cpi_event_connector'
3
3
  require 'yaml'
4
4
  require 'bunny'
5
+ require 'active_support/core_ext/hash/keys' # for symbolize keys
5
6
 
6
7
  describe "Integration Tests" do
7
8
 
@@ -14,7 +15,7 @@ password: guest
14
15
  queue: connector-test"}
15
16
 
16
17
  it "sends a message to an amqp server" do
17
- connector = Cpi::Connector.new(YAML::load(yaml_config))
18
+ connector = Cpi::Connector.new(YAML::load(yaml_config).symbolize_keys!)
18
19
  connector.start
19
20
  connector.transmit("message")
20
21
  connector.stop
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cpi-event-connector
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 21
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 4
10
- version: 0.0.4
9
+ - 5
10
+ version: 0.0.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Nulogy
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-03-12 00:00:00 Z
18
+ date: 2012-03-15 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: rspec
@@ -67,12 +67,12 @@ dependencies:
67
67
  requirements:
68
68
  - - ~>
69
69
  - !ruby/object:Gem::Version
70
- hash: 1
70
+ hash: 11
71
71
  segments:
72
72
  - 3
73
73
  - 1
74
- - 1
75
- version: 3.1.1
74
+ - 4
75
+ version: 3.1.4
76
76
  type: :runtime
77
77
  version_requirements: *id004
78
78
  - !ruby/object:Gem::Dependency
@@ -146,7 +146,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
146
146
  requirements: []
147
147
 
148
148
  rubyforge_project:
149
- rubygems_version: 1.8.10
149
+ rubygems_version: 1.8.15
150
150
  signing_key:
151
151
  specification_version: 3
152
152
  summary: Sends events to CPI