barker 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/barker/api/response/game_show.rb +5 -1
- data/lib/barker/api/response/joker.rb +19 -0
- data/lib/barker/api/response.rb +1 -0
- data/lib/barker/joker.rb +4 -0
- data/lib/barker/version.rb +1 -1
- data/test/unit/api/response/game_show_test.rb +2 -1
- data/test/unit/api/response/joker_test.rb +56 -0
- metadata +4 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4bf2da58c1e96e4df0a94d949c7ff4c707c6b5e0
|
4
|
+
data.tar.gz: cc809a8256703900766ce90aa96639c91fe05ba7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 52f937800cdcb5bbda1f66ad9909a3c8871ab6dfbbe8ac80b2b871af1552c1880bd6397e0168a2e320a3fc11002b54531a23753b0e29b4388055a63e808f520a
|
7
|
+
data.tar.gz: 6fd93f9fd4d3821084f1da8ef2bd40272cce9fafb1c5b0d64fa800b5e60b8be7bc2304ad4b56f69d1d57553582a76e36c6d968a217b15bcda0cc4438e470a330
|
data/Gemfile.lock
CHANGED
@@ -14,12 +14,16 @@ module Barker
|
|
14
14
|
game_show.rounds.map {|round| Response::Round.new(:round => round)}
|
15
15
|
end
|
16
16
|
|
17
|
+
def jokers
|
18
|
+
game_show.jokers.map {|joker| Response::Joker.new(:joker => joker)}
|
19
|
+
end
|
20
|
+
|
17
21
|
def to_hash
|
18
22
|
{
|
19
23
|
'id' => id,
|
20
24
|
'game_show_id' => game_show_id,
|
21
|
-
'joker_ids' => joker_ids,
|
22
25
|
'jokers' => jokers.map(&:to_hash),
|
26
|
+
'joker_ids' => joker_ids,
|
23
27
|
'started_at' => to_i(started_at),
|
24
28
|
'finished_at' => to_i(finished_at),
|
25
29
|
'aborted_at' => to_i(aborted_at),
|
data/lib/barker/api/response.rb
CHANGED
@@ -2,6 +2,7 @@ require 'barker/api/response/base'
|
|
2
2
|
require 'barker/api/response/error'
|
3
3
|
require 'barker/api/response/game_show'
|
4
4
|
require 'barker/api/response/round'
|
5
|
+
require 'barker/api/response/joker'
|
5
6
|
require 'barker/api/response/candidate'
|
6
7
|
require 'barker/api/response/candidate_question'
|
7
8
|
require 'barker/api/response/candidate_answer'
|
data/lib/barker/joker.rb
CHANGED
data/lib/barker/version.rb
CHANGED
@@ -34,7 +34,6 @@ module Barker
|
|
34
34
|
assert result.has_key? 'id'
|
35
35
|
assert result.has_key? 'game_show_id'
|
36
36
|
assert result.has_key? 'joker_ids'
|
37
|
-
assert result.has_key? 'jokers'
|
38
37
|
assert result.has_key? 'started_at'
|
39
38
|
assert result.has_key? 'finished_at'
|
40
39
|
assert result.has_key? 'aborted_at'
|
@@ -55,6 +54,8 @@ module Barker
|
|
55
54
|
|
56
55
|
assert_kind_of Array, result['rounds']
|
57
56
|
assert_kind_of Hash, result['rounds'][0]
|
57
|
+
|
58
|
+
assert_kind_of Array, result['jokers']
|
58
59
|
end
|
59
60
|
|
60
61
|
test "delegate" do
|
@@ -0,0 +1,56 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module Barker
|
4
|
+
module Api
|
5
|
+
module Response
|
6
|
+
class JokerTest < Spec
|
7
|
+
|
8
|
+
test "instance" do
|
9
|
+
assert_kind_of Barker::Api::Response::Joker, klass.new
|
10
|
+
end
|
11
|
+
|
12
|
+
test "inherit from base" do
|
13
|
+
assert klass < Barker::Api::Response::Base
|
14
|
+
end
|
15
|
+
|
16
|
+
test "joker" do
|
17
|
+
assert_equal joker, subject.joker
|
18
|
+
end
|
19
|
+
|
20
|
+
test "delegate" do
|
21
|
+
assert_delegate :id
|
22
|
+
assert_delegate :joker_id
|
23
|
+
end
|
24
|
+
|
25
|
+
test "to_hash" do
|
26
|
+
result = subject.to_hash
|
27
|
+
assert_kind_of Hash, result
|
28
|
+
|
29
|
+
assert result.has_key? 'id'
|
30
|
+
assert result.has_key? 'joker_id'
|
31
|
+
end
|
32
|
+
|
33
|
+
private
|
34
|
+
|
35
|
+
def assert_delegate(method)
|
36
|
+
assert joker.respond_to?(method), "Joker should respond to #{method}"
|
37
|
+
assert subject.respond_to?(method), "Response::Joker should respond to #{method}"
|
38
|
+
assert_equal joker.send(method), subject.send(method), "Joker##{method} != Response::Joker##{method}"
|
39
|
+
end
|
40
|
+
|
41
|
+
def klass
|
42
|
+
Barker::Api::Response::Joker
|
43
|
+
end
|
44
|
+
|
45
|
+
def subject
|
46
|
+
klass.new(:joker => joker)
|
47
|
+
end
|
48
|
+
|
49
|
+
def joker
|
50
|
+
@joker ||= FactoryGirl.build :joker
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: barker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Owiesniak
|
@@ -152,6 +152,7 @@ files:
|
|
152
152
|
- lib/barker/api/response/candidate_question.rb
|
153
153
|
- lib/barker/api/response/error.rb
|
154
154
|
- lib/barker/api/response/game_show.rb
|
155
|
+
- lib/barker/api/response/joker.rb
|
155
156
|
- lib/barker/api/response/round.rb
|
156
157
|
- lib/barker/candidate.rb
|
157
158
|
- lib/barker/candidate_answer.rb
|
@@ -202,6 +203,7 @@ files:
|
|
202
203
|
- test/unit/api/response/candidate_question_test.rb
|
203
204
|
- test/unit/api/response/candidate_test.rb
|
204
205
|
- test/unit/api/response/game_show_test.rb
|
206
|
+
- test/unit/api/response/joker_test.rb
|
205
207
|
- test/unit/api/response/round_test.rb
|
206
208
|
- test/unit/candidate_answer_test.rb
|
207
209
|
- test/unit/candidate_question_test.rb
|
@@ -265,6 +267,7 @@ test_files:
|
|
265
267
|
- test/unit/api/response/candidate_question_test.rb
|
266
268
|
- test/unit/api/response/candidate_test.rb
|
267
269
|
- test/unit/api/response/game_show_test.rb
|
270
|
+
- test/unit/api/response/joker_test.rb
|
268
271
|
- test/unit/api/response/round_test.rb
|
269
272
|
- test/unit/candidate_answer_test.rb
|
270
273
|
- test/unit/candidate_question_test.rb
|