spec/firefly/sharing_hyves_spec.rb in firefly-1.5.0 vs spec/firefly/sharing_hyves_spec.rb in firefly-1.5.1

- old
+ new

@@ -1,7 +1,6 @@ # encoding: UTF-8 -# encoding: UTF-8 require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') describe "Sharing" do include Rack::Test::Methods @@ -17,11 +16,11 @@ :title => 'Test post' } end [:post, :get].each do |verb| - describe "hyves" do + describe "hyves via #{verb.to_s.upcase}" do it "should create a shortened URL" do lambda { self.send verb, '/api/share', @params }.should change(Firefly::Url, :count).by(1) end @@ -84,9 +83,17 @@ last_response['Location'].should include(URI.escape("http://test.host/#{url.code}")) last_response['Location'].should_not include(URI.escape(title)) end + it "should strip the title from url encoded entities correctly" do + title = "Test%20post" + self.send verb, '/api/share', @params.merge(:title => title) + url = Firefly::Url.first(:url => @params[:url]) + + last_response['Location'].should include(URI.escape("Test post")) + last_response['Location'].should_not include(URI.escape(title)) + end it "should escape UTF-8 correctly" do title = "Chávez" self.send verb, '/api/share', @params.merge(:title => title) url = Firefly::Url.first(:url => @params[:url])