queenbee 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/queenbee/event.rb +5 -0
- data/lib/queenbee/version.rb +1 -1
- data/test/queenbee/event_test.rb +13 -1
- data/test/queenbee/order_test.rb +26 -20
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 700f919932c2e044a87eb17cfa2d49762f23ea32cff50281e451c187e2ee5486
|
4
|
+
data.tar.gz: de6374d95b7f7ecb379b7865fb3478f01fa77bbcbe62199c1424897c4d087e62
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3a4e357b94a3c451626c77aeb9695d4a731e35afa3350232a7948dc0af6285b9215bb139f5eab03f224ab5aef8dedf9178b70f03aed6d03efb2f2f69601bd4cc
|
7
|
+
data.tar.gz: 19b894534640542866bddb6a9d2cdfbd59bfd0b30a6acf93fc1b12a72774617ce10a3299e2b3657ab97463978a26fd1c6616f747c174aad90d9f8e302edfa2bc
|
data/lib/queenbee/event.rb
CHANGED
data/lib/queenbee/version.rb
CHANGED
data/test/queenbee/event_test.rb
CHANGED
@@ -7,10 +7,22 @@ module Queenbee
|
|
7
7
|
date: "2014-07-01 14:50:28",
|
8
8
|
status: "confirmed",
|
9
9
|
message: "From the API",
|
10
|
-
metadata: {color: "pink", "sport": "basket-ball", "age": 25, "fruit": "banana"}
|
10
|
+
metadata: { color: "pink", "sport": "basket-ball", "age": 25, "fruit": "banana" }
|
11
11
|
}
|
12
12
|
end
|
13
13
|
|
14
|
+
should "index should return status 200" do
|
15
|
+
response = Queenbee::Event.all
|
16
|
+
assert_equal "200", response.code
|
17
|
+
assert_equal Array, JSON.parse(response.body).class
|
18
|
+
end
|
19
|
+
|
20
|
+
should "index should paginate" do
|
21
|
+
response = Queenbee::Event.all(page: 10)
|
22
|
+
assert_equal "200", response.code
|
23
|
+
assert_equal Array, JSON.parse(response.body).class
|
24
|
+
end
|
25
|
+
|
14
26
|
should "create should return status 201" do
|
15
27
|
response = Queenbee::Event.create(@valid_params)
|
16
28
|
assert_equal "201", response.code
|
data/test/queenbee/order_test.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require File.expand_path("../../test_helper", __FILE__)
|
2
|
+
require 'securerandom'
|
2
3
|
|
3
4
|
module Queenbee
|
4
5
|
class OrderTest < Test::Unit::TestCase
|
@@ -14,29 +15,35 @@ module Queenbee
|
|
14
15
|
@updated_params = @valid_params.merge!(client_email: "kk@email.com")
|
15
16
|
end
|
16
17
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
18
|
+
should "create should return status 201" do
|
19
|
+
response = Queenbee::Order.create(@valid_params)
|
20
|
+
assert_equal "201", response.code
|
21
|
+
end
|
21
22
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
23
|
+
should "raise Queenbee::AuthenticationError if no token provided" do
|
24
|
+
Queenbee.token = nil
|
25
|
+
assert_raises(Queenbee::AuthenticationError) { Queenbee::Order.create }
|
26
|
+
end
|
26
27
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
28
|
+
should "raise Queenbee::InvalidRequestError if not enough parameters" do
|
29
|
+
begin
|
30
|
+
rescue JSON::ParserError
|
31
|
+
assert_raises(Queenbee::InvalidRequestError) { Queenbee::Order.create }
|
32
|
+
end
|
33
|
+
end
|
33
34
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
35
|
+
should "Update should return 200" do
|
36
|
+
response1 = Queenbee::Order.create(@valid_params)
|
37
|
+
response = Queenbee::Order.save(@updated_params)
|
38
|
+
assert_equal "200", response.code
|
39
|
+
end
|
39
40
|
|
41
|
+
# Queenbee API raises error if record not found `find_by!`
|
42
|
+
# preventing tests from passing
|
43
|
+
# TODO
|
44
|
+
# - Review API response
|
45
|
+
# - Separate tests from real response from the API
|
46
|
+
#
|
40
47
|
# should "Update should return 404 if UID incorrect" do
|
41
48
|
# response1 = Queenbee::Order.create(@valid_params)
|
42
49
|
# invalid_params = @valid_params.merge!(uid: "fakeuid")
|
@@ -54,6 +61,5 @@ module Queenbee
|
|
54
61
|
# response = Queenbee::Order.delete("fakeuid")
|
55
62
|
# assert_equal "404", response.code
|
56
63
|
# end
|
57
|
-
|
58
64
|
end
|
59
65
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: queenbee
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Olivier
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-06-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -128,12 +128,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
128
128
|
version: '0'
|
129
129
|
requirements: []
|
130
130
|
rubyforge_project:
|
131
|
-
rubygems_version: 2.6
|
131
|
+
rubygems_version: 2.7.6
|
132
132
|
signing_key:
|
133
133
|
specification_version: 4
|
134
134
|
summary: Gem to send e-commerce orders to the Queenbee central app.
|
135
135
|
test_files:
|
136
|
-
- test/queenbee/event_test.rb
|
137
136
|
- test/queenbee/metrics_test.rb
|
138
137
|
- test/queenbee/order_test.rb
|
138
|
+
- test/queenbee/event_test.rb
|
139
139
|
- test/test_helper.rb
|