hallon 0.15.0 → 0.16.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. data/CHANGELOG.md +40 -0
  2. data/README.markdown +1 -1
  3. data/dev/application_key_converter.rb +11 -0
  4. data/examples/example_support.rb +4 -0
  5. data/examples/playing_audio.rb +1 -1
  6. data/lib/hallon.rb +11 -0
  7. data/lib/hallon/album_browse.rb +3 -3
  8. data/lib/hallon/artist_browse.rb +20 -4
  9. data/lib/hallon/blob.rb +11 -0
  10. data/lib/hallon/enumerator.rb +5 -0
  11. data/lib/hallon/ext/spotify.rb +2 -0
  12. data/lib/hallon/image.rb +7 -1
  13. data/lib/hallon/link.rb +5 -2
  14. data/lib/hallon/observable.rb +48 -1
  15. data/lib/hallon/player.rb +15 -26
  16. data/lib/hallon/playlist.rb +16 -25
  17. data/lib/hallon/playlist_container.rb +38 -0
  18. data/lib/hallon/search.rb +75 -4
  19. data/lib/hallon/session.rb +31 -42
  20. data/lib/hallon/toplist.rb +3 -3
  21. data/lib/hallon/track.rb +28 -10
  22. data/lib/hallon/version.rb +1 -1
  23. data/spec/hallon/album_browse_spec.rb +68 -18
  24. data/spec/hallon/album_spec.rb +62 -27
  25. data/spec/hallon/artist_browse_spec.rb +106 -31
  26. data/spec/hallon/artist_spec.rb +32 -18
  27. data/spec/hallon/blob_spec.rb +6 -0
  28. data/spec/hallon/enumerator_spec.rb +10 -0
  29. data/spec/hallon/error_spec.rb +4 -4
  30. data/spec/hallon/hallon_spec.rb +1 -1
  31. data/spec/hallon/image_spec.rb +58 -47
  32. data/spec/hallon/link_spec.rb +51 -43
  33. data/spec/hallon/observable/album_browse_spec.rb +1 -1
  34. data/spec/hallon/observable/artist_browse_spec.rb +1 -1
  35. data/spec/hallon/observable/image_spec.rb +1 -1
  36. data/spec/hallon/observable/playlist_container_spec.rb +4 -4
  37. data/spec/hallon/observable/playlist_spec.rb +14 -14
  38. data/spec/hallon/observable/post_spec.rb +1 -1
  39. data/spec/hallon/observable/search_spec.rb +1 -1
  40. data/spec/hallon/observable/session_spec.rb +17 -17
  41. data/spec/hallon/observable/toplist_spec.rb +1 -1
  42. data/spec/hallon/observable_spec.rb +40 -6
  43. data/spec/hallon/player_spec.rb +1 -1
  44. data/spec/hallon/playlist_container_spec.rb +96 -13
  45. data/spec/hallon/playlist_spec.rb +180 -45
  46. data/spec/hallon/search_spec.rb +211 -28
  47. data/spec/hallon/session_spec.rb +44 -38
  48. data/spec/hallon/toplist_spec.rb +31 -14
  49. data/spec/hallon/track_spec.rb +159 -50
  50. data/spec/hallon/user_post_spec.rb +10 -5
  51. data/spec/hallon/user_spec.rb +60 -50
  52. data/spec/spec_helper.rb +40 -15
  53. data/spec/support/album_mocks.rb +30 -0
  54. data/spec/support/artist_mocks.rb +36 -0
  55. data/spec/support/common_objects.rb +0 -201
  56. data/spec/support/image_mocks.rb +34 -0
  57. data/spec/support/playlist_container_mocks.rb +36 -0
  58. data/spec/support/playlist_mocks.rb +70 -0
  59. data/spec/support/search_mocks.rb +23 -0
  60. data/spec/support/session_mocks.rb +33 -0
  61. data/spec/support/toplist_mocks.rb +19 -0
  62. data/spec/support/track_mocks.rb +28 -0
  63. data/spec/support/user_mocks.rb +20 -0
  64. metadata +40 -18
  65. data/spec/support/context_stub_session.rb +0 -5
