Skip to content

Commit 75a1123

Browse files
mattvaguegregbell
authored andcommitted
Fix pagination specs to work with new pagination
1 parent dc7f3a8 commit 75a1123

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

spec/unit/views/components/paginated_collection_spec.rb

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
let(:pagination) { paginated_collection(collection, :param_name => :post_page) }
4040

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

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

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

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

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

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

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

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

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

@@ -107,25 +107,25 @@
107107
let(:pagination) { paginated_collection(collection) }
108108

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

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

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

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

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

@@ -138,7 +138,7 @@
138138
let(:pagination) { paginated_collection(collection) }
139139

140140
it "should display 'No entries found'" do
141-
pagination.find_by_tag('div').first.content.should == "No entries found"
141+
pagination.find_by_class('pagination_information').first.content.should == "No entries found"
142142
end
143143
end
144144
end

0 commit comments

Comments
 (0)