Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Handle empty playback

  • Loading branch information...
commit a5fdb4e52de0f1f23b1263a778f512aee7e39079 1 parent f6ca46d
@pengwynn authored
Showing with 11 additions and 3 deletions.
  1. +2 −0  lib/rdio/desktop_bridge.rb
  2. +9 −3 spec/rdio/desktop_bridge_spec.rb
View
2  lib/rdio/desktop_bridge.rb
@@ -47,6 +47,8 @@ def current_album
end
def now_playing(text=nil)
+ return "Nothing playing" if current_track.empty?
+
text ||= "Now playing: %{track} / %{artist} / %{album}"
text % {
:artist => current_artist,
View
12 spec/rdio/desktop_bridge_spec.rb
@@ -93,17 +93,23 @@
context "displaying now playing info" do
- before do
+ it "displays track, artist, and album by default" do
@bridge.stub(:current_track).and_return("Hurt")
@bridge.stub(:current_artist).and_return("Johnny Cash")
@bridge.stub(:current_album).and_return("The Man Comes Around")
- end
- it "displays track, artist, and album by default" do
expect(@bridge.now_playing).to \
eq("Now playing: Hurt / Johnny Cash / The Man Comes Around")
end
+ it "handles nothing playing" do
+ @bridge.stub(:current_track).and_return('')
+ @bridge.stub(:current_artist).and_return('')
+ @bridge.stub(:current_album).and_return('')
+
+ expect(@bridge.now_playing).to eq("Nothing playing")
+ end
+
end
context "URLs" do
Please sign in to comment.
Something went wrong with that request. Please try again.