@@ -0,0 +1,30 @@
1
+ # coding: utf-8
2
+
3
+ RSpec::Core::ExampleGroup.instance_eval do
4
+ let(:mock_albums) do
5
+ {
6
+ default: mock_album,
7
+ empty: mock_empty_album
8
+ }
9
+ end
10
+
11
+ let(:mock_album) do
12
+ Spotify.mock_album!("Finally Woken", mock_artist, 2004, mock_image_id, :single, true, true)
13
+ end
14
+
15
+ let(:mock_empty_album) do
16
+ Spotify.mock_album!(nil, nil, 0, nil, :single, false, false)
17
+ end
18
+
19
+ let(:mock_albumbrowse) do
20
+ copyrights = %w[Kim Elin].map { |x| FFI::MemoryPointer.from_string(x) }
21
+ copyrights = pointer_array_with(*copyrights)
22
+ tracks = pointer_array_with(mock_track, mock_track_two)
23
+ review = "This album is AWESOME"
24
+ Spotify.mock_albumbrowse(:ok, 2751, mock_album, mock_artist, 2, copyrights, 2, tracks, review, nil, nil)
25
+ end
26
+
27
+ let(:mock_empty_albumbrowse) do
28
+ Spotify.mock_albumbrowse(:ok, -1, nil, nil, 0, nil, 0, nil, nil, nil, nil)
29
+ end
30
+ end
@@ -0,0 +1,36 @@
1
+ # coding: utf-8
2
+
3
+ RSpec::Core::ExampleGroup.instance_eval do
4
+ let(:mock_artists) do
5
+ {
6
+ default: mock_artist,
7
+ empty: mock_empty_artist
8
+ }
9
+ end
10
+
11
+ let(:mock_artist) do
12
+ Spotify.mock_artist!("Jem", mock_image_id, true)
13
+ end
14
+
15
+ let(:mock_artist_two) do
16
+ Spotify.mock_artist!("Maroon 5", mock_image_id, true)
17
+ end
18
+
19
+ let(:mock_empty_artist) do
20
+ Spotify.mock_artist!(nil, nil, false)
21
+ end
22
+
23
+ let(:mock_artistbrowse) do
24
+ similar_artists = pointer_array_with(mock_artist, mock_artist_two)
25
+ portraits = pointer_array_with(mock_image_id_pointer, mock_image_id_pointer)
26
+ tracks = pointer_array_with(mock_track, mock_track_two)
27
+ albums = pointer_array_with(mock_album)
28
+ tophits = pointer_array_with(mock_track)
29
+
30
+ Spotify.mock_artistbrowse(:ok, 2751, mock_artist, portraits.length, portraits, tracks.length, tracks, albums.length, albums, similar_artists.length, similar_artists, tophits.length, tophits, "grew up in DA BLOCK", :full, nil, nil)
31
+ end
32
+
33
+ let(:mock_empty_artistbrowse) do
34
+ Spotify.mock_artistbrowse(:ok, 0, nil, 0, nil, 0, nil, 0, nil, 0, nil, 0, nil, nil, :full, nil, nil)
35
+ end
36
+ end
@@ -2,207 +2,6 @@
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) }
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(: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) }
13
-
14
- let(:mock_track) do
15
- artists = pointer_array_with(mock_artist, mock_artist_two)
16
- Spotify.mock_track!("They", artists.length, artists, mock_album, 123_456, 42, 2, 7, :ok, true, :available, :done, false, true, nil, true, false)
17
- end
18
-
19
- let(:mock_track_two) do
20
- artists = pointer_array_with(mock_artist)
21
- Spotify.mock_track!("Amazing", artists.length, artists, mock_album, 123_456, 42, 2, 7, :ok, true, :available, :no, false, true, nil, true, true)
22
- end
23
-
24
- let(:mock_linked_track) do
25
- artists = pointer_array_with(mock_artist_two)
26
- Spotify.mock_track!("They", artists.length, artists, mock_album, 60, 100, 1, 1, :ok, true, :available, :no, false, true, mock_track, false, false)
27
- end
28
-
29
- let(:mock_albumbrowse) do
30
- copyrights = %w[Kim Elin].map { |x| FFI::MemoryPointer.from_string(x) }
31
- copyrights = pointer_array_with(*copyrights)
32
- tracks = pointer_array_with(mock_track, mock_track_two)
33
- review = "This album is AWESOME"
34
- Spotify.mock_albumbrowse(:ok, 2751, mock_album, mock_artist, 2, copyrights, 2, tracks, review, nil, nil)
35
- end
36
-
37
- let(:mock_artistbrowse) do
38
- similar_artists = pointer_array_with(mock_artist, mock_artist_two)
39
- portraits = pointer_array_with(mock_image_id_pointer, mock_image_id_pointer)
40
- tracks = pointer_array_with(mock_track, mock_track_two)
41
- albums = pointer_array_with(mock_album)
42
- tophits = pointer_array_with(mock_track)
43
-
44
- Spotify.mock_artistbrowse(:ok, 2751, mock_artist, portraits.length, portraits, tracks.length, tracks, albums.length, albums, similar_artists.length, similar_artists, tophits.length, tophits, "grew up in DA BLOCK", :full, nil, nil)
45
- end
46
-
47
- let(:mock_toplistbrowse) do
48
- artists = pointer_array_with(mock_artist, mock_artist_two)
49
- albums = pointer_array_with(mock_album)
50
- tracks = pointer_array_with(mock_track, mock_track_two)
51
- Spotify.mock_toplistbrowse(:ok, 2751, artists.length, artists, albums.length, albums, tracks.length, tracks)
52
- end
53
-
54
- let(:mock_search) do
55
- artists = pointer_array_with(mock_artist, mock_artist_two)
56
- albums = pointer_array_with(mock_album)
57
- tracks = pointer_array_with(mock_track, mock_track_two)
58
- playlists = pointer_array_with(mock_playlist, mock_playlist_two)
59
-
60
- Spotify.mock_search(:ok, "my å utf8  query", "another thing", 1337, tracks.length, tracks, 42, albums.length, albums, 81104, artists.length, artists, 0716, playlists.length, playlists, nil, nil)
61
- end
62
-
63
- let(:mock_subscribers) do
64
- people = %w[Kim Elin Ylva]
65
- people.map! { |x| FFI::MemoryPointer.from_string(x) }
66
-
67
- subscribers = FFI::MemoryPointer.new(:pointer, people.size)
68
- subscribers.write_array_of_pointer people
69
-
70
- Spotify.mock_subscribers(people.count, subscribers)
71
- end
72
-
73
- let(:mock_empty_subscribers) do
74
- Spotify.mock_subscribers(0, nil)
75
- end
76
-
77
- let(:mock_playlist) do
78
- num_tracks = 4
79
- tracks_ptr = FFI::MemoryPointer.new(Spotify::Mock::PlaylistTrack, num_tracks)
80
- tracks = num_tracks.times.map do |i|
81
- Spotify::Mock::PlaylistTrack.new(tracks_ptr + Spotify::Mock::PlaylistTrack.size * i)
82
- end
83
-
84
- tracks[0][:track] = mock_track
85
- tracks[0][:create_time] = Time.parse("2009-11-04").to_i
86
- tracks[0][:creator] = mock_user
87
- tracks[0][:message] = FFI::MemoryPointer.from_string("message this, YO!")
88
- tracks[0][:seen] = true
89
-
90
- tracks[1][:track] = mock_track_two
91
- tracks[1][:create_time] = Time.parse("2009-11-05").to_i
92
- tracks[1][:creator] = mock_user
93
- tracks[1][:message] = FFI::MemoryPointer.from_string("message this, YO!")
94
- tracks[1][:seen] = true
95
-
96
- tracks[2][:track] = mock_track
97
- tracks[2][:create_time] = Time.parse("2009-11-06").to_i
98
- tracks[2][:creator] = mock_user
99
- tracks[2][:message] = FFI::MemoryPointer.from_string("message this, YO!")
100
- tracks[2][:seen] = true
101
-
102
- tracks[3][:track] = mock_track_two
103
- tracks[3][:create_time] = Time.parse("2009-11-07").to_i
104
- tracks[3][:creator] = mock_user
105
- tracks[3][:message] = FFI::MemoryPointer.from_string("message this, YO!")
106
- tracks[3][:seen] = true
107
-
108
- Spotify.mock_playlist!("Megaplaylist", true, mock_user, true, "Playlist description...?", mock_image_id, false, 1000, mock_subscribers, true, :no, 67, num_tracks, tracks_ptr)
109
- end
110
-
111
- let(:mock_playlist_two) do
112
- Spotify.mock_playlist!("Dunderlist", true, mock_user, true, nil, nil, false, 1000, nil, true, :no, 0, 0, nil)
113
- end
114
-
115
- let(:mock_playlist_raw) do
116
- FFI::Pointer.new(mock_playlist.address)
117
- end
118
-
119
- let(:mock_image_uri) { "spotify:image:#{mock_image_hex}" }
120
- let(:mock_image_hex) { "3ad93423add99766e02d563605c6e76ed2b0e400" }
121
- let(:mock_image_id) { ":\xD94#\xAD\xD9\x97f\xE0-V6\x05\xC6\xE7n\xD2\xB0\xE4\0".force_encoding("BINARY") }
122
5
  let(:null_pointer) { FFI::Pointer.new(0) }
