Skip to content

Instantly share code, notes, and snippets.

@jqr
Forked from anonymous/gist:57476
Created February 3, 2009 13:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jqr/57524 to your computer and use it in GitHub Desktop.
Save jqr/57524 to your computer and use it in GitHub Desktop.
module ApplicationHelper
def self_url(options = {})
url_for(request.path_parameters.merge(options))
end
end
describe ApplicationHelper do
describe '#self_url' do
before(:each) do
# using params we can easily detect a reverse merge with
@params = { :merged => false, :from_params => true }
@args = { :merged => true, :from_args => true }
@merged_params = @params.merge(@args)
@request = mock(Object, :path_parameters => @params)
helper.should_receive(:request).and_return(@request)
end
it "should return the url for the new params merged with the old params" do
helper.self_url(@args).should == url_for(@merged_params)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment