yt 0.32.6 → 0.33.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rspec +1 -4
- data/CHANGELOG.md +19 -0
- data/README.md +22 -32
- data/YOUTUBE_IT.md +4 -4
- data/lib/yt.rb +0 -1
- data/lib/yt/associations/has_reports.rb +9 -14
- data/lib/yt/collections/reports.rb +5 -7
- data/lib/yt/models/resource.rb +69 -3
- data/lib/yt/models/url.rb +2 -60
- data/lib/yt/request.rb +6 -2
- data/lib/yt/version.rb +1 -1
- data/yt.gemspec +5 -2
- metadata +31 -169
- data/spec/collections/claims_spec.rb +0 -62
- data/spec/collections/comment_threads_spec.rb +0 -46
- data/spec/collections/playlist_items_spec.rb +0 -44
- data/spec/collections/playlists_spec.rb +0 -27
- data/spec/collections/policies_spec.rb +0 -30
- data/spec/collections/references_spec.rb +0 -30
- data/spec/collections/reports_spec.rb +0 -30
- data/spec/collections/subscriptions_spec.rb +0 -25
- data/spec/collections/videos_spec.rb +0 -43
- data/spec/constants/geography_spec.rb +0 -16
- data/spec/errors/forbidden_spec.rb +0 -10
- data/spec/errors/missing_auth_spec.rb +0 -24
- data/spec/errors/no_items_spec.rb +0 -10
- data/spec/errors/request_error_spec.rb +0 -44
- data/spec/errors/server_error_spec.rb +0 -10
- data/spec/errors/unauthorized_spec.rb +0 -10
- data/spec/models/account_spec.rb +0 -138
- data/spec/models/annotation_spec.rb +0 -180
- data/spec/models/asset_spec.rb +0 -32
- data/spec/models/channel_spec.rb +0 -127
- data/spec/models/claim_event_spec.rb +0 -62
- data/spec/models/claim_history_spec.rb +0 -27
- data/spec/models/claim_spec.rb +0 -223
- data/spec/models/comment_spec.rb +0 -40
- data/spec/models/comment_thread_spec.rb +0 -93
- data/spec/models/configuration_spec.rb +0 -44
- data/spec/models/content_detail_spec.rb +0 -52
- data/spec/models/content_owner_detail_spec.rb +0 -6
- data/spec/models/file_detail_spec.rb +0 -13
- data/spec/models/live_streaming_detail_spec.rb +0 -6
- data/spec/models/ownership_spec.rb +0 -59
- data/spec/models/player_spec.rb +0 -13
- data/spec/models/playlist_item_spec.rb +0 -120
- data/spec/models/playlist_spec.rb +0 -138
- data/spec/models/policy_rule_spec.rb +0 -63
- data/spec/models/policy_spec.rb +0 -41
- data/spec/models/rating_spec.rb +0 -12
- data/spec/models/reference_spec.rb +0 -249
- data/spec/models/request_spec.rb +0 -204
- data/spec/models/resource_spec.rb +0 -42
- data/spec/models/right_owner_spec.rb +0 -71
- data/spec/models/snippet_spec.rb +0 -13
- data/spec/models/statistics_set_spec.rb +0 -13
- data/spec/models/status_spec.rb +0 -13
- data/spec/models/subscription_spec.rb +0 -30
- data/spec/models/url_spec.rb +0 -78
- data/spec/models/video_category_spec.rb +0 -21
- data/spec/models/video_spec.rb +0 -669
- data/spec/requests/as_account/account_spec.rb +0 -143
- data/spec/requests/as_account/authentications_spec.rb +0 -127
- data/spec/requests/as_account/channel_spec.rb +0 -246
- data/spec/requests/as_account/channels_spec.rb +0 -18
- data/spec/requests/as_account/playlist_item_spec.rb +0 -55
- data/spec/requests/as_account/playlist_spec.rb +0 -218
- data/spec/requests/as_account/thumbnail.jpg +0 -0
- data/spec/requests/as_account/video.mp4 +0 -0
- data/spec/requests/as_account/video_spec.rb +0 -408
- data/spec/requests/as_content_owner/account_spec.rb +0 -29
- data/spec/requests/as_content_owner/advertising_options_set_spec.rb +0 -15
- data/spec/requests/as_content_owner/asset_spec.rb +0 -31
- data/spec/requests/as_content_owner/bulk_report_job_spec.rb +0 -19
- data/spec/requests/as_content_owner/channel_spec.rb +0 -1836
- data/spec/requests/as_content_owner/claim_history_spec.rb +0 -20
- data/spec/requests/as_content_owner/claim_spec.rb +0 -17
- data/spec/requests/as_content_owner/content_owner_spec.rb +0 -370
- data/spec/requests/as_content_owner/match_policy_spec.rb +0 -17
- data/spec/requests/as_content_owner/ownership_spec.rb +0 -25
- data/spec/requests/as_content_owner/playlist_spec.rb +0 -767
- data/spec/requests/as_content_owner/video_group_spec.rb +0 -112
- data/spec/requests/as_content_owner/video_spec.rb +0 -1223
- data/spec/requests/as_server_app/channel_spec.rb +0 -54
- data/spec/requests/as_server_app/comment_spec.rb +0 -22
- data/spec/requests/as_server_app/comment_thread_spec.rb +0 -27
- data/spec/requests/as_server_app/comment_threads_spec.rb +0 -41
- data/spec/requests/as_server_app/playlist_item_spec.rb +0 -30
- data/spec/requests/as_server_app/playlist_spec.rb +0 -33
- data/spec/requests/as_server_app/url_spec.rb +0 -94
- data/spec/requests/as_server_app/video_spec.rb +0 -60
- data/spec/requests/as_server_app/videos_spec.rb +0 -40
- data/spec/requests/unauthenticated/video_spec.rb +0 -14
- data/spec/spec_helper.rb +0 -20
- data/spec/support/fail_matcher.rb +0 -15
- data/spec/support/global_hooks.rb +0 -48
@@ -1,138 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'yt/models/playlist'
|
3
|
-
|
4
|
-
describe Yt::Playlist do
|
5
|
-
subject(:playlist) { Yt::Playlist.new attrs }
|
6
|
-
|
7
|
-
|
8
|
-
describe '#title' do
|
9
|
-
context 'given a snippet with a title' do
|
10
|
-
let(:attrs) { {snippet: {"title"=>"Fullscreen"}} }
|
11
|
-
it { expect(playlist.title).to eq 'Fullscreen' }
|
12
|
-
end
|
13
|
-
|
14
|
-
context 'given a snippet without a title' do
|
15
|
-
let(:attrs) { {snippet: {}} }
|
16
|
-
it { expect(playlist.title).to eq '' }
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
describe '#published_at' do
|
21
|
-
context 'given a snippet with a timestamp' do # always returned by YouTube
|
22
|
-
let(:attrs) { {snippet: {"publishedAt"=>"2014-04-22T19:14:49.000Z"}} }
|
23
|
-
it { expect(playlist.published_at.year).to be 2014 }
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
describe '#description' do
|
28
|
-
context 'given a snippet with a description' do
|
29
|
-
let(:attrs) { {snippet: {"description"=>"The first media company for the connected generation."}} }
|
30
|
-
it { expect(playlist.description).to eq 'The first media company for the connected generation.' }
|
31
|
-
end
|
32
|
-
|
33
|
-
context 'given a snippet without a description' do
|
34
|
-
let(:attrs) { {snippet: {}} }
|
35
|
-
it { expect(playlist.description).to eq '' }
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
describe '#tags' do
|
40
|
-
context 'given a snippet with tags' do
|
41
|
-
let(:attrs) { {snippet: {"tags"=>["promotion", "new media"]}} }
|
42
|
-
it { expect(playlist.tags).to eq ["promotion", "new media"] }
|
43
|
-
end
|
44
|
-
|
45
|
-
context 'given a snippet without tags' do
|
46
|
-
let(:attrs) { {snippet: {}} }
|
47
|
-
it { expect(playlist.tags).to eq [] }
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
describe '#thumbnail_url' do
|
52
|
-
context 'given a snippet with thumbnails' do
|
53
|
-
let(:attrs) { {snippet: {"thumbnails"=>{
|
54
|
-
"default"=>{"url"=> "http://example.com/88x88.jpg"},
|
55
|
-
"medium"=>{"url"=> "http://example.com/240x240.jpg"},
|
56
|
-
}}} }
|
57
|
-
it { expect(playlist.thumbnail_url).to eq 'http://example.com/88x88.jpg' }
|
58
|
-
it { expect(playlist.thumbnail_url 'default').to eq 'http://example.com/88x88.jpg' }
|
59
|
-
it { expect(playlist.thumbnail_url :default).to eq 'http://example.com/88x88.jpg' }
|
60
|
-
it { expect(playlist.thumbnail_url :medium).to eq 'http://example.com/240x240.jpg' }
|
61
|
-
it { expect(playlist.thumbnail_url :large).to be_nil }
|
62
|
-
end
|
63
|
-
|
64
|
-
context 'given a snippet without thumbnails' do
|
65
|
-
let(:attrs) { {snippet: {}} }
|
66
|
-
it { expect(playlist.thumbnail_url).to be_nil }
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
describe '#channel_id' do
|
71
|
-
context 'given a snippet with a channel ID' do
|
72
|
-
let(:attrs) { {snippet: {"channelId"=>"UCxO1tY8h1AhOz0T4ENwmpow"}} }
|
73
|
-
it { expect(playlist.channel_id).to eq 'UCxO1tY8h1AhOz0T4ENwmpow' }
|
74
|
-
end
|
75
|
-
|
76
|
-
context 'given a snippet without a channel ID' do
|
77
|
-
let(:attrs) { {snippet: {}} }
|
78
|
-
it { expect(playlist.channel_id).to be_nil }
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
describe '#channel_title' do
|
83
|
-
context 'given a snippet with a channel title' do
|
84
|
-
let(:attrs) { {snippet: {"channelTitle"=>"Fullscreen"}} }
|
85
|
-
it { expect(playlist.channel_title).to eq 'Fullscreen' }
|
86
|
-
end
|
87
|
-
|
88
|
-
context 'given a snippet without a channel title' do
|
89
|
-
let(:attrs) { {snippet: {}} }
|
90
|
-
it { expect(playlist.channel_title).to be_nil }
|
91
|
-
end
|
92
|
-
end
|
93
|
-
|
94
|
-
describe '#exists?' do
|
95
|
-
context 'given a playlist with an id' do
|
96
|
-
let(:attrs) { {id: 'PLSWYkYzOr'} }
|
97
|
-
it { expect(playlist).to exist }
|
98
|
-
end
|
99
|
-
|
100
|
-
context 'given a playlist without an id' do
|
101
|
-
let(:attrs) { {} }
|
102
|
-
it { expect(playlist).not_to exist }
|
103
|
-
end
|
104
|
-
end
|
105
|
-
|
106
|
-
describe '#snippet' do
|
107
|
-
context 'given fetching a playlist returns a snippet' do
|
108
|
-
let(:attrs) { {snippet: {"title"=>"Fullscreen"}} }
|
109
|
-
it { expect(playlist.snippet).to be_a Yt::Snippet }
|
110
|
-
end
|
111
|
-
end
|
112
|
-
|
113
|
-
describe '#status' do
|
114
|
-
context 'given fetching a playlist returns a status' do
|
115
|
-
let(:attrs) { {status: {"privacyStatus"=>"public"}} }
|
116
|
-
it { expect(playlist.status).to be_a Yt::Status }
|
117
|
-
end
|
118
|
-
end
|
119
|
-
|
120
|
-
describe '#update' do
|
121
|
-
let(:attrs) { {id: 'PLSWYkYzOr', snippet: {'title'=>'old'}, status: {"privacyStatus"=>"public"}} }
|
122
|
-
before { expect(playlist).to receive(:do_update).and_yield 'snippet'=>{'title'=>'new'} }
|
123
|
-
|
124
|
-
it { expect(playlist.update title: 'new').to be true }
|
125
|
-
it { expect{playlist.update title: 'new'}.to change{playlist.title} }
|
126
|
-
end
|
127
|
-
|
128
|
-
describe '#delete' do
|
129
|
-
let(:attrs) { {id: 'PLSWYkYzOr'} }
|
130
|
-
|
131
|
-
context 'given an existing playlist' do
|
132
|
-
before { expect(playlist).to receive(:do_delete).and_yield }
|
133
|
-
|
134
|
-
it { expect(playlist.delete).to be true }
|
135
|
-
it { expect{playlist.delete}.to change{playlist.exists?} }
|
136
|
-
end
|
137
|
-
end
|
138
|
-
end
|
@@ -1,63 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'yt/models/policy_rule'
|
3
|
-
|
4
|
-
describe Yt::PolicyRule do
|
5
|
-
subject(:policy_rule) { Yt::PolicyRule.new data: data }
|
6
|
-
|
7
|
-
describe '#action' do
|
8
|
-
context 'given fetching a policy rule returns an action' do
|
9
|
-
let(:data) { {"action"=>"takedown"} }
|
10
|
-
it { expect(policy_rule.action).to eq 'takedown' }
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
describe '#subaction' do
|
15
|
-
context 'given fetching a policy rule returns a subaction' do
|
16
|
-
let(:data) { {"subaction"=>"review"} }
|
17
|
-
it { expect(policy_rule.subaction).to eq 'review' }
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
describe '#included_territories' do
|
22
|
-
context 'given fetching a policy rule returns included territories' do
|
23
|
-
let(:data) { {"conditions"=>{"requiredTerritories"=>{"type"=>"include", "territories"=>["US", "CA"]}}} }
|
24
|
-
let(:data) { {"conditions"=>{"requiredTerritories"=>{"type"=>"include", "territories"=>["US", "CA"]}}} }
|
25
|
-
it { expect(policy_rule.included_territories).to eq %w(US CA) }
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
describe '#excluded_territories' do
|
30
|
-
context 'given fetching a policy rule returns excluded territories' do
|
31
|
-
let(:data) { {"conditions"=>{"requiredTerritories"=>{"type"=>"exclude", "territories"=>["US", "CA"]}}} }
|
32
|
-
it { expect(policy_rule.excluded_territories).to eq %w(US CA) }
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
describe '#match_duration' do
|
37
|
-
context 'given fetching a policy rule returns a match duration list' do
|
38
|
-
let(:data) { {"conditions"=>{"matchDuration"=>[{"high"=>60.0}]}} }
|
39
|
-
it { expect(policy_rule.match_duration).to match_array [{low: nil, high: 60.0}] }
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
describe '#match_percent' do
|
44
|
-
context 'given fetching a policy rule returns a match percent list' do
|
45
|
-
let(:data) { {"conditions"=>{"matchPercent"=>[{"high"=>60.0}]}} }
|
46
|
-
it { expect(policy_rule.match_percent).to match_array [{low: nil, high: 60.0}] }
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
describe '#reference_duration' do
|
51
|
-
context 'given fetching a policy rule returns a reference duration list' do
|
52
|
-
let(:data) { {"conditions"=>{"referenceDuration"=>[{"low"=>60.0, "high"=>600.0}, {"low"=>20.0, "high"=>30.0}]}} }
|
53
|
-
it { expect(policy_rule.reference_duration).to match_array [{low: 60.0, high: 600.0}, {low: 20.0, high: 30.0}] }
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
describe '#reference_percent' do
|
58
|
-
context 'given fetching a policy rule returns a reference percent list' do
|
59
|
-
let(:data) { {"conditions"=>{"referencePercent"=>[{"low"=>60.0, "high"=>600.0}, {"low"=>20.0, "high"=>30.0}]}} }
|
60
|
-
it { expect(policy_rule.reference_percent).to match_array [{low: 60.0, high: 600.0}, {low: 20.0, high: 30.0}] }
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
data/spec/models/policy_spec.rb
DELETED
@@ -1,41 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'yt/models/policy'
|
3
|
-
|
4
|
-
describe Yt::Policy do
|
5
|
-
subject(:policy) { Yt::Policy.new data: data }
|
6
|
-
|
7
|
-
describe '#id' do
|
8
|
-
context 'given fetching a policy returns an id' do
|
9
|
-
let(:data) { {"id"=>"S123456789"} }
|
10
|
-
it { expect(policy.id).to eq 'S123456789' }
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
describe '#name' do
|
15
|
-
context 'given fetching a policy returns a name' do
|
16
|
-
let(:data) { {"name"=>"Block in all countries"} }
|
17
|
-
it { expect(policy.name).to eq 'Block in all countries' }
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
describe '#description' do
|
22
|
-
context 'given fetching a policy returns a description' do
|
23
|
-
let(:data) { {"description"=>"Block videos in every country"} }
|
24
|
-
it { expect(policy.description).to eq 'Block videos in every country' }
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
describe '#updated_at' do
|
29
|
-
context 'given fetching a policy returns a timeUpdated' do
|
30
|
-
let(:data) { {"timeUpdated"=>"1970-01-16T20:33:03.675Z"} }
|
31
|
-
it { expect(policy.updated_at.year).to be 1970 }
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
describe '#rules' do
|
36
|
-
context 'given fetching a policy returns rules' do
|
37
|
-
let(:data) { {"rules"=>[{"action"=>"track"},{"action"=>"track"}]} }
|
38
|
-
it { expect(policy.rules.size).to be 2 }
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
data/spec/models/rating_spec.rb
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'yt/models/rating'
|
3
|
-
|
4
|
-
describe Yt::Rating do
|
5
|
-
subject(:rating) { Yt::Rating.new }
|
6
|
-
|
7
|
-
describe '#update' do
|
8
|
-
before { expect(rating).to receive(:do_update).and_yield }
|
9
|
-
|
10
|
-
it { expect{rating.set :like}.to change{rating.rating} }
|
11
|
-
end
|
12
|
-
end
|
@@ -1,249 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'yt/models/reference'
|
3
|
-
|
4
|
-
describe Yt::Reference do
|
5
|
-
subject(:reference) { Yt::Reference.new data: data }
|
6
|
-
|
7
|
-
describe '#id' do
|
8
|
-
context 'given fetching a reference returns an id' do
|
9
|
-
let(:data) { {"id"=>"aBcD1EfGHIk"} }
|
10
|
-
it { expect(reference.id).to eq 'aBcD1EfGHIk' }
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
describe '#asset_id' do
|
15
|
-
context 'given fetching a reference returns an assetId' do
|
16
|
-
let(:data) { {"assetId"=>"A123456789012601"} }
|
17
|
-
it { expect(reference.asset_id).to eq 'A123456789012601' }
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
describe '#status' do
|
22
|
-
context 'given fetching a reference returns a status' do
|
23
|
-
let(:data) { {"status"=>"active"} }
|
24
|
-
it { expect(reference.status).to eq 'active' }
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
describe '#activating?' do
|
29
|
-
context 'given fetching a reference returns an activating status' do
|
30
|
-
let(:data) { {"status"=>"activating"} }
|
31
|
-
it { expect(reference).to be_activating }
|
32
|
-
end
|
33
|
-
|
34
|
-
context 'given fetching a reference does not return an activating status' do
|
35
|
-
let(:data) { {"status"=>"unknown"} }
|
36
|
-
it { expect(reference).not_to be_activating }
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
describe '#active?' do
|
41
|
-
context 'given fetching a reference returns an active status' do
|
42
|
-
let(:data) { {"status"=>"active"} }
|
43
|
-
it { expect(reference).to be_active }
|
44
|
-
end
|
45
|
-
|
46
|
-
context 'given fetching a reference does not return an active status' do
|
47
|
-
let(:data) { {"status"=>"unknown"} }
|
48
|
-
it { expect(reference).not_to be_active }
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
describe '#checking?' do
|
53
|
-
context 'given fetching a reference returns an checking status' do
|
54
|
-
let(:data) { {"status"=>"checking"} }
|
55
|
-
it { expect(reference).to be_checking }
|
56
|
-
end
|
57
|
-
|
58
|
-
context 'given fetching a reference does not return an checking status' do
|
59
|
-
let(:data) { {"status"=>"unknown"} }
|
60
|
-
it { expect(reference).not_to be_checking }
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
describe '#computing_fingerprint?' do
|
65
|
-
context 'given fetching a reference returns an computing_fingerprint status' do
|
66
|
-
let(:data) { {"status"=>"computing_fingerprint"} }
|
67
|
-
it { expect(reference).to be_computing_fingerprint }
|
68
|
-
end
|
69
|
-
|
70
|
-
context 'given fetching a reference does not return an computing_fingerprint status' do
|
71
|
-
let(:data) { {"status"=>"unknown"} }
|
72
|
-
it { expect(reference).not_to be_computing_fingerprint }
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
describe '#deleted?' do
|
77
|
-
context 'given fetching a reference returns an deleted status' do
|
78
|
-
let(:data) { {"status"=>"deleted"} }
|
79
|
-
it { expect(reference).to be_deleted }
|
80
|
-
end
|
81
|
-
|
82
|
-
context 'given fetching a reference does not return an deleted status' do
|
83
|
-
let(:data) { {"status"=>"unknown"} }
|
84
|
-
it { expect(reference).not_to be_deleted }
|
85
|
-
end
|
86
|
-
end
|
87
|
-
|
88
|
-
describe '#duplicate_on_hold?' do
|
89
|
-
context 'given fetching a reference returns an duplicate_on_hold status' do
|
90
|
-
let(:data) { {"status"=>"duplicate_on_hold"} }
|
91
|
-
it { expect(reference).to be_duplicate_on_hold }
|
92
|
-
end
|
93
|
-
|
94
|
-
context 'given fetching a reference does not return an duplicate_on_hold status' do
|
95
|
-
let(:data) { {"status"=>"unknown"} }
|
96
|
-
it { expect(reference).not_to be_duplicate_on_hold }
|
97
|
-
end
|
98
|
-
end
|
99
|
-
|
100
|
-
describe '#inactive?' do
|
101
|
-
context 'given fetching a reference returns an inactive status' do
|
102
|
-
let(:data) { {"status"=>"inactive"} }
|
103
|
-
it { expect(reference).to be_inactive }
|
104
|
-
end
|
105
|
-
|
106
|
-
context 'given fetching a reference does not return an inactive status' do
|
107
|
-
let(:data) { {"status"=>"unknown"} }
|
108
|
-
it { expect(reference).not_to be_inactive }
|
109
|
-
end
|
110
|
-
end
|
111
|
-
|
112
|
-
describe '#live_streaming_processing?' do
|
113
|
-
context 'given fetching a reference returns an live_streaming_processing status' do
|
114
|
-
let(:data) { {"status"=>"live_streaming_processing"} }
|
115
|
-
it { expect(reference).to be_live_streaming_processing }
|
116
|
-
end
|
117
|
-
|
118
|
-
context 'given fetching a reference does not return an live_streaming_processing status' do
|
119
|
-
let(:data) { {"status"=>"unknown"} }
|
120
|
-
it { expect(reference).not_to be_live_streaming_processing }
|
121
|
-
end
|
122
|
-
end
|
123
|
-
|
124
|
-
describe '#urgent_reference_processing?' do
|
125
|
-
context 'given fetching a reference returns an urgent_reference_processing status' do
|
126
|
-
let(:data) { {"status"=>"urgent_reference_processing"} }
|
127
|
-
it { expect(reference).to be_urgent_reference_processing }
|
128
|
-
end
|
129
|
-
|
130
|
-
context 'given fetching a reference does not return an urgent_reference_processing status' do
|
131
|
-
let(:data) { {"status"=>"unknown"} }
|
132
|
-
it { expect(reference).not_to be_urgent_reference_processing }
|
133
|
-
end
|
134
|
-
end
|
135
|
-
|
136
|
-
describe '#status_reason' do
|
137
|
-
context 'given fetching a reference returns a statusReason' do
|
138
|
-
let(:data) { {"statusReason"=>"explanation"} }
|
139
|
-
it { expect(reference.status_reason).to eq 'explanation' }
|
140
|
-
end
|
141
|
-
end
|
142
|
-
|
143
|
-
describe '#duplicate_leader' do
|
144
|
-
context 'given fetching a reference returns a duplicateLeader' do
|
145
|
-
let(:data) { {"duplicateLeader"=>"123456"} }
|
146
|
-
it { expect(reference.duplicate_leader).to eq '123456' }
|
147
|
-
end
|
148
|
-
end
|
149
|
-
|
150
|
-
describe '#length' do
|
151
|
-
context 'given fetching a reference returns a length' do
|
152
|
-
let(:data) { {"length"=>354.66} }
|
153
|
-
it { expect(reference.length).to eq 354.66 }
|
154
|
-
end
|
155
|
-
end
|
156
|
-
|
157
|
-
describe '#video_id' do
|
158
|
-
context 'given fetching a reference returns an videoId' do
|
159
|
-
let(:data) { {"videoId"=>"9bZkp7q19f0"} }
|
160
|
-
it { expect(reference.video_id).to eq '9bZkp7q19f0' }
|
161
|
-
end
|
162
|
-
end
|
163
|
-
|
164
|
-
describe '#claim_id' do
|
165
|
-
context 'given fetching a reference returns an claimId' do
|
166
|
-
let(:data) { {"claimId"=>"aBcD1EfGHIk"} }
|
167
|
-
it { expect(reference.claim_id).to eq 'aBcD1EfGHIk' }
|
168
|
-
end
|
169
|
-
end
|
170
|
-
|
171
|
-
describe '#urgent?' do
|
172
|
-
context 'given fetching a reference returns an urgent status true' do
|
173
|
-
let(:data) { {"urgent"=>true} }
|
174
|
-
it { expect(reference).to be_urgent }
|
175
|
-
end
|
176
|
-
|
177
|
-
context 'given fetching a reference returns an urgent status false' do
|
178
|
-
let(:data) { {"urgent"=>false} }
|
179
|
-
it { expect(reference).not_to be_urgent }
|
180
|
-
end
|
181
|
-
end
|
182
|
-
|
183
|
-
describe '#content_type' do
|
184
|
-
context 'given fetching a reference returns a content type' do
|
185
|
-
let(:data) { {"contentType"=>"audio"} }
|
186
|
-
it { expect(reference.content_type).to eq 'audio' }
|
187
|
-
end
|
188
|
-
end
|
189
|
-
|
190
|
-
describe '#audio?' do
|
191
|
-
context 'given fetching a reference returns an audio content type' do
|
192
|
-
let(:data) { {"contentType"=>"audio"} }
|
193
|
-
it { expect(reference).to be_audio }
|
194
|
-
end
|
195
|
-
|
196
|
-
context 'given fetching a reference does not return an audio content type' do
|
197
|
-
let(:data) { {"contentType"=>"audiovisual"} }
|
198
|
-
it { expect(reference).not_to be_audio }
|
199
|
-
end
|
200
|
-
end
|
201
|
-
|
202
|
-
describe '#video?' do
|
203
|
-
context 'given fetching a reference returns an video content type' do
|
204
|
-
let(:data) { {"contentType"=>"video"} }
|
205
|
-
it { expect(reference).to be_video }
|
206
|
-
end
|
207
|
-
|
208
|
-
context 'given fetching a reference does not return an video content type' do
|
209
|
-
let(:data) { {"contentType"=>"audiovisual"} }
|
210
|
-
it { expect(reference).not_to be_video }
|
211
|
-
end
|
212
|
-
end
|
213
|
-
|
214
|
-
describe '#audiovisual?' do
|
215
|
-
context 'given fetching a reference returns an audiovisual content type' do
|
216
|
-
let(:data) { {"contentType"=>"audiovisual"} }
|
217
|
-
it { expect(reference).to be_audiovisual }
|
218
|
-
end
|
219
|
-
|
220
|
-
context 'given fetching a reference does not return an audiovisual content type' do
|
221
|
-
let(:data) { {"contentType"=>"audio"} }
|
222
|
-
it { expect(reference).not_to be_audiovisual }
|
223
|
-
end
|
224
|
-
end
|
225
|
-
|
226
|
-
describe '#audioswap_enabled?' do
|
227
|
-
context 'given fetching a reference returns audioswapEnabled true' do
|
228
|
-
let(:data) { {"audioswapEnabled"=>true} }
|
229
|
-
it { expect(reference).to be_audioswap_enabled }
|
230
|
-
end
|
231
|
-
|
232
|
-
context 'given fetching a reference returns audioswapEnabled false' do
|
233
|
-
let(:data) { {"audioswap_enabled"=>false} }
|
234
|
-
it { expect(reference).not_to be_audioswap_enabled }
|
235
|
-
end
|
236
|
-
end
|
237
|
-
|
238
|
-
describe '#ignore_fp_match?' do
|
239
|
-
context 'given fetching a reference returns ignoreFpMatch true' do
|
240
|
-
let(:data) { {"ignoreFpMatch"=>true} }
|
241
|
-
it { expect(reference.ignore_fp_match?).to be true }
|
242
|
-
end
|
243
|
-
|
244
|
-
context 'given fetching a reference returns ignoreFpMatch false' do
|
245
|
-
let(:data) { {"ignoreFpMatch"=>false} }
|
246
|
-
it { expect(reference.ignore_fp_match?).to be false }
|
247
|
-
end
|
248
|
-
end
|
249
|
-
end
|