Skip to content
This repository has been archived by the owner on Dec 1, 2021. It is now read-only.

Commit

Permalink
Fix pagination specs to work with new pagination
Browse files Browse the repository at this point in the history
  • Loading branch information
mattvague authored and gregbell committed Nov 25, 2011
1 parent dc7f3a8 commit 75a1123
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions spec/unit/views/components/paginated_collection_spec.rb
Expand Up @@ -39,7 +39,7 @@
let(:pagination) { paginated_collection(collection, :param_name => :post_page) }

it "should customize the page number parameter in pagination links" do
pagination.find_by_class('pagination_information').first.content.should match(/\/admin\/posts\?post_page=2/)
pagination.find_by_tag('div')[1].content.should match(/\/admin\/posts\?post_page=2/)
end
end

Expand All @@ -65,15 +65,15 @@
let(:pagination) { paginated_collection(collection, :entry_name => "message") }

it "should use :entry_name as the collection name" do
pagination.find_by_tag('div').first.content.should == "Displaying <b>1</b> message"
pagination.find_by_class('pagination_information').first.content.should == "Displaying <b>1</b> message"
end
end

context "when specifying :entry_name option with multiple items" do
let(:pagination) { paginated_collection(collection, :entry_name => "message") }

it "should use :entry_name as the collection name" do
pagination.find_by_tag('div').first.content.should == "Displaying <b>all 3</b> messages"
pagination.find_by_class('pagination_information').first.content.should == "Displaying <b>all 3</b> messages"
end
end

Expand All @@ -86,15 +86,15 @@
let(:pagination) { paginated_collection(collection, :entry_name => "singular", :entries_name => "plural") }

it "should use :entry_name as the collection name" do
pagination.find_by_tag('div').first.content.should == "Displaying <b>1</b> singular"
pagination.find_by_class('pagination_information').first.content.should == "Displaying <b>1</b> singular"
end
end

context "when specifying :entry_name and :entries_name option with a multiple items" do
let(:pagination) { paginated_collection(collection, :entry_name => "singular", :entries_name => "plural") }

it "should use :entries_name as the collection name" do
pagination.find_by_tag('div').first.content.should == "Displaying <b>all 3</b> plural"
pagination.find_by_class('pagination_information').first.content.should == "Displaying <b>all 3</b> plural"
end
end

Expand All @@ -107,25 +107,25 @@
let(:pagination) { paginated_collection(collection) }

it "should use 'post' as the collection name when there is no I18n translation" do
pagination.find_by_tag('div').first.content.should == "Displaying <b>1</b> post"
pagination.find_by_class('pagination_information').first.content.should == "Displaying <b>1</b> post"
end

it "should use 'Singular' as the collection name when there is an I18n translation" do
I18n.stub(:translate!) { "Singular" }
pagination.find_by_tag('div').first.content.should == "Displaying <b>1</b> Singular"
pagination.find_by_class('pagination_information').first.content.should == "Displaying <b>1</b> Singular"
end
end

context "when omitting :entry_name with multiple items" do
let(:pagination) { paginated_collection(collection) }

it "should use 'posts' as the collection name when there is no I18n translation" do
pagination.find_by_tag('div').first.content.should == "Displaying <b>all 3</b> posts"
pagination.find_by_class('pagination_information').first.content.should == "Displaying <b>all 3</b> posts"
end

it "should use 'Plural' as the collection name when there is an I18n translation" do
I18n.stub(:translate!) { "Plural" }
pagination.find_by_tag('div').first.content.should == "Displaying <b>all 3</b> Plural"
pagination.find_by_class('pagination_information').first.content.should == "Displaying <b>all 3</b> Plural"
end
end

Expand All @@ -138,7 +138,7 @@
let(:pagination) { paginated_collection(collection) }

it "should display 'No entries found'" do
pagination.find_by_tag('div').first.content.should == "No entries found"
pagination.find_by_class('pagination_information').first.content.should == "No entries found"
end
end
end
Expand Down

0 comments on commit 75a1123

Please sign in to comment.