123
6
  let(:a_pointer) { FFI::Pointer.new(1) }
124
-
125
- let(:mock_offline_sync_status) do
126
- sync = Spotify::OfflineSyncStatus.new
127
- mock_offline_sync_status_hash.each_pair do |key, value|
128
- sync[key] = value
129
- end
130
- sync
131
- end
132
-
133
- let(:mock_offline_sync_status_hash) do
134
- {
135
- :queued_tracks => 1,
136
- :queued_bytes => 2,
137
- :done_tracks => 3,
138
- :done_bytes => 4,
139
- :copied_tracks => 5,
140
- :copied_bytes => 6,
141
- :error_tracks => 8,
142
- :syncing => false,
143
- :willnotcopy_tracks => 7
144
- }
145
- end
146
-
147
- let(:mock_session_object) do
148
- session = Hallon::Session.send(:allocate)
149
- sstatus = mock_offline_sync_status
150
- inbox = mock_playlist
151
- session.instance_eval do
152
- @pointer = Spotify.mock_session(nil, :undefined, 60 * 60 * 24 * 30, sstatus, 7, 3, inbox)
153
- end
154
- session
155
- end
156
-
157
- let(:mock_image_link) do
158
- Spotify.link_create_from_string!(mock_image_uri)
159
- end
160
-
161
- let(:mock_image_link_two) do
162
- Spotify.link_create_from_string!("spotify:image:ce9da340323614dc95ae96b68843b1c726dc5c8a")
163
- end
164
-
165
- let(:mock_container) do
166
- num_items = 4
167
- items_ptr = FFI::MemoryPointer.new(Spotify::Mock::PlaylistContainerItem, num_items)
168
- items = num_items.times.map do |i|
169
- Spotify::Mock::PlaylistContainerItem.new(items_ptr + Spotify::Mock::PlaylistContainerItem.size * i)
170
- end
171
-
172
- items[0][:playlist] = mock_playlist
173
- items[0][:type] = :playlist
174
-
175
- items[1][:folder_name] = FFI::MemoryPointer.from_string("Boogie")
176
- items[1][:type] = :start_folder
177
- items[1][:folder_id] = 1337
178
-
179
- items[2][:playlist] = mock_playlist_two
180
- items[2][:type] = :playlist
181
-
182
- items[3][:folder_name] = FFI::Pointer::NULL
183
- items[3][:type] = :end_folder
184
- items[3][:folder_id] = 1337
185
-
186
- Spotify.mock_playlistcontainer!(mock_user, true, num_items, items_ptr, nil, nil)
187
- end
188
- end
189
-
190
- RSpec.configure do |config|
191
- config.before do
192
- Spotify.registry_add mock_image_uri, mock_image
193
- Spotify.registry_add 'spotify:container:burgestrand', mock_container
194
- Spotify.registry_add 'spotify:albumbrowse:1xvnWMz2PNFf7mXOSRuLws', mock_albumbrowse
195
- Spotify.registry_add 'spotify:artistbrowse:3bftcFwl4vqRNNORRsqm1G', mock_artistbrowse
196
- Spotify.registry_add 'spotify:artist:3bftcFwl4vqRNNORRsqm1G', mock_artist
197
- Spotify.registry_add 'spotify:album:1xvnWMz2PNFf7mXOSRuLws', mock_album
198
- Spotify.registry_add 'spotify:track:7N2Vc8u56VGA4KUrGbikC2', mock_track
199
- Spotify.registry_add 'spotify:user:burgestrand', mock_user
200
- Spotify.registry_add 'spotify:user:burgestrand:playlist:07AX9IY9Hqmj1RqltcG0fi', mock_playlist
201
- Spotify.registry_add 'spotify:user:burgestrand:starred', mock_playlist
202
- Spotify.registry_add 'spotify:search:my+%C3%A5+utf8+%EF%A3%BF+query', mock_search
203
- end
204
-
205
- config.after do
206
- Spotify.registry_clean
207
- end
208
7
  end
