|
39 | 39 | let(:pagination) { paginated_collection(collection, :param_name => :post_page) } |
40 | 40 |
|
41 | 41 | 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/) |
43 | 43 | end |
44 | 44 | end |
45 | 45 |
|
|
65 | 65 | let(:pagination) { paginated_collection(collection, :entry_name => "message") } |
66 | 66 |
|
67 | 67 | 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" |
69 | 69 | end |
70 | 70 | end |
71 | 71 |
|
72 | 72 | context "when specifying :entry_name option with multiple items" do |
73 | 73 | let(:pagination) { paginated_collection(collection, :entry_name => "message") } |
74 | 74 |
|
75 | 75 | 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" |
77 | 77 | end |
78 | 78 | end |
79 | 79 |
|
|
86 | 86 | let(:pagination) { paginated_collection(collection, :entry_name => "singular", :entries_name => "plural") } |
87 | 87 |
|
88 | 88 | 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" |
90 | 90 | end |
91 | 91 | end |
92 | 92 |
|
93 | 93 | context "when specifying :entry_name and :entries_name option with a multiple items" do |
94 | 94 | let(:pagination) { paginated_collection(collection, :entry_name => "singular", :entries_name => "plural") } |
95 | 95 |
|
96 | 96 | 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" |
98 | 98 | end |
99 | 99 | end |
100 | 100 |
|
|
107 | 107 | let(:pagination) { paginated_collection(collection) } |
108 | 108 |
|
109 | 109 | 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" |
111 | 111 | end |
112 | 112 |
|
113 | 113 | it "should use 'Singular' as the collection name when there is an I18n translation" do |
114 | 114 | 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" |
116 | 116 | end |
117 | 117 | end |
118 | 118 |
|
119 | 119 | context "when omitting :entry_name with multiple items" do |
120 | 120 | let(:pagination) { paginated_collection(collection) } |
121 | 121 |
|
122 | 122 | 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" |
124 | 124 | end |
125 | 125 |
|
126 | 126 | it "should use 'Plural' as the collection name when there is an I18n translation" do |
127 | 127 | 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" |
129 | 129 | end |
130 | 130 | end |
131 | 131 |
|
|
138 | 138 | let(:pagination) { paginated_collection(collection) } |
139 | 139 |
|
140 | 140 | 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" |
142 | 142 | end |
143 | 143 | end |
144 | 144 | end |
|
0 commit comments