-
-
Save jqr/57524 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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