hallon 0.8.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. data/.travis.yml +2 -0
  2. data/CHANGELOG +43 -0
  3. data/Gemfile +2 -0
  4. data/README.markdown +21 -13
  5. data/Rakefile +84 -23
  6. data/dev/login.rb +16 -0
  7. data/examples/adding_tracks_to_playlist.rb +49 -0
  8. data/examples/logging_in.rb +1 -6
  9. data/examples/show_published_playlists_of_user.rb +9 -19
  10. data/hallon.gemspec +1 -1
  11. data/lib/hallon.rb +3 -2
  12. data/lib/hallon/album.rb +55 -41
  13. data/lib/hallon/album_browse.rb +41 -37
  14. data/lib/hallon/artist.rb +30 -21
  15. data/lib/hallon/artist_browse.rb +59 -41
  16. data/lib/hallon/base.rb +68 -5
  17. data/lib/hallon/enumerator.rb +1 -0
  18. data/lib/hallon/error.rb +3 -0
  19. data/lib/hallon/ext/spotify.rb +169 -36
  20. data/lib/hallon/image.rb +30 -44
  21. data/lib/hallon/link.rb +29 -43
  22. data/lib/hallon/linkable.rb +68 -20
  23. data/lib/hallon/observable.rb +0 -1
  24. data/lib/hallon/player.rb +21 -7
  25. data/lib/hallon/playlist.rb +291 -0
  26. data/lib/hallon/playlist_container.rb +27 -0
  27. data/lib/hallon/search.rb +52 -45
  28. data/lib/hallon/session.rb +129 -81
  29. data/lib/hallon/toplist.rb +37 -19
  30. data/lib/hallon/track.rb +68 -45
  31. data/lib/hallon/user.rb +69 -33
  32. data/lib/hallon/version.rb +1 -1
  33. data/spec/hallon/album_browse_spec.rb +15 -9
  34. data/spec/hallon/album_spec.rb +15 -15
  35. data/spec/hallon/artist_browse_spec.rb +28 -9
  36. data/spec/hallon/artist_spec.rb +30 -14
  37. data/spec/hallon/enumerator_spec.rb +0 -1
  38. data/spec/hallon/hallon_spec.rb +20 -1
  39. data/spec/hallon/image_spec.rb +18 -41
  40. data/spec/hallon/link_spec.rb +10 -12
  41. data/spec/hallon/linkable_spec.rb +37 -18
  42. data/spec/hallon/player_spec.rb +8 -0
  43. data/spec/hallon/playlist_container_spec.rb +75 -0
  44. data/spec/hallon/playlist_spec.rb +204 -0
  45. data/spec/hallon/search_spec.rb +19 -16
  46. data/spec/hallon/session_spec.rb +61 -29
  47. data/spec/hallon/spotify_spec.rb +30 -0
  48. data/spec/hallon/toplist_spec.rb +22 -14
  49. data/spec/hallon/track_spec.rb +62 -21
  50. data/spec/hallon/user_spec.rb +47 -36
  51. data/spec/mockspotify.rb +35 -10
  52. data/spec/mockspotify/mockspotify_spec.rb +22 -0
  53. data/spec/spec_helper.rb +7 -3
  54. data/spec/support/common_objects.rb +91 -16
  55. data/spec/support/shared_for_linkable_objects.rb +39 -0
  56. metadata +30 -20
  57. data/Termfile +0 -7
  58. data/lib/hallon/synchronizable.rb +0 -32
  59. data/spec/hallon/synchronizable_spec.rb +0 -19
@@ -1,20 +1,22 @@
1
1
  # coding: utf-8
2
+ require 'time'
3
+
2
4
  RSpec::Core::ExampleGroup.instance_eval do
3
- let(:mock_artist) { Spotify.mock_artist("Jem", true) }
4
- let(:mock_artist_two) { Spotify.mock_artist("Maroon 5", 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) }
5
7
 
6
- let(:mock_album) { Spotify.mock_album("Finally Woken", mock_artist, 2004, "DEADBEEFDEADBEEFDEAD", :single, true, true) }
7
- let(:mock_user) { Spotify.mock_user("burgestrand", "Burgestrand", "Kim Burgestrand", "https://secure.gravatar.com/avatar/b67b73b5b1fd84119ec788b1c3df02ad", :none, true) }
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) }
8
10
  let(:mock_image) { Spotify.mock_image(mock_image_id, :jpeg, File.size(fixture_image_path), File.read(fixture_image_path), :ok) }
9
11
 
10
12
  let(:mock_track) do
