mpc 0.4 → 0.5
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.
- data/lib/mpc.rb +7 -1
- data/test/mpc_test.rb +9 -0
- metadata +4 -4
data/lib/mpc.rb
CHANGED
@@ -134,7 +134,13 @@ class Mpc
|
|
134
134
|
end
|
135
135
|
|
136
136
|
def list_playlists
|
137
|
-
|
137
|
+
output = Array.new
|
138
|
+
puts("listplaylists").each do |line|
|
139
|
+
if line.match(/\Aplaylist\:(.*)\n\Z/)
|
140
|
+
output << to_hash(line)
|
141
|
+
end
|
142
|
+
end
|
143
|
+
output
|
138
144
|
end
|
139
145
|
|
140
146
|
def list_playlist_info(name)
|
data/test/mpc_test.rb
CHANGED
@@ -137,4 +137,13 @@ class MpcTest < Test::Unit::TestCase
|
|
137
137
|
@mpc.expects(:puts).with("move 1 3")
|
138
138
|
@mpc.move_song(1,3)
|
139
139
|
end
|
140
|
+
|
141
|
+
test "list_playlists should return array with playlists" do
|
142
|
+
@mpc.stubs(:puts).returns("playlist: asd\nLast-Modified: 2010-08-02T08:39:28Z\nplaylist: foo\nLast-Modified: 2010-08-11T07:35:43Z\nplaylist: nowa\nLast-Modified: 2010-08-02T07:39:52Z\n")
|
143
|
+
expected_output = Array.new
|
144
|
+
expected_output << {:playlist => "asd"}
|
145
|
+
expected_output << {:playlist => "foo"}
|
146
|
+
expected_output << {:playlist => "nowa"}
|
147
|
+
assert_equal(expected_output,@mpc.list_playlists)
|
148
|
+
end
|
140
149
|
end
|
metadata
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mpc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 1
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: "0.
|
8
|
+
- 5
|
9
|
+
version: "0.5"
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- "Micha\xC5\x82 Krzy\xC5\xBCanowski"
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-08-
|
17
|
+
date: 2010-08-11 00:00:00 +02:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|