@@ -0,0 +1,34 @@
1
+ # coding: utf-8
2
+
3
+ RSpec::Core::ExampleGroup.instance_eval do
4
+ let(:mock_images) do
5
+ {
6
+ default: mock_image,
7
+ empty: mock_empty_image
8
+ }
9
+ end
10
+
11
+ let(:mock_image_uri) { "spotify:image:#{mock_image_hex}" }
12
+ let(:mock_image_hex) { "3ad93423add99766e02d563605c6e76ed2b0e400" }
13
+ let(:mock_image_id) { ":\xD94#\xAD\xD9\x97f\xE0-V6\x05\xC6\xE7n\xD2\xB0\xE4\0".force_encoding("BINARY") }
14
+
15
+ let(:mock_image) do
16
+ Spotify.mock_image!(mock_image_id, :jpeg, File.size(fixture_image_path), File.read(fixture_image_path), :ok)
17
+ end
18
+
19
+ let(:mock_empty_image) do
20
+ Spotify.mock_image!(mock_image_id, :jpeg, 0, nil, :ok)
21
+ end
22
+
23
+ let(:mock_image_id_pointer) do
24
+ FFI::MemoryPointer.from_string(mock_image_id)
25
+ end
26
+
27
+ let(:mock_image_link) do
28
+ Spotify.link_create_from_string!(mock_image_uri)
29
+ end
30
+
31
+ let(:mock_image_link_two) do
32
+ Spotify.link_create_from_string!("spotify:image:ce9da340323614dc95ae96b68843b1c726dc5c8a")
33
+ end
34
+ end
@@ -0,0 +1,36 @@
1
+ RSpec::Core::ExampleGroup.instance_eval do
2
+ let(:mock_containers) do
3
+ {
4
+ default: mock_container,
5
+ empty: mock_empty_container
6
+ }
7
+ end
8
+
9
+ let(:mock_container) do
10
+ num_items = 4
11
+ items_ptr = FFI::MemoryPointer.new(Spotify::Mock::PlaylistContainerItem, num_items)
12
+ items = num_items.times.map do |i|
13
+ Spotify::Mock::PlaylistContainerItem.new(items_ptr + Spotify::Mock::PlaylistContainerItem.size * i)
14
+ end
15
+
16
+ items[0][:playlist] = mock_playlist
17
+ items[0][:type] = :playlist
18
+
19
+ items[1][:folder_name] = FFI::MemoryPointer.from_string("Boogie")
20
+ items[1][:type] = :start_folder
21
+ items[1][:folder_id] = 1337
22
+
23
+ items[2][:playlist] = mock_playlist_two
24
+ items[2][:type] = :playlist
25
+
26
+ items[3][:folder_name] = FFI::Pointer::NULL
27
+ items[3][:type] = :end_folder
28
+ items[3][:folder_id] = 1337
29
+
30
+ Spotify.mock_playlistcontainer!(mock_user, true, num_items, items_ptr, nil, nil)
31
+ end
32
+
33
+ let(:mock_empty_container) do
34
+ Spotify.mock_playlistcontainer!(nil, false, 0, nil, nil, nil)
35
+ end
36
+ end
@@ -0,0 +1,70 @@
1
+ # coding: utf-8
2
+
3
+ RSpec::Core::ExampleGroup.instance_eval do
4
+ let(:mock_playlists) do
5
+ {
6
+ default: mock_playlist,
7
+ empty: mock_empty_playlist
8
+ }
9
+ end
10
+
11
+ let(:mock_subscribers) do
12
+ people = %w[Kim Elin Ylva]
13
+ people.map! { |x| FFI::MemoryPointer.from_string(x) }
14
+
15
+ subscribers = FFI::MemoryPointer.new(:pointer, people.size)
16
+ subscribers.write_array_of_pointer people
17
+
18
+ Spotify.mock_subscribers(people.count, subscribers)
19
+ end
20
+
21
+ let(:mock_empty_subscribers) do
22
+ Spotify.mock_subscribers(0, nil)
23
+ end
24
+
25
+ let(:mock_playlist) do
26
+ num_tracks = 4
27
+ tracks_ptr = FFI::MemoryPointer.new(Spotify::Mock::PlaylistTrack, num_tracks)
28
+ tracks = num_tracks.times.map do |i|
29
+ Spotify::Mock::PlaylistTrack.new(tracks_ptr + Spotify::Mock::PlaylistTrack.size * i)
30
+ end
31
+
32
+ tracks[0][:track] = mock_track
33
+ tracks[0][:create_time] = Time.parse("2009-11-04").to_i
34
+ tracks[0][:creator] = mock_user
35
+ tracks[0][:message] = FFI::MemoryPointer.from_string("message this, YO!")
36
+ tracks[0][:seen] = true
37
+
38
+ tracks[1][:track] = mock_track_two
39
+ tracks[1][:create_time] = Time.parse("2009-11-05").to_i
40
+ tracks[1][:creator] = mock_user
41
+ tracks[1][:message] = FFI::MemoryPointer.from_string("message this, YO!")
42
+ tracks[1][:seen] = true
43
+
44
+ tracks[2][:track] = mock_track
45
+ tracks[2][:create_time] = Time.parse("2009-11-06").to_i
46
+ tracks[2][:creator] = mock_user
47
+ tracks[2][:message] = FFI::MemoryPointer.from_string("message this, YO!")
48
+ tracks[2][:seen] = true
49
+
50
+ tracks[3][:track] = mock_track_two
51
+ tracks[3][:create_time] = 0
52
+ tracks[3][:creator] = nil
53
+ tracks[3][:message] = nil
54
+ tracks[3][:seen] = true
55
+
56
+ Spotify.mock_playlist!("Megaplaylist", true, mock_user, true, "Playlist description...?", mock_image_id, false, 1000, mock_subscribers, true, :no, 67, num_tracks, tracks_ptr)
57
+ end
58
+
59
+ let(:mock_playlist_two) do
60
+ Spotify.mock_playlist!("Dunderlist", true, mock_user, true, nil, mock_image_id, false, 1000, nil, true, :no, 0, 0, nil)
61
+ end
62
+
63
+ let(:mock_empty_playlist) do
64
+ Spotify.mock_playlist!(nil, false, nil, false, nil, nil, false, 0, nil, false, :no, 0, 0, nil)
65
+ end
66
+
67
+ let(:mock_playlist_raw) do
68
+ FFI::Pointer.new(mock_playlist.address)
69
+ end
70
+ end
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+
3
+ RSpec::Core::ExampleGroup.instance_eval do
4
+ let(:mock_searches) do
5
+ {
6
+ default: mock_search,
7
+ empty: mock_empty_search
8
+ }
9
+ end
10
+
11
+ let(:mock_search) do
12
+ artists = pointer_array_with(mock_artist, mock_artist_two)
13
+ albums = pointer_array_with(mock_album)
14
+ tracks = pointer_array_with(mock_track, mock_track_two)
15
+ playlists = pointer_array_with(mock_playlist_two)
16
+
17
+ Spotify.mock_search(:ok, "my å utf8  query", "another thing", 1337, tracks.length, tracks, 42, albums.length, albums, 81104, artists.length, artists, 0716, playlists.length, playlists, nil, nil)
18
+ end
19
+
20
+ let(:mock_empty_search) do
21
+ Spotify.mock_search(:ok, "", nil, 0, 0, nil, 0, 0, nil, 0, 0, nil, 0, 0, nil, nil, nil)
22
+ end
23
+ end
@@ -0,0 +1,33 @@
1
+ RSpec::Core::ExampleGroup.instance_eval do
2
+ let(:mock_offline_sync_status) do
3
+ sync = Spotify::OfflineSyncStatus.new
4
+ mock_offline_sync_status_hash.each_pair do |key, value|
5
+ sync[key] = value
6
+ end
7
+ sync
8
+ end
9
+
10
+ let(:mock_offline_sync_status_hash) do
11
+ {
12
+ :queued_tracks => 1,
13
+ :queued_bytes => 2,
14
+ :done_tracks => 3,
15
+ :done_bytes => 4,
16
+ :copied_tracks => 5,
17
+ :copied_bytes => 6,
18
+ :error_tracks => 8,
19
+ :syncing => false,
20
+ :willnotcopy_tracks => 7
21
+ }
22
+ end
23
+
24
+ let(:mock_session_object) do
25
+ session = Hallon::Session.send(:allocate)
26
+ sstatus = mock_offline_sync_status
27
+ inbox = mock_playlist
28
+ session.instance_eval do
29
+ @pointer = Spotify.mock_session(nil, :undefined, 60 * 60 * 24 * 30, sstatus, 7, 3, inbox)
30
+ end
31
+ session
32
+ end
33
+ end