Skip to content

Commit

Permalink
Specs for #build_uri
Browse files Browse the repository at this point in the history
  • Loading branch information
tj committed Oct 7, 2009
1 parent cab4f53 commit 5f9b590
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions spec/unit/pager_spec.rb
Expand Up @@ -158,5 +158,28 @@
end
end

describe "when passing a uri without a query string" do
it "should append a query string to each uri" do
markup = Item.page.pager.to_html 'items'
markup.should include('items?page=1')
end
end

describe "when passing a uri with a query string" do
describe "containing page=N" do
it "should alter the page value" do
markup = Item.page.pager.to_html 'items?page=2'
markup.should include('items?page=1')
end
end

describe "not containing page=N" do
it "should append a pair" do
markup = Item.page.pager.to_html 'items?foo=bar'
markup.should include('items?foo=bar&page=1')
end
end
end

end
end

0 comments on commit 5f9b590

Please sign in to comment.