11
13
  artists = pointer_array_with(mock_artist, mock_artist_two)
12
- Spotify.mock_track("They", artists.length, artists, mock_album, 123_456, 42, 2, 7, 0, true, true, false, true, true)
14
+ Spotify.mock_track("They", artists.length, artists, mock_album, 123_456, 42, 2, 7, 0, true, :available, :done, false, true, true, false)
13
15
  end
14
16
 
15
17
  let(:mock_track_two) do
16
18
  artists = pointer_array_with(mock_artist)
17
- Spotify.mock_track("Amazing", artists.length, artists, mock_album, 123_456, 42, 2, 7, 0, true, true, false, true, true)
19
+ Spotify.mock_track("Amazing", artists.length, artists, mock_album, 123_456, 42, 2, 7, 0, true, :available, :no, false, true, true, true)
18
20
  end
19
21
 
20
22
  let(:mock_albumbrowse) do
@@ -22,26 +24,24 @@ RSpec::Core::ExampleGroup.instance_eval do
22
24
  copyrights = pointer_array_with(*copyrights)
23
25
  tracks = pointer_array_with(mock_track, mock_track_two)
24
26
  review = "This album is AWESOME"
25
- Spotify.mock_albumbrowse(:ok, mock_album, mock_artist, 2, copyrights, 2, tracks, review, nil, nil)
27
+ Spotify.mock_albumbrowse(:ok, 2751, mock_album, mock_artist, 2, copyrights, 2, tracks, review, nil, nil)
26
28
  end
27
29
 
28
30
  let(:mock_artistbrowse) do
29
- artistbrowse = nil
30
-
31
31
  mock_image_pointer = FFI::MemoryPointer.from_string(mock_image_id)
32
32
  similar_artists = pointer_array_with(mock_artist, mock_artist_two)
33
33
  portraits = pointer_array_with(mock_image_pointer, mock_image_pointer)
34
34
  tracks = pointer_array_with(mock_track, mock_track_two)
35
35
  albums = pointer_array_with(mock_album)
36
36
 
37
- Spotify.mock_artistbrowse(:ok, mock_artist, portraits.length, portraits, tracks.length, tracks, albums.length, albums, similar_artists.length, similar_artists, "grew up in DA BLOCK", nil, nil)
37
+ Spotify.mock_artistbrowse(:ok, 2751, mock_artist, portraits.length, portraits, tracks.length, tracks, albums.length, albums, similar_artists.length, similar_artists, "grew up in DA BLOCK", :full, nil, nil)
38
38
  end
39
39
 
40
40
  let(:mock_toplistbrowse) do
41
41
  artists = pointer_array_with(mock_artist, mock_artist_two)
42
42
  albums = pointer_array_with(mock_album)
43
43
  tracks = pointer_array_with(mock_track, mock_track_two)
44
- Spotify.mock_toplistbrowse(:ok, artists.length, artists, albums.length, albums, tracks.length, tracks)
44
+ Spotify.mock_toplistbrowse(:ok, 2751, artists.length, artists, albums.length, albums, tracks.length, tracks)
45
45
  end
46
46
 
47
47
  let(:mock_search) do
@@ -52,6 +52,55 @@ RSpec::Core::ExampleGroup.instance_eval do
52
52
  Spotify.mock_search(:ok, "my query", "another thing", 1337, tracks.length, tracks, 42, albums.length, albums, 81104, artists.length, artists, nil, nil)
53
53
  end
54
54
 
