-
Notifications
You must be signed in to change notification settings - Fork 159
/
Copy pathasset_spec.rb
32 lines (28 loc) · 1.04 KB
/
asset_spec.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
require 'spec_helper'
require 'yt/models/asset'
describe Yt::Asset do
subject(:asset) { Yt::Asset.new data: data }
describe '#id' do
context 'given fetching a asset returns an id' do
let(:data) { {"id"=>"A123456789012345"} }
it { expect(asset.id).to eq 'A123456789012345' }
end
end
describe '#type' do
context 'given fetching a asset returns an type' do
let(:data) { {"type"=>"web"} }
it { expect(asset.type).to eq 'web' }
end
end
describe '#ownership_effective' do
context 'given fetching a asset returns an ownershipEffective' do
let(:data) {
{"ownershipEffective"=>{"kind"=>"youtubePartner#rightsOwnership",
"general"=>[{"ratio"=>100.0, "owner"=>"XOuN81q-MeEUVrsiZeK1lQ", "type"=>"exclude"}]}}
}
it { expect(asset.ownership_effective).to be_a Yt::Ownership }
it { expect(asset.ownership_effective.general_owners.first).to be_a Yt::RightOwner }
it { expect(asset.ownership_effective.general_owners.first.owner).to eq "XOuN81q-MeEUVrsiZeK1lQ" }
end
end
end