hallon 0.11.0 → 0.12.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.yardopts +1 -0
- data/{CHANGELOG → CHANGELOG.md} +82 -27
- data/Gemfile +1 -0
- data/README.markdown +1 -1
- data/Rakefile +8 -6
- data/examples/adding_tracks_to_playlist.rb +3 -0
- data/examples/logging_in.rb +3 -0
- data/examples/playing_audio.rb +130 -0
- data/examples/printing_link_information.rb +3 -0
- data/examples/show_published_playlists_of_user.rb +5 -13
- data/hallon.gemspec +2 -2
- data/lib/hallon.rb +15 -0
- data/lib/hallon/album.rb +1 -1
- data/lib/hallon/album_browse.rb +4 -3
- data/lib/hallon/artist.rb +1 -1
- data/lib/hallon/artist_browse.rb +5 -4
- data/lib/hallon/base.rb +7 -2
- data/lib/hallon/error.rb +1 -1
- data/lib/hallon/ext/spotify.rb +26 -42
- data/lib/hallon/image.rb +7 -8
- data/lib/hallon/observable.rb +134 -62
- data/lib/hallon/observable/album_browse.rb +30 -0
- data/lib/hallon/observable/artist_browse.rb +31 -0
- data/lib/hallon/observable/image.rb +31 -0
- data/lib/hallon/observable/player.rb +13 -0
- data/lib/hallon/observable/playlist.rb +194 -0
- data/lib/hallon/observable/playlist_container.rb +74 -0
- data/lib/hallon/observable/post.rb +30 -0
- data/lib/hallon/observable/search.rb +29 -0
- data/lib/hallon/observable/session.rb +236 -0
- data/lib/hallon/observable/toplist.rb +30 -0
- data/lib/hallon/player.rb +8 -17
- data/lib/hallon/playlist.rb +11 -7
- data/lib/hallon/playlist_container.rb +11 -4
- data/lib/hallon/queue.rb +71 -0
- data/lib/hallon/search.rb +10 -7
- data/lib/hallon/session.rb +18 -21
- data/lib/hallon/toplist.rb +4 -3
- data/lib/hallon/user.rb +5 -5
- data/lib/hallon/version.rb +1 -1
- data/spec/hallon/album_browse_spec.rb +4 -0
- data/spec/hallon/artist_browse_spec.rb +4 -0
- data/spec/hallon/base_spec.rb +26 -9
- data/spec/hallon/hallon_spec.rb +0 -18
- data/spec/hallon/image_spec.rb +0 -1
- data/spec/hallon/link_spec.rb +14 -0
- data/spec/hallon/observable/album_browse_spec.rb +7 -0
- data/spec/hallon/observable/artist_browse_spec.rb +7 -0
- data/spec/hallon/observable/image_spec.rb +8 -0
- data/spec/hallon/observable/playlist_container_spec.rb +21 -0
- data/spec/hallon/observable/playlist_spec.rb +85 -0
- data/spec/hallon/observable/post_spec.rb +8 -0
- data/spec/hallon/observable/search_spec.rb +7 -0
- data/spec/hallon/observable/session_spec.rb +143 -0
- data/spec/hallon/observable/toplist_spec.rb +7 -0
- data/spec/hallon/observable_spec.rb +134 -65
- data/spec/hallon/playlist_container_spec.rb +24 -18
- data/spec/hallon/playlist_spec.rb +2 -0
- data/spec/hallon/queue_spec.rb +35 -0
- data/spec/hallon/session_spec.rb +4 -4
- data/spec/hallon/spotify_spec.rb +35 -9
- data/spec/mockspotify.rb +2 -3
- data/spec/spec_helper.rb +0 -1
- data/spec/support/common_objects.rb +27 -15
- data/spec/support/enumerable_comparison.rb +9 -0
- data/spec/support/shared_for_callbacks.rb +60 -0
- data/spec/support/shared_for_linkable_objects.rb +1 -1
- metadata +56 -20
@@ -6,7 +6,7 @@ describe Hallon::PlaylistContainer do
|
|
6
6
|
|
7
7
|
it { should be_loaded }
|
8
8
|
its(:owner) { should eq Hallon::User.new("burgestrand") }
|
9
|
-
its(:size) { should eq
|
9
|
+
its(:size) { should eq 4 }
|
10
10
|
|
11
11
|
describe "#add" do
|
12
12
|
context "given a string that’s not a valid spotify playlist uri" do
|
@@ -100,15 +100,15 @@ describe Hallon::PlaylistContainer do
|
|
100
100
|
end
|
101
101
|
|
102
102
|
it "should remove the matching :end_folder if removing a :start_folder" do
|
103
|
-
container.contents.map(&:class).should eq [Hallon::Playlist, Hallon::PlaylistContainer::Folder, Hallon::PlaylistContainer::Folder]
|
103
|
+
container.contents.map(&:class).should eq [Hallon::Playlist, Hallon::PlaylistContainer::Folder, Hallon::Playlist, Hallon::PlaylistContainer::Folder]
|
104
104
|
expect { container.remove(1) }.to change { container.size }.by(-2)
|
105
|
-
container.contents.map(&:class).should eq [Hallon::Playlist]
|
105
|
+
container.contents.map(&:class).should eq [Hallon::Playlist, Hallon::Playlist]
|
106
106
|
end
|
107
107
|
|
108
108
|
it "should remove the matching :start_folder if removing a :end_folder" do
|
109
|
-
container.contents.map(&:class).should eq [Hallon::Playlist, Hallon::PlaylistContainer::Folder, Hallon::PlaylistContainer::Folder]
|
110
|
-
expect { container.remove(
|
111
|
-
container.contents.map(&:class).should eq [Hallon::Playlist]
|
109
|
+
container.contents.map(&:class).should eq [Hallon::Playlist, Hallon::PlaylistContainer::Folder, Hallon::Playlist, Hallon::PlaylistContainer::Folder]
|
110
|
+
expect { container.remove(3) }.to change { container.size }.by(-2)
|
111
|
+
container.contents.map(&:class).should eq [Hallon::Playlist, Hallon::Playlist]
|
112
112
|
end
|
113
113
|
|
114
114
|
it "should raise an error if the index is out of range" do
|
@@ -118,13 +118,17 @@ describe Hallon::PlaylistContainer do
|
|
118
118
|
|
119
119
|
describe "#move" do
|
120
120
|
it "should move the playlist from the old index to the new index" do
|
121
|
-
playlist
|
121
|
+
playlist = container.contents[0]
|
122
|
+
playlist_two = container.contents[2]
|
123
|
+
|
124
|
+
container.contents.map(&:class).should eq [Hallon::Playlist, Hallon::PlaylistContainer::Folder, Hallon::Playlist, Hallon::PlaylistContainer::Folder]
|
122
125
|
|
123
|
-
container.contents.map(&:class).should eq [Hallon::Playlist, Hallon::PlaylistContainer::Folder, Hallon::PlaylistContainer::Folder]
|
124
126
|
container.move(0, 1).should eq playlist
|
125
|
-
container.contents.map(&:class).should eq [Hallon::PlaylistContainer::Folder, Hallon::Playlist, Hallon::PlaylistContainer::Folder]
|
126
|
-
container.
|
127
|
-
|
127
|
+
container.contents.map(&:class).should eq [Hallon::PlaylistContainer::Folder, Hallon::Playlist, Hallon::Playlist, Hallon::PlaylistContainer::Folder]
|
128
|
+
container.contents[1].should eq playlist
|
129
|
+
|
130
|
+
container.move(2, 0).should eq playlist_two
|
131
|
+
container.contents.map(&:class).should eq [Hallon::Playlist, Hallon::PlaylistContainer::Folder, Hallon::Playlist, Hallon::PlaylistContainer::Folder]
|
128
132
|
end
|
129
133
|
|
130
134
|
it "should raise an error if the operation failed" do
|
@@ -148,13 +152,13 @@ describe Hallon::PlaylistContainer do
|
|
148
152
|
end
|
149
153
|
|
150
154
|
it "should support retrieving folders from their start" do
|
151
|
-
folder = Hallon::PlaylistContainer::Folder.new(container, 1..
|
155
|
+
folder = Hallon::PlaylistContainer::Folder.new(container, 1..3)
|
152
156
|
container.contents[1].should eq folder
|
153
157
|
end
|
154
158
|
|
155
159
|
it "should support retrieving folders from their end" do
|
156
|
-
folder = Hallon::PlaylistContainer::Folder.new(container, 1..
|
157
|
-
container.contents[
|
160
|
+
folder = Hallon::PlaylistContainer::Folder.new(container, 1..3)
|
161
|
+
container.contents[3].should eq folder
|
158
162
|
end
|
159
163
|
end
|
160
164
|
|
@@ -165,7 +169,7 @@ describe Hallon::PlaylistContainer do
|
|
165
169
|
its(:id) { should be 1337 }
|
166
170
|
its(:name) { should eq "Boogie" }
|
167
171
|
its(:begin) { should be 1 }
|
168
|
-
its(:end) { should be
|
172
|
+
its(:end) { should be 3 }
|
169
173
|
|
170
174
|
describe "#moved?" do
|
171
175
|
it "should return true if the folder has moved" do
|
@@ -178,7 +182,9 @@ describe Hallon::PlaylistContainer do
|
|
178
182
|
end
|
179
183
|
|
180
184
|
describe "#contents" do
|
181
|
-
it "should be a collection of folders and playlists"
|
185
|
+
it "should be a collection of folders and playlists" do
|
186
|
+
folder.contents.should eq container.contents[2, 1]
|
187
|
+
end
|
182
188
|
end
|
183
189
|
|
184
190
|
describe "#rename" do
|
@@ -190,7 +196,7 @@ describe Hallon::PlaylistContainer do
|
|
190
196
|
folder.id.should eq 1337
|
191
197
|
folder.name.should eq "Boogie"
|
192
198
|
folder.begin.should be 1
|
193
|
-
folder.end.should be
|
199
|
+
folder.end.should be 3
|
194
200
|
|
195
201
|
container.contents.should_not include(folder)
|
196
202
|
end
|
@@ -201,7 +207,7 @@ describe Hallon::PlaylistContainer do
|
|
201
207
|
new_folder.id.should_not eq 1337
|
202
208
|
new_folder.name.should eq "Hiphip"
|
203
209
|
new_folder.begin.should be 1
|
204
|
-
new_folder.end.should be
|
210
|
+
new_folder.end.should be 3
|
205
211
|
end
|
206
212
|
|
207
213
|
it "should raise an error if the folder has moved" do
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# coding: utf-8
|
1
2
|
require 'time'
|
2
3
|
|
3
4
|
describe Hallon::Playlist do
|
@@ -148,6 +149,7 @@ describe Hallon::Playlist do
|
|
148
149
|
|
149
150
|
it "should fail given a too long name" do
|
150
151
|
expect { playlist.name = "a" * 256 }.to raise_error(ArgumentError)
|
152
|
+
expect { playlist.name = "ä" * 200 }.to raise_error(ArgumentError)
|
151
153
|
end
|
152
154
|
end
|
153
155
|
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
describe Hallon::Queue do
|
3
|
+
let(:queue) { Hallon::Queue.new(4) }
|
4
|
+
subject { queue }
|
5
|
+
|
6
|
+
it "should conform to the example specification of its’ documentation" do
|
7
|
+
queue.push([1, 2]).should eq 2
|
8
|
+
queue.push([3]).should eq 1
|
9
|
+
queue.push([4, 5, 6]).should eq 1
|
10
|
+
queue.push([5, 6]).should eq 0
|
11
|
+
queue.pop(1).should eq [1]
|
12
|
+
queue.push([5, 6]).should eq 1
|
13
|
+
queue.pop.should eq [2, 3, 4, 5]
|
14
|
+
end
|
15
|
+
|
16
|
+
describe "#pop" do
|
17
|
+
it "should not block if the queue is not empty" do
|
18
|
+
queue.push([1, 2])
|
19
|
+
|
20
|
+
start = Time.now
|
21
|
+
queue.pop.should eq [1, 2]
|
22
|
+
(Time.now - start).should be_within(0.001).of(0)
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should block if the queue is empty" do
|
26
|
+
queue.size.should be_zero
|
27
|
+
|
28
|
+
# I could mock out ConditionVariable and Mutex, but where’s the fun in that?
|
29
|
+
start = Time.now
|
30
|
+
Thread.start { sleep 0.2; queue.push([1]) }
|
31
|
+
queue.pop.should eq [1]
|
32
|
+
(Time.now - start).should be_within(0.08).of(0.2)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
data/spec/hallon/session_spec.rb
CHANGED
@@ -74,21 +74,21 @@ describe Hallon::Session do
|
|
74
74
|
|
75
75
|
session.should_receive(:process_events).twice.and_return do
|
76
76
|
unless notified
|
77
|
-
session.
|
77
|
+
session.class.send(:notify_main_thread_callback, session.pointer)
|
78
78
|
notified = true
|
79
79
|
else
|
80
|
-
session.
|
80
|
+
session.class.send(:logged_in_callback, session.pointer, :ok)
|
81
81
|
end
|
82
82
|
|
83
83
|
0
|
84
84
|
end
|
85
85
|
|
86
|
-
session.process_events_on(:
|
86
|
+
session.process_events_on(:logged_in) { |e| e == :ok }.should be_true
|
87
87
|
end
|
88
88
|
|
89
89
|
it "should time out if waiting for events too long" do
|
90
90
|
session.should_receive(:process_events).once.and_return(1) # and do nothing
|
91
|
-
session.wait_for(:
|
91
|
+
session.wait_for(:logged_in) { |x| x }.should eq :timeout
|
92
92
|
end
|
93
93
|
|
94
94
|
it "should call the given block once before waiting" do
|
data/spec/hallon/spotify_spec.rb
CHANGED
@@ -16,15 +16,41 @@ describe Spotify do
|
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
|
-
describe
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
19
|
+
describe Spotify::Pointer do
|
20
|
+
describe ".typechecks?" do
|
21
|
+
it "should return false for non-spotify pointers" do
|
22
|
+
Spotify::Pointer.typechecks?(double(type: :artist), :artist).should be_false
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should be false for pointers of another type if type is given" do
|
26
|
+
Spotify::Pointer.typechecks?(mock_album, :artist).should be_false
|
27
|
+
end
|
28
|
+
|
29
|
+
it "should be true for a pointer of the correct type" do
|
30
|
+
Spotify::Pointer.typechecks?(mock_album, :album).should be_true
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
describe "garbage collection" do
|
35
|
+
let(:my_pointer) { FFI::Pointer.new(1) }
|
36
|
+
|
37
|
+
it "should work" do
|
38
|
+
# GC tests are a bit funky, but as long as we garbage_release at least once, then
|
39
|
+
# we can assume our GC works properly, but up the stakes just for the sake of it
|
40
|
+
Spotify.should_receive(:garbage_release).with(my_pointer).at_least(3).times
|
41
|
+
5.times { Spotify::Pointer.new(my_pointer, :garbage, false) }
|
42
|
+
5.times { GC.start; sleep 0.01 }
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
describe Spotify::CallbackStruct do
|
48
|
+
subject { Spotify::SessionCallbacks.new }
|
49
|
+
it { should be_a Spotify::CallbackStruct }
|
50
|
+
|
51
|
+
it "should raise an error if given a callback of the wrong arity" do
|
52
|
+
callback = lambda { |x| }
|
53
|
+
expect { subject[:logged_in] = callback }.to raise_error(ArgumentError, /takes 2 arguments/)
|
28
54
|
end
|
29
55
|
end
|
30
56
|
end
|
data/spec/mockspotify.rb
CHANGED
@@ -50,9 +50,8 @@ module Spotify
|
|
50
50
|
|
51
51
|
def self.attach_mock_function(name, cname, params, returns, options = {})
|
52
52
|
attach_function(name, cname, params, returns, options)
|
53
|
-
|
54
|
-
|
55
|
-
Spotify::Pointer.new(old_method[*args], returns, false)
|
53
|
+
define_singleton_method("#{name}!") do |*args|
|
54
|
+
Spotify::Pointer.new(send(name, *args), returns, false)
|
56
55
|
end
|
57
56
|
end
|
58
57
|
|
data/spec/spec_helper.rb
CHANGED
@@ -2,21 +2,23 @@
|
|
2
2
|
require 'time'
|
3
3
|
|
4
4
|
RSpec::Core::ExampleGroup.instance_eval do
|
5
|
-
let(:mock_artist) { Spotify.mock_artist("Jem", mock_image_id, true) }
|
6
|
-
let(:mock_artist_two) { Spotify.mock_artist("Maroon 5", mock_image_id, true) }
|
5
|
+
let(:mock_artist) { Spotify.mock_artist!("Jem", mock_image_id, true) }
|
6
|
+
let(:mock_artist_two) { Spotify.mock_artist!("Maroon 5", mock_image_id, true) }
|
7
7
|
|
8
|
-
let(:mock_album) { Spotify.mock_album("Finally Woken", mock_artist, 2004, mock_image_id, :single, true, true) }
|
9
|
-
let(:mock_user) { Spotify.mock_user("burgestrand", "Burgestrand", true) }
|
10
|
-
let(:
|
8
|
+
let(:mock_album) { Spotify.mock_album!("Finally Woken", mock_artist, 2004, mock_image_id, :single, true, true) }
|
9
|
+
let(:mock_user) { Spotify.mock_user!("burgestrand", "Burgestrand", true) }
|
10
|
+
let(:mock_user_raw) { FFI::Pointer.new(mock_user.address) }
|
11
|
+
let(:mock_image) { Spotify.mock_image!(mock_image_id, :jpeg, File.size(fixture_image_path), File.read(fixture_image_path), :ok) }
|
12
|
+
let(:mock_image_id_pointer) { FFI::MemoryPointer.from_string(mock_image_id) }
|
11
13
|
|
12
14
|
let(:mock_track) do
|
13
15
|
artists = pointer_array_with(mock_artist, mock_artist_two)
|
14
|
-
Spotify.mock_track("They", artists.length, artists, mock_album, 123_456, 42, 2, 7, 0, true, :available, :done, false, true, true, false)
|
16
|
+
Spotify.mock_track!("They", artists.length, artists, mock_album, 123_456, 42, 2, 7, 0, true, :available, :done, false, true, true, false)
|
15
17
|
end
|
16
18
|
|
17
19
|
let(:mock_track_two) do
|
18
20
|
artists = pointer_array_with(mock_artist)
|
19
|
-
Spotify.mock_track("Amazing", artists.length, artists, mock_album, 123_456, 42, 2, 7, 0, true, :available, :no, false, true, true, true)
|
21
|
+
Spotify.mock_track!("Amazing", artists.length, artists, mock_album, 123_456, 42, 2, 7, 0, true, :available, :no, false, true, true, true)
|
20
22
|
end
|
21
23
|
|
22
24
|
let(:mock_albumbrowse) do
|
@@ -28,9 +30,8 @@ RSpec::Core::ExampleGroup.instance_eval do
|
|
28
30
|
end
|
29
31
|
|
30
32
|
let(:mock_artistbrowse) do
|
31
|
-
mock_image_pointer = FFI::MemoryPointer.from_string(mock_image_id)
|
32
33
|
similar_artists = pointer_array_with(mock_artist, mock_artist_two)
|
33
|
-
portraits = pointer_array_with(
|
34
|
+
portraits = pointer_array_with(mock_image_id_pointer, mock_image_id_pointer)
|
34
35
|
tracks = pointer_array_with(mock_track, mock_track_two)
|
35
36
|
albums = pointer_array_with(mock_album)
|
36
37
|
|
@@ -97,7 +98,15 @@ RSpec::Core::ExampleGroup.instance_eval do
|
|
97
98
|
tracks[3][:message] = FFI::MemoryPointer.from_string("message this, YO!")
|
98
99
|
tracks[3][:seen] = true
|
99
100
|
|
100
|
-
Spotify.mock_playlist("Megaplaylist", true, mock_user, true, "Playlist description...?", mock_image_id, false, 1000, mock_subscribers, true, :no, 67, num_tracks, tracks_ptr)
|
101
|
+
Spotify.mock_playlist!("Megaplaylist", true, mock_user, true, "Playlist description...?", mock_image_id, false, 1000, mock_subscribers, true, :no, 67, num_tracks, tracks_ptr)
|
102
|
+
end
|
103
|
+
|
104
|
+
let(:mock_playlist_two) do
|
105
|
+
Spotify.mock_playlist!("Dunderlist", true, mock_user, true, nil, nil, false, 1000, nil, true, :no, 0, 0, nil)
|
106
|
+
end
|
107
|
+
|
108
|
+
let(:mock_playlist_raw) do
|
109
|
+
FFI::Pointer.new(mock_playlist.address)
|
101
110
|
end
|
102
111
|
|
103
112
|
let(:mock_image_uri) { "spotify:image:#{mock_image_hex}" }
|
@@ -147,7 +156,7 @@ RSpec::Core::ExampleGroup.instance_eval do
|
|
147
156
|
end
|
148
157
|
|
149
158
|
let(:mock_container) do
|
150
|
-
num_items =
|
159
|
+
num_items = 4
|
151
160
|
items_ptr = FFI::MemoryPointer.new(Spotify::Mock::PlaylistTrack, num_items)
|
152
161
|
items = num_items.times.map do |i|
|
153
162
|
Spotify::Mock::PlaylistContainerItem.new(items_ptr + Spotify::Mock::PlaylistContainerItem.size * i)
|
@@ -160,11 +169,14 @@ RSpec::Core::ExampleGroup.instance_eval do
|
|
160
169
|
items[1][:type] = :start_folder
|
161
170
|
items[1][:folder_id] = 1337
|
162
171
|
|
163
|
-
items[2][:
|
164
|
-
items[2][:type]
|
165
|
-
|
172
|
+
items[2][:playlist] = mock_playlist_two
|
173
|
+
items[2][:type] = :playlist
|
174
|
+
|
175
|
+
items[3][:folder_name] = FFI::Pointer::NULL
|
176
|
+
items[3][:type] = :end_folder
|
177
|
+
items[3][:folder_id] = 1337
|
166
178
|
|
167
|
-
Spotify.mock_playlistcontainer(mock_user, true, num_items, items_ptr, nil, nil)
|
179
|
+
Spotify.mock_playlistcontainer!(mock_user, true, num_items, items_ptr, nil, nil)
|
168
180
|
end
|
169
181
|
end
|
170
182
|
|
@@ -0,0 +1,60 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
RSpec.configure do
|
3
|
+
def specification_for_callback(name, *args, &block)
|
4
|
+
describe("##{name}_callback", *args) do
|
5
|
+
let(:subject_callback) do
|
6
|
+
klass.send(:callback_for, name)
|
7
|
+
end
|
8
|
+
|
9
|
+
let(:pointer) { input[0] }
|
10
|
+
|
11
|
+
let(:klass) do
|
12
|
+
observable_class = described_class
|
13
|
+
pointer_address = pointer.address
|
14
|
+
|
15
|
+
Class.new do
|
16
|
+
extend observable_class
|
17
|
+
|
18
|
+
attr_reader :callbacks
|
19
|
+
|
20
|
+
def initialize
|
21
|
+
subscribe_for_callbacks do |callbacks|
|
22
|
+
@callbacks = callbacks
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
define_method(:pointer) do
|
27
|
+
FFI::Pointer.new(pointer_address)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
subject { klass.new }
|
33
|
+
|
34
|
+
instance_eval(&block)
|
35
|
+
|
36
|
+
it "should trigger #{name} with the proper arguments" do
|
37
|
+
block = proc {}
|
38
|
+
|
39
|
+
subject.on(name, &block)
|
40
|
+
block.should_receive(:call) do |*arguments|
|
41
|
+
output.each_with_index do |e, i|
|
42
|
+
arguments[i].should === e
|
43
|
+
end
|
44
|
+
nil
|
45
|
+
end
|
46
|
+
|
47
|
+
subject_callback.call(*input)
|
48
|
+
end
|
49
|
+
|
50
|
+
# this is not needed for struct members when creating the
|
51
|
+
# callback struct trough .create, as that method will make
|
52
|
+
# sure the methods have the correct arity
|
53
|
+
# (also, we can’t find the struct callback arity in any nice way)
|
54
|
+
it "should have the correct arity" do
|
55
|
+
fn = Spotify.find_type(type)
|
56
|
+
subject_callback.arity.should eq fn.param_types.size
|
57
|
+
end if method_defined?(:type)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -13,7 +13,7 @@ shared_examples_for "a Linkable object" do
|
|
13
13
|
end
|
14
14
|
|
15
15
|
it "should fail with an invalid spotify pointer" do
|
16
|
-
expect { described_class.new("i_am_invalid_uri") }.to raise_error(ArgumentError
|
16
|
+
expect { described_class.new("i_am_invalid_uri") }.to raise_error(ArgumentError)
|
17
17
|
end
|
18
18
|
|
19
19
|
it "should work with a Link object" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hallon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.12.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,33 +9,33 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-12-
|
12
|
+
date: 2011-12-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
|
-
name:
|
16
|
-
requirement: &
|
15
|
+
name: ref
|
16
|
+
requirement: &70217238288320 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version:
|
21
|
+
version: '1.0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70217238288320
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
|
-
name:
|
27
|
-
requirement: &
|
26
|
+
name: spotify
|
27
|
+
requirement: &70217238287820 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version:
|
33
|
-
type: :
|
32
|
+
version: 10.3.0
|
33
|
+
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70217238287820
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rake
|
38
|
-
requirement: &
|
38
|
+
requirement: &70217238287340 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0.8'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70217238287340
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rspec
|
49
|
-
requirement: &
|
49
|
+
requirement: &70217238286700 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '2'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70217238286700
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: yard
|
60
|
-
requirement: &
|
60
|
+
requirement: &70217238286240 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70217238286240
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rdiscount
|
71
|
-
requirement: &
|
71
|
+
requirement: &70217238285560 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,7 +76,7 @@ dependencies:
|
|
76
76
|
version: '0'
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *70217238285560
|
80
80
|
description:
|
81
81
|
email: kim@burgestrand.se
|
82
82
|
executables: []
|
@@ -89,7 +89,7 @@ files:
|
|
89
89
|
- .rspec
|
90
90
|
- .travis.yml
|
91
91
|
- .yardopts
|
92
|
-
- CHANGELOG
|
92
|
+
- CHANGELOG.md
|
93
93
|
- Gemfile
|
94
94
|
- LICENSE.txt
|
95
95
|
- QUIRKS
|
@@ -98,6 +98,7 @@ files:
|
|
98
98
|
- dev/login.rb
|
99
99
|
- examples/adding_tracks_to_playlist.rb
|
100
100
|
- examples/logging_in.rb
|
101
|
+
- examples/playing_audio.rb
|
101
102
|
- examples/printing_link_information.rb
|
102
103
|
- examples/show_published_playlists_of_user.rb
|
103
104
|
- hallon.gemspec
|
@@ -115,9 +116,20 @@ files:
|
|
115
116
|
- lib/hallon/link.rb
|
116
117
|
- lib/hallon/linkable.rb
|
117
118
|
- lib/hallon/observable.rb
|
119
|
+
- lib/hallon/observable/album_browse.rb
|
120
|
+
- lib/hallon/observable/artist_browse.rb
|
121
|
+
- lib/hallon/observable/image.rb
|
122
|
+
- lib/hallon/observable/player.rb
|
123
|
+
- lib/hallon/observable/playlist.rb
|
124
|
+
- lib/hallon/observable/playlist_container.rb
|
125
|
+
- lib/hallon/observable/post.rb
|
126
|
+
- lib/hallon/observable/search.rb
|
127
|
+
- lib/hallon/observable/session.rb
|
128
|
+
- lib/hallon/observable/toplist.rb
|
118
129
|
- lib/hallon/player.rb
|
119
130
|
- lib/hallon/playlist.rb
|
120
131
|
- lib/hallon/playlist_container.rb
|
132
|
+
- lib/hallon/queue.rb
|
121
133
|
- lib/hallon/search.rb
|
122
134
|
- lib/hallon/session.rb
|
123
135
|
- lib/hallon/toplist.rb
|
@@ -138,10 +150,20 @@ files:
|
|
138
150
|
- spec/hallon/image_spec.rb
|
139
151
|
- spec/hallon/link_spec.rb
|
140
152
|
- spec/hallon/linkable_spec.rb
|
153
|
+
- spec/hallon/observable/album_browse_spec.rb
|
154
|
+
- spec/hallon/observable/artist_browse_spec.rb
|
155
|
+
- spec/hallon/observable/image_spec.rb
|
156
|
+
- spec/hallon/observable/playlist_container_spec.rb
|
157
|
+
- spec/hallon/observable/playlist_spec.rb
|
158
|
+
- spec/hallon/observable/post_spec.rb
|
159
|
+
- spec/hallon/observable/search_spec.rb
|
160
|
+
- spec/hallon/observable/session_spec.rb
|
161
|
+
- spec/hallon/observable/toplist_spec.rb
|
141
162
|
- spec/hallon/observable_spec.rb
|
142
163
|
- spec/hallon/player_spec.rb
|
143
164
|
- spec/hallon/playlist_container_spec.rb
|
144
165
|
- spec/hallon/playlist_spec.rb
|
166
|
+
- spec/hallon/queue_spec.rb
|
145
167
|
- spec/hallon/search_spec.rb
|
146
168
|
- spec/hallon/session_spec.rb
|
147
169
|
- spec/hallon/spotify_spec.rb
|
@@ -157,6 +179,8 @@ files:
|
|
157
179
|
- spec/support/common_objects.rb
|
158
180
|
- spec/support/context_logged_in.rb
|
159
181
|
- spec/support/cover_me.rb
|
182
|
+
- spec/support/enumerable_comparison.rb
|
183
|
+
- spec/support/shared_for_callbacks.rb
|
160
184
|
- spec/support/shared_for_linkable_objects.rb
|
161
185
|
- spec/support/shared_for_loadable_objects.rb
|
162
186
|
- spec/mockspotify/libmockspotify/src/Makefile.am
|
@@ -222,10 +246,20 @@ test_files:
|
|
222
246
|
- spec/hallon/image_spec.rb
|
223
247
|
- spec/hallon/link_spec.rb
|
224
248
|
- spec/hallon/linkable_spec.rb
|
249
|
+
- spec/hallon/observable/album_browse_spec.rb
|
250
|
+
- spec/hallon/observable/artist_browse_spec.rb
|
251
|
+
- spec/hallon/observable/image_spec.rb
|
252
|
+
- spec/hallon/observable/playlist_container_spec.rb
|
253
|
+
- spec/hallon/observable/playlist_spec.rb
|
254
|
+
- spec/hallon/observable/post_spec.rb
|
255
|
+
- spec/hallon/observable/search_spec.rb
|
256
|
+
- spec/hallon/observable/session_spec.rb
|
257
|
+
- spec/hallon/observable/toplist_spec.rb
|
225
258
|
- spec/hallon/observable_spec.rb
|
226
259
|
- spec/hallon/player_spec.rb
|
227
260
|
- spec/hallon/playlist_container_spec.rb
|
228
261
|
- spec/hallon/playlist_spec.rb
|
262
|
+
- spec/hallon/queue_spec.rb
|
229
263
|
- spec/hallon/search_spec.rb
|
230
264
|
- spec/hallon/session_spec.rb
|
231
265
|
- spec/hallon/spotify_spec.rb
|
@@ -241,6 +275,8 @@ test_files:
|
|
241
275
|
- spec/support/common_objects.rb
|
242
276
|
- spec/support/context_logged_in.rb
|
243
277
|
- spec/support/cover_me.rb
|
278
|
+
- spec/support/enumerable_comparison.rb
|
279
|
+
- spec/support/shared_for_callbacks.rb
|
244
280
|
- spec/support/shared_for_linkable_objects.rb
|
245
281
|
- spec/support/shared_for_loadable_objects.rb
|
246
282
|
has_rdoc:
|