55
+ let(:mock_subscribers) do
56
+ people = %w[Kim Elin Ylva]
57
+ people.map! { |x| FFI::MemoryPointer.from_string(x) }
58
+
59
+ subscribers = FFI::MemoryPointer.new(:pointer, people.size)
60
+ subscribers.write_array_of_pointer people
61
+
62
+ Spotify.mock_subscribers(people.count, subscribers)
63
+ end
64
+
65
+ let(:mock_empty_subscribers) do
66
+ Spotify.mock_subscribers(0, nil)
67
+ end
68
+
69
+ let(:mock_playlist) do
70
+ num_tracks = 4
71
+ tracks_ptr = FFI::MemoryPointer.new(Spotify::Mock::PlaylistTrack, num_tracks)
72
+ tracks = num_tracks.times.map do |i|
73
+ Spotify::Mock::PlaylistTrack.new(tracks_ptr + Spotify::Mock::PlaylistTrack.size * i)
74
+ end
75
+
76
+ tracks[0][:track] = mock_track
77
+ tracks[0][:create_time] = Time.parse("2009-11-04").to_i
78
+ tracks[0][:creator] = mock_user
79
+ tracks[0][:message] = FFI::MemoryPointer.from_string("message this, YO!")
80
+ tracks[0][:seen] = true
81
+
82
+ tracks[1][:track] = mock_track_two
83
+ tracks[1][:create_time] = Time.parse("2009-11-05").to_i
84
+ tracks[1][:creator] = mock_user
85
+ tracks[1][:message] = FFI::MemoryPointer.from_string("message this, YO!")
86
+ tracks[1][:seen] = true
87
+
88
+ tracks[2][:track] = mock_track
89
+ tracks[2][:create_time] = Time.parse("2009-11-06").to_i
90
+ tracks[2][:creator] = mock_user
91
+ tracks[2][:message] = FFI::MemoryPointer.from_string("message this, YO!")
92
+ tracks[2][:seen] = true
93
+
94
+ tracks[3][:track] = mock_track_two
95
+ tracks[3][:create_time] = Time.parse("2009-11-07").to_i
96
+ tracks[3][:creator] = mock_user
97
+ tracks[3][:message] = FFI::MemoryPointer.from_string("message this, YO!")
98
+ tracks[3][:seen] = true
99
+
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
+ end
102
+
103
+ let(:mock_image_uri) { "spotify:image:#{mock_image_hex}" }
55
104
  let(:mock_image_hex) { "3ad93423add99766e02d563605c6e76ed2b0e450" }
56
105
  let(:mock_image_id) { ":\xD94#\xAD\xD9\x97f\xE0-V6\x05\xC6\xE7n\xD2\xB0\xE4P".force_encoding("BINARY") }
57
106
  let(:null_pointer) { FFI::Pointer.new(0) }
@@ -80,16 +129,42 @@ RSpec::Core::ExampleGroup.instance_eval do
80
129
 
81
130
  let(:mock_session_object) do
82
131
  session = Hallon::Session.send(:allocate)
83
- friends = pointer_array_with(mock_user)
84
132
  sstatus = mock_offline_sync_status
133
+ inbox = mock_playlist
85
134
  session.instance_eval do
86
- @pointer = Spotify.mock_session(nil, :undefined, friends.length, friends, 60 * 60 * 24 * 30, sstatus, 7, 3)
135
+ @pointer = Spotify.mock_session(nil, :undefined, 60 * 60 * 24 * 30, sstatus, 7, 3, inbox)
87
136
  end
88
137
  session
89
138
  end
139
+
140
+ let(:mock_image_link) do
141
+ Spotify.link_create_from_string!(mock_image_uri)
142
+ end
143
+
144
+ let(:mock_image_link_two) do
145
+ Spotify.link_create_from_string!("spotify:image:ce9da340323614dc95ae96b68843b1c726dc5c8a")
146
+ end
147
+
148
+ let(:mock_container) do
149
+ owner = Spotify.registry_find("spotify:user:burgestrand")
150
+ Spotify.mock_playlistcontainer(owner, true)
151
+ end
90
152
  end
91
153
 
92
- RSpec::Core::ExampleGroup.new.instance_eval do
93
- Spotify.registry_add 'spotify:track:7N2Vc8u56VGA4KUrGbikC2', mock_track
94
- Spotify.registry_add 'spotify:user:burgestrand', mock_user
154
+ RSpec.configure do |config|
155
+ config.before do
156
+ Spotify.registry_add mock_image_uri, mock_image
157
+ Spotify.registry_add 'spotify:albumbrowse:1xvnWMz2PNFf7mXOSRuLws', mock_albumbrowse
158
+ Spotify.registry_add 'spotify:artistbrowse:3bftcFwl4vqRNNORRsqm1G', mock_artistbrowse
159
+ Spotify.registry_add 'spotify:artist:3bftcFwl4vqRNNORRsqm1G', mock_artist
160
+ Spotify.registry_add 'spotify:album:1xvnWMz2PNFf7mXOSRuLws', mock_album
161
+ Spotify.registry_add 'spotify:track:7N2Vc8u56VGA4KUrGbikC2', mock_track
162
+ Spotify.registry_add 'spotify:user:burgestrand', mock_user
163
+ Spotify.registry_add 'spotify:user:burgestrand:playlist:07AX9IY9Hqmj1RqltcG0fi', mock_playlist
164
+ Spotify.registry_add 'spotify:user:burgestrand:starred', mock_playlist
165
+ end
166
+
167
+ config.after do
168
+ Spotify.registry_clean
169
+ end
95
170
  end
