-
Notifications
You must be signed in to change notification settings - Fork 161
Expand file tree
/
Copy pathplaylists_spec.rb
More file actions
42 lines (32 loc) · 1.15 KB
/
playlists_spec.rb
File metadata and controls
42 lines (32 loc) · 1.15 KB
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
33
34
35
36
37
38
39
40
41
42
require 'spec_helper'
require 'yt/collections/playlists'
describe Yt::Collections::Playlists do
subject(:collection) { Yt::Collections::Playlists.new }
before { expect(collection).to behave }
describe '#insert' do
let(:playlist) { Yt::Playlist.new }
# TODO: separate stubs to show options translate into do_insert params
let(:behave) { receive(:do_insert).and_return playlist }
it { expect(collection.insert).to eq playlist }
end
describe '#delete_all' do
let(:behave) { receive(:do_delete_all).and_return [true] }
it { expect(collection.delete_all).to eq [true] }
end
describe '#delete_all' do
let(:behave) { receive(:do_delete_all).and_return [true] }
it { expect(collection.delete_all).to eq [true] }
end
describe '#etag' do
let(:etag) { 'etag123' }
let(:behave) { receive(:fetch_etag).and_call_original }
before do
expect_any_instance_of(Yt::Request).to receive(:run).once do
double(body: {'etag'=> etag, 'items'=> [], 'pageInfo'=> {'totalResults'=>0}})
end
end
it 'returns the etag from the list response' do
expect(collection.etag).to eq etag
end
end
end