electric_slide 0.4.2 → 0.5.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 49101ac1f213829f41caab6990cf3183d533f3e1
|
4
|
+
data.tar.gz: 796e9cd5bbee24fcda95e58022cf1f83f8c4f2f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 65de89ec11a21d769a14c50c0a359407b2805b096bf87ca35637502030cbc9bbdc0e3199345ecb52cdea49168d652d0ba19559f02e1edcb379789d9e8f032c3f
|
7
|
+
data.tar.gz: 9ba4811599997c2831762642cd0e9b49dc98f9606054ef1de8f00448e9c4fe7dc680b0e173aa2ec3cf284bc245ba16c2b67c7d78474e52055c00cbd08503da3d
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
# [develop](https://github.com/adhearsion/electric_slide)
|
2
2
|
|
3
|
+
# [0.5.0](https://github.com/adhearsion/electric_slide/compare/v0.4.2...v0.5.0) - [2016-02-12](https://rubygems.org/gems/adhearsion/versions/0.5.0)
|
4
|
+
* API Breakage: Fixed priority strategy now ensures that the same agent cannot be in multiple priorities
|
5
|
+
|
3
6
|
# [0.4.2](https://github.com/adhearsion/electric_slide/compare/v0.4.1...v0.4.2) - [2016-02-04](https://rubygems.org/gems/adhearsion/versions/0.4.2)
|
4
7
|
* Bugfix: FixedPriority now correctly checks out agents in priority order.
|
5
8
|
|
@@ -37,11 +37,15 @@ class ElectricSlide
|
|
37
37
|
end
|
38
38
|
|
39
39
|
def <<(agent)
|
40
|
-
# TODO: How aggressively do we check for agents duplicated in multiple priorities?
|
41
40
|
raise ArgumentError, "Agents must have a specified priority" unless agent.respond_to?(:priority)
|
41
|
+
|
42
42
|
priority = agent.priority || 999999
|
43
43
|
@priorities[priority] ||= []
|
44
|
-
|
44
|
+
|
45
|
+
unless @priorities[priority].include?(agent)
|
46
|
+
delete(agent)
|
47
|
+
@priorities[priority] << agent
|
48
|
+
end
|
45
49
|
end
|
46
50
|
|
47
51
|
def delete(agent)
|
@@ -39,4 +39,25 @@ describe ElectricSlide::AgentStrategy::FixedPriority do
|
|
39
39
|
subject.checkout_agent
|
40
40
|
expect(subject.agent_available?).to be true
|
41
41
|
end
|
42
|
+
|
43
|
+
context 'when agents at different priorities are available' do
|
44
|
+
let(:agent1) { agent1 = OpenStruct.new(id: 101, priority: 1) }
|
45
|
+
let(:agent2) { agent1 = OpenStruct.new(id: 102, priority: 2) }
|
46
|
+
|
47
|
+
before do
|
48
|
+
subject << agent1
|
49
|
+
subject << agent2
|
50
|
+
end
|
51
|
+
|
52
|
+
describe 'and the higher priority agent is added again, but at the lowest priority' do
|
53
|
+
before do
|
54
|
+
agent1.priority = 3
|
55
|
+
subject << agent1
|
56
|
+
end
|
57
|
+
|
58
|
+
it 'moves the agent to the new, lower priority' do
|
59
|
+
expect(subject.checkout_agent).to eq(agent2)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
42
63
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: electric_slide
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Klang
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-02-
|
11
|
+
date: 2016-02-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: adhearsion
|