@@ -0,0 +1,39 @@
1
+ # coding: utf-8
2
+ shared_examples_for "a Linkable object" do
3
+ describe "instantiation" do
4
+ let(:spotify_pointer) do
5
+ ptr_type = Hallon::Link.new(spotify_uri).type
6
+ ptr_type = :user if ptr_type == :profile
7
+ ffi_pointer = Spotify.registry_find(spotify_uri[/[^#]+/]) # up to pound sign for track#offset
8
+ Spotify::Pointer.new(ffi_pointer, ptr_type, false)
9
+ end
10
+
11
+ it "should work with a string URI" do
12
+ expect { described_class.new(spotify_uri) }.to_not raise_error
13
+ end
14
+
15
+ it "should fail with an invalid spotify pointer" do
16
+ expect { described_class.new("i_am_invalid_uri") }.to raise_error(ArgumentError, /not a valid spotify \w+ URI or pointer/)
17
+ end
18
+
19
+ it "should work with a Link object" do
20
+ expect { described_class.new(Hallon::Link.new(spotify_uri)) }.to_not raise_error
21
+ end
22
+
23
+ it "should work with a spotify pointer" do
24
+ expect { described_class.new(spotify_pointer) }.to_not raise_error
25
+ end
26
+
27
+ it "should work with a custom object" do
28
+ expect { described_class.new(custom_object) }.to_not raise_error
29
+ end if defined?(custom_object)
30
+ end
31
+
32
+ describe "#to_link" do
33
+ subject { described_class.new(spotify_uri) }
34
+
35
+ it "should return a valid link" do
36
+ subject.to_link.should eq Hallon::Link.new(spotify_uri)
37
+ end
38
+ end
39
+ end
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.8.0
4
+ version: 0.9.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,22 +9,22 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-10-01 00:00:00.000000000Z
12
+ date: 2011-11-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: spotify
16
- requirement: &2156044680 !ruby/object:Gem::Requirement
16
+ requirement: &70146970531060 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
20
20
  - !ruby/object:Gem::Version
21
- version: 9.0.0
21
+ version: 10.1.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2156044680
24
+ version_requirements: *70146970531060
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: bundler
27
- requirement: &2156043420 !ruby/object:Gem::Requirement
27
+ requirement: &70146970529600 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '1.0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *2156043420
35
+ version_requirements: *70146970529600
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rake
38
- requirement: &2156041620 !ruby/object:Gem::Requirement
38
+ requirement: &70146970527480 !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: *2156041620
46
+ version_requirements: *70146970527480
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rspec
49
- requirement: &2156039900 !ruby/object:Gem::Requirement
49
+ requirement: &70146970524260 !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: *2156039900
57
+ version_requirements: *70146970524260
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: yard
60
- requirement: &2156038000 !ruby/object:Gem::Requirement
60
+ requirement: &70146970523640 !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: *2156038000
68
+ version_requirements: *70146970523640
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rdiscount
71
- requirement: &2156036440 !ruby/object:Gem::Requirement
71
+ requirement: &70146970522520 !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: *2156036440
79
+ version_requirements: *70146970522520
80
80
  description:
81
81
  email: kim@burgestrand.se
82
82
  executables: []
@@ -96,7 +96,8 @@ files:
96
96
  - QUIRKS
97
97
  - README.markdown
98
98
  - Rakefile
99
- - Termfile
99
+ - dev/login.rb
100
+ - examples/adding_tracks_to_playlist.rb
100
101
  - examples/logging_in.rb
101
102
  - examples/printing_link_information.rb
102
103
  - examples/show_published_playlists_of_user.rb
@@ -116,9 +117,10 @@ files:
116
117
  - lib/hallon/linkable.rb
117
118
  - lib/hallon/observable.rb
118
119
  - lib/hallon/player.rb
120
+ - lib/hallon/playlist.rb
121
+ - lib/hallon/playlist_container.rb
119
122
  - lib/hallon/search.rb
120
123
  - lib/hallon/session.rb
121
- - lib/hallon/synchronizable.rb
122
124
  - lib/hallon/toplist.rb
123
125
  - lib/hallon/track.rb
124
126
  - lib/hallon/user.rb
@@ -138,9 +140,11 @@ files:
138
140
  - spec/hallon/linkable_spec.rb
139
141
  - spec/hallon/observable_spec.rb
140
142
  - spec/hallon/player_spec.rb
143
+ - spec/hallon/playlist_container_spec.rb
144
+ - spec/hallon/playlist_spec.rb
141
145
  - spec/hallon/search_spec.rb
142
146
  - spec/hallon/session_spec.rb
143
- - spec/hallon/synchronizable_spec.rb
147
+ - spec/hallon/spotify_spec.rb
144
148
  - spec/hallon/toplist_spec.rb
145
149
  - spec/hallon/track_spec.rb
146
150
  - spec/hallon/user_spec.rb
@@ -153,6 +157,7 @@ files:
153
157
  - spec/support/common_objects.rb
154
158
  - spec/support/context_logged_in.rb
155
159
  - spec/support/cover_me.rb
160
+ - spec/support/shared_for_linkable_objects.rb
156
161
  - spec/support/shared_for_loadable_objects.rb
157
162
  - spec/mockspotify/libmockspotify/src/Makefile.am
158
163
  - spec/mockspotify/libmockspotify/src/album.c
@@ -161,6 +166,7 @@ files:
161
166
  - spec/mockspotify/libmockspotify/src/artistbrowse.c
162
167
  - spec/mockspotify/libmockspotify/src/error.c
163
168
  - spec/mockspotify/libmockspotify/src/image.c
169
+ - spec/mockspotify/libmockspotify/src/inbox.c
164
170
  - spec/mockspotify/libmockspotify/src/libmockspotify.c
165
171
  - spec/mockspotify/libmockspotify/src/libmockspotify.h
166
172
  - spec/mockspotify/libmockspotify/src/libspotify/api.h
@@ -196,7 +202,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
196
202
  version: '0'
197
203
  requirements: []
198
204
  rubyforge_project:
199
- rubygems_version: 1.8.6
205
+ rubygems_version: 1.8.10
200
206
  signing_key:
201
207
  specification_version: 3
202
208
  summary: Delicious Ruby bindings to the official Spotify API
@@ -216,9 +222,11 @@ test_files:
216
222
  - spec/hallon/linkable_spec.rb
217
223
  - spec/hallon/observable_spec.rb
218
224
  - spec/hallon/player_spec.rb
225
+ - spec/hallon/playlist_container_spec.rb
226
+ - spec/hallon/playlist_spec.rb
219
227
  - spec/hallon/search_spec.rb
220
228
  - spec/hallon/session_spec.rb
221
- - spec/hallon/synchronizable_spec.rb
229
+ - spec/hallon/spotify_spec.rb
222
230
  - spec/hallon/toplist_spec.rb
223
231
  - spec/hallon/track_spec.rb
224
232
  - spec/hallon/user_spec.rb
@@ -231,4 +239,6 @@ test_files:
231
239
  - spec/support/common_objects.rb
232
240
  - spec/support/context_logged_in.rb
233
241
  - spec/support/cover_me.rb
242
+ - spec/support/shared_for_linkable_objects.rb
234
243
  - spec/support/shared_for_loadable_objects.rb
244
+ has_rdoc:
data/Termfile DELETED
@@ -1,7 +0,0 @@
1
- # You wonder what this is?
2
- #
3
- # This is a Termfile, and is used by a gem named “terminitor” that
4
- # allows me to set up the work environment for Hallon much easier.
5
-
6
- run 'bundle exec autotest'
7
- tab '$EDITOR .'
@@ -1,32 +0,0 @@
1
- # coding: utf-8
2
- require 'monitor'
3
- require 'forwardable'
4
-
5
- module Hallon
6
- # Adds synchronization primitives to target when included.
7
- module Synchronizable
8
- # Creates a `Monitor` for the target instance and adds `monitor` class method for access.
9
- #
10
- # Also adds several other methods:
11
- #
12
- # - `#synchronize`
13
- # - `#new_cond`
14
- #
15
- # These all delegate to `#monitor`.
16
- #
17
- # @note This module is part of Hallons private API
18
- # @private
19
- def self.included(o)
20
- o.instance_exec do
21
- @monitor = Monitor.new
22
- class << self
23
- attr_reader :monitor
24
- end
25
- end
26
- end
27
-
28
- extend Forwardable
29
- def_delegators :monitor, :synchronize, :new_cond
30
- def_delegators 'self.class', :monitor
31
- end
32
- end
@@ -1,19 +0,0 @@
1
- describe Hallon::Synchronizable do
2
- subject do
3
- Class.new { include Hallon::Synchronizable }.new
4
- end
5
-
6
- describe "#synchronize" do
7
- it "should not deadlock when called recursively in itself" do
8
- expect do
9
- subject.synchronize { subject.synchronize {} }
10
- end.to_not raise_error
11
- end
12
- end
13
-
14
- describe "#new_cond" do
15
- it "should give us a new condition variable" do
16
- subject.new_cond.should be_a Monitor::ConditionVariable
17
- end
18
- end
19
- end