attune 1.0.0 → 1.0.1

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: 0cdd1d33ca1623326bd2c704e63db89f4fcd2108
4
- data.tar.gz: 3c0959d27267e602ed662f979601d96cf0afa9f0
3
+ metadata.gz: 9e256a8b0669441065bf4b2d0b0d723afca73bbd
4
+ data.tar.gz: e746fab54b71d2d0c6ff0923f6bb397d7a9d27ea
5
5
  SHA512:
6
- metadata.gz: d925942d0c3305bbdeb954f4d434f865b83930980ccd133738d67333dc7ab90e1ce075362bd29a866c5b2c20fb474fbaf21c49da4dc7a2bcf15a7a4c68c21f31
7
- data.tar.gz: 209966761a7586eedc8234452f3fff3dac1d02928a4170d11f1ce255097ffe3a699b1fb52854956e0c4f5077cd971b3e05e92176c9022fbb5fdbfef252da9b41
6
+ metadata.gz: 0c0b6e93e0334c4e143e01662e4daf70b20c89b24b519b645008de9eb8e009fe12d7a2410a00ea03e95896649822f5b641a7e046791fe5d4fc5bd7823c8bc1db
7
+ data.tar.gz: 24e5d43a8d95fabb70b5200a3b58e3860c7f1742192d222f1698801722f6601b989ef3a88395ffa410b6e37cade38cd240c9a25ca40b44e727e91ae78a872b82
@@ -127,7 +127,7 @@ module Attune
127
127
  else
128
128
  # In mock mode: return the entities in the order passed in
129
129
  rankings[:headers] = {"attune-cell"=>"mock", "attune-ranking"=>"mock"}
130
- rankings[:entities] = options[:entities]
130
+ rankings[:entities] = options[:entities].map(&:to_s)
131
131
  end
132
132
  rankings
133
133
  end
@@ -175,7 +175,7 @@ module Attune
175
175
  # In mock mode: return the entities in the order passed in
176
176
  rankings[:headers] = {"attune-cell"=>"mock", "attune-ranking"=>"mock"}
177
177
  rankings[:entities] = multi_options.map do |options|
178
- options[:entities]
178
+ options[:entities].map(&:to_s)
179
179
  end
180
180
  end
181
181
  rankings
@@ -1,3 +1,3 @@
1
1
  module Attune
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
@@ -73,31 +73,69 @@ describe Attune::Client do
73
73
  result = client.create_anonymous(user_agent: 'Mozilla/5.0')
74
74
  expect(result).to match(/^[a-z0-9\-]+$/)
75
75
  end
76
- it "mocks get_rankings" do
77
- result = client.get_rankings(
78
- id: 'abcd123',
79
- view: 'b/mens-pants',
80
- collection: 'products',
81
- entities: %w[1001, 1002, 1003, 1004]
82
- )
83
- expected = {
84
- headers: {"attune-cell"=>"mock", "attune-ranking"=>"mock"},
85
- entities: %w[1001, 1002, 1003, 1004]
86
- }
87
- expect(result).to eq expected
76
+ describe "mocks get_rankings" do
77
+ let(:entities) { %w[1001 1002 1003 1004] }
78
+ let(:expected) do
79
+ {
80
+ headers: {"attune-cell"=>"mock", "attune-ranking"=>"mock"},
81
+ entities: entities.map { |e| e.to_s }
82
+ }
83
+ end
84
+
85
+ before(:each) do
86
+ @result = client.get_rankings(
87
+ id: 'abcd123',
88
+ view: 'b/mens-pants',
89
+ collection: 'products',
90
+ entities: entities
91
+ )
92
+ end
93
+
94
+ context "with entities sent as strings" do
95
+ it "returns entities in order sent" do
96
+ expect(@result).to eq expected
97
+ end
98
+ end
99
+
100
+ context "with entities sent as integers" do
101
+ let(:entities) { [1001, 1002, 1003, 1004] }
102
+
103
+ it "returns entities in order sent as strings" do
104
+ expect(@result).to eq expected
105
+ end
106
+ end
88
107
  end
89
- it "mocks multi_get_rankings" do
90
- result = client.multi_get_rankings([
91
- id: 'abcd123',
92
- view: 'b/mens-pants',
93
- collection: 'products',
94
- entities: %w[1001, 1002, 1003, 1004]
95
- ])
96
- expected = {
97
- headers: {"attune-cell"=>"mock", "attune-ranking"=>"mock"},
98
- entities: [%w[1001, 1002, 1003, 1004]]
99
- }
100
- expect(result).to eq expected
108
+ describe "mocks multi_get_rankings" do
109
+ let(:entities) { %w[1001 1002 1003 1004] }
110
+ let(:expected) do
111
+ {
112
+ headers: {"attune-cell"=>"mock", "attune-ranking"=>"mock"},
113
+ entities: [ entities.map { |e| e.to_s } ]
114
+ }
115
+ end
116
+
117
+ before(:each) do
118
+ @result = client.multi_get_rankings([
119
+ id: 'abcd123',
120
+ view: 'b/mens-pants',
121
+ collection: 'products',
122
+ entities: entities
123
+ ])
124
+ end
125
+
126
+ context "with entities sent as strings" do
127
+ it "returns entities in order sent" do
128
+ expect(@result).to eq expected
129
+ end
130
+ end
131
+
132
+ context "with entities sent as integers" do
133
+ let(:entities) { [1001, 1002, 1003, 1004] }
134
+
135
+ it "returns entities in order sent as strings" do
136
+ expect(@result).to eq expected
137
+ end
138
+ end
101
139
  end
102
140
  end
103
141
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: attune
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Hawthorn
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-24 00:00:00.000000000 Z
11
+ date: 2014-03-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday