Skip to content
Browse files

Retain the search term when making requests.

  • Loading branch information...
1 parent e1cd65b commit b47fa2e7dea9e3102c0f4c1a8d4b4d9a3ace463c @mdub committed
Showing with 10 additions and 1 deletion.
  1. +1 −1 lib/ituner/server/app.rb
  2. +1 −0 lib/ituner/server/views/home.haml
  3. +8 −0 spec/ituner/server/app_spec.rb
View
2 lib/ituner/server/app.rb
@@ -83,7 +83,7 @@ def track_detail(track)
track = ITuner::Track.find_by_uid(Integer(track_uid))
Requests.add_track(track)
end
- redirect to("/")
+ redirect to("/?term=#{Rack::Utils.escape(params["term"])}")
end
end
View
1 lib/ituner/server/views/home.haml
@@ -21,6 +21,7 @@
- if @search_results
%hr
%form#request(method="POST" action="/request")
+ %input(name="term" type="hidden"){:value => params["term"]}
%ul.results
- @search_results.each do |track|
%li.track
View
8 spec/ituner/server/app_spec.rb
@@ -1,3 +1,5 @@
+# encoding: UTF-8
+
require "spec_helper"
describe ITuner::Server::App, :type => :acceptance do
@@ -69,6 +71,12 @@
end
end
+ it "retains the search term" do
+ within("#search") do
+ find_field("term").value.should == "Kind Of Blue"
+ end
+ end
+
it "ensures that something is playing" do
ITuner.itunes.should be_playing
end

0 comments on commit b47fa2e

Please sign in to comment.
Something went wrong with that request. Please try again.