peiji-san 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -1,5 +1,7 @@
1
1
  = Peiji-San
2
2
 
3
+ {<img src="https://secure.travis-ci.org/Fingertips/peiji-san.png" />}[http://travis-ci.org/Fingertips/peiji-san]
4
+
3
5
  Peiji-San uses scopes to create a thin pagination layer.
4
6
 
5
7
  We try to stay out of the way of your application as much as possible. That's
@@ -32,6 +34,26 @@ After that the helpers will be usable in your view.
32
34
  <% end %>
33
35
  <% end %>
34
36
 
37
+ == Sinatra
38
+
39
+ Peiji-san is adept at working together with Sinatra. The only caveat is that
40
+ it uses the *url_for* method, which Sinatra does not provide by default. So you will
41
+ need a recent version of https://github.com/emk/sinatra-url-for. Unfortunately there
42
+ has been no gem releases for it in a while, so we recommend you use
43
+ tobias-sinatra-url-for until the situation improves. Afterwards, in your Sinatra application
44
+
45
+ class MyApp < Sinatra::Base
46
+ helpers Sinatra::UrlForHelper, PeijiSan::ViewHelper
47
+
48
+ get '/' do
49
+ # ...do the job
50
+ @collection = Item.page(params[:page])
51
+ erb :items
52
+ end
53
+ end
54
+
55
+ and in your view you can do exactly the same thing you see in the Rails example.
56
+
35
57
  == Rails 2.3 and earlier
36
58
 
37
59
  The latest version of Peiji only works in Rails 3 because of extensive
data/Rakefile CHANGED
@@ -1,28 +1,14 @@
1
- require 'rubygems'
2
- require 'rake'
3
-
4
- begin
5
- require 'jeweler'
6
- Jeweler::Tasks.new do |s|
7
- s.name = "peiji-san"
8
- s.homepage = "http://github.com/Fingertips/peiji-san"
9
- s.email = "eloy.de.enige@gmail.com"
10
- s.authors = ["Eloy Duran"]
11
- s.summary = s.description = "PeijiSan is a Rails plugin which uses named scopes to create a thin pagination layer."
12
- s.files = FileList['**/**'] # tmp until we've patched Jeweler to be able to easily add files to defaults
1
+ # Fix for those annoying issues when using an older system rake
2
+ module Rake
3
+ module DSL
13
4
  end
14
- rescue LoadError
15
5
  end
16
6
 
17
- begin
18
- require 'jewelry_portfolio/tasks'
19
- JewelryPortfolio::Tasks.new do |p|
20
- p.account = 'Fingertips'
21
- end
22
- rescue LoadError
23
- end
7
+ require 'rubygems'
8
+ require 'bundler'
9
+ Bundler.require
24
10
 
25
- require 'rake/rdoctask'
11
+ require 'rdoc/task'
26
12
  Rake::RDocTask.new do |rdoc|
27
13
  rdoc.rdoc_dir = 'rdoc'
28
14
  rdoc.title = 'PeijiSan'
data/init.rb CHANGED
@@ -1,2 +1,3 @@
1
+ # -*- encoding : utf-8 -*-
1
2
  require 'peiji_san'
2
- require 'peiji_san/view_helper'
3
+ require 'peiji_san/view_helper'
data/lib/peiji_san.rb CHANGED
@@ -1,3 +1,4 @@
1
+ # -*- encoding : utf-8 -*-
1
2
  # Peiji-San uses named scopes to create a thin pagination layer.
2
3
  #
3
4
  # class Member < ActiveRecord::Base
@@ -117,4 +118,4 @@ module PeijiSan
117
118
 
118
119
  entries.limit(entries_per_page).offset((page - 1) * entries_per_page)
119
120
  end
120
- end
121
+ end
@@ -1,3 +1,4 @@
1
+ # -*- encoding : utf-8 -*-
1
2
  module PeijiSan
2
3
  # Optionally defines the peiji_san_options method in your helper to override
3
4
  # the default options.
@@ -46,10 +47,41 @@ module PeijiSan
46
47
  # collection. Defaults to <tt>:current</tt>.
47
48
  def link_to_page(page, paginated_set, options = {}, html_options = {})
48
49
  page_parameter = peiji_san_option(:page_parameter, options)
49
- url_options = (page == 1 ? controller.params.except(page_parameter) : controller.params.merge(page_parameter => page))
50
- url_options[:anchor] = peiji_san_option(:anchor, options)
50
+
51
+ # Sinatra/Rails differentiator
52
+ pageable_params = respond_to?(:controller) ? controller.params : self.params
53
+
54
+ url_options = (page == 1 ? pageable_params.except(page_parameter) : pageable_params.merge(page_parameter => page))
55
+ anchor = peiji_san_option(:anchor, options)
56
+ url_options[:anchor] = anchor if anchor
51
57
  html_options[:class] = peiji_san_option(:current_class, options) if paginated_set.current_page?(page)
52
- link_to page, url_for(url_options), html_options
58
+
59
+ # Again a little fork here
60
+ normalized_url_options = if respond_to?(:controller) # Rails
61
+ url_for(url_options)
62
+ else # Sinatra
63
+ root_path = env['SCRIPT_NAME'].blank? ? "/" : env["SCRIPT_NAME"]
64
+ url_for(root_path, url_options)
65
+ end
66
+
67
+ link_to page, normalized_url_options, html_options
68
+ end
69
+
70
+ # This Rails method is overridden to provide compatibility with other frameworks. By default it will just call super
71
+ # if super is provided. However, you will need your application to provide a standard url_for method
72
+ # in the context where this helper is used. For that you could use https://github.com/emk/sinatra-url-for/
73
+ def link_to(*arguments)
74
+ return super if defined?(super)
75
+
76
+ # What follows is a very simplistic implementation of link_to
77
+ link_text, url, html_options = arguments[0..2]
78
+ html_options[:href] = url
79
+ attr_string = html_options.map do | attribute, value |
80
+ '%s="%s"' % [Rack::Utils.escape_html(attribute), Rack::Utils.escape_html(value)]
81
+ end.join(' ')
82
+
83
+ # Compose the tag
84
+ return "<a %s>%s</a>" % [attr_string, Rack::Utils::escape_html(link_text)]
53
85
  end
54
86
 
55
87
  # Returns an array of pages to link to. This array includes the separator, so
@@ -100,4 +132,4 @@ module PeijiSan
100
132
  end
101
133
  end
102
134
  end
103
- end
135
+ end
@@ -1,17 +1,18 @@
1
+ # -*- encoding : utf-8 -*-
1
2
  require File.expand_path('../test_helper', __FILE__)
2
3
 
3
4
  describe "A model extended by PeijiSan" do
4
5
  it "should define an #entries_per_page= class method with which the max amount of entries per page is specified" do
5
- Member.should.respond_to :entries_per_page=
6
- Member.instance_variable_get(:@entries_per_page).should.be 10
6
+ Member.must_respond_to :entries_per_page=
7
+ Member.instance_variable_get(:@entries_per_page).must_equal 10
7
8
  end
8
9
 
9
10
  it "should define an #entries_per_page reader method" do
10
- Member.entries_per_page.should == 10
11
+ Member.entries_per_page.must_equal 10
11
12
  end
12
13
 
13
14
  it "should have defined a #page class method and added it to the class's scopes" do
14
- Member.should.respond_to :page
15
+ Member.must_respond_to :page
15
16
  end
16
17
  end
17
18
 
@@ -27,38 +28,38 @@ describe "The PeijiSan extended scope" do
27
28
 
28
29
  it "returns entries for the specified page" do
29
30
  page_1 = Member.page(1)
30
- page_1.length.should.be 10
31
- page_1.should == Member.find(:all, :offset => 0, :limit => 10)
31
+ page_1.length.must_equal 10
32
+ page_1.must_equal Member.find(:all, :offset => 0, :limit => 10)
32
33
  end
33
34
 
34
35
  it "returns the correct count of pages" do
35
- Member.all_like_krs_1.page(1).page_count.should.be 11
36
+ Member.all_like_krs_1.page(1).page_count.must_equal 11
36
37
  end
37
38
 
38
39
  it "knows the current page number" do
39
- Member.page(2).current_page.should.be 2
40
- Member.page(4).current_page.should.be 4
40
+ Member.page(2).current_page.must_equal 2
41
+ Member.page(4).current_page.must_equal 4
41
42
  end
42
43
 
43
44
  it "knows if there's a next page" do
44
- Member.page(1).should.next_page
45
- Member.page(20).should.not.next_page
46
- Member.all_like_krs_1.but_ending_with_9.page(1).should.not.next_page
45
+ Member.page(1).next_page.wont_be_nil
46
+ Member.page(20).next_page.must_be_nil
47
+ Member.all_like_krs_1.but_ending_with_9.page(1).next_page.must_be_nil
47
48
  end
48
49
 
49
50
  it "returns the next page number" do
50
- Member.page(1).next_page.should.be 2
51
- Member.page(20).next_page.should.be nil
51
+ Member.page(1).next_page.must_equal 2
52
+ Member.page(20).next_page.must_be_nil
52
53
  end
53
54
 
54
55
  it "knows if there's a previous page" do
55
- Member.page(1).should.not.previous_page
56
- Member.page(20).should.previous_page
56
+ Member.page(1).previous_page.must_be_nil
57
+ Member.page(20).previous_page.wont_be_nil
57
58
  end
58
59
 
59
60
  it "returns the previous page" do
60
- Member.page(1).previous_page.should.be nil
61
- Member.page(20).previous_page.should.be 19
61
+ Member.page(1).previous_page.must_equal nil
62
+ Member.page(20).previous_page.must_equal 19
62
63
  end
63
64
 
64
65
  it "knows if a given page number is the current page" do
@@ -67,30 +68,30 @@ describe "The PeijiSan extended scope" do
67
68
  end
68
69
 
69
70
  it "defaults to page 1 if no valid page argument was given" do
70
- Member.page(nil).current_page.should.be 1
71
- Member.page('').current_page.should.be 1
71
+ Member.page(nil).current_page.must_equal 1
72
+ Member.page('').current_page.must_equal 1
72
73
  end
73
74
 
74
75
  it "casts the page argument to an integer" do
75
- Member.page('2').current_page.should.be 2
76
+ Member.page('2').current_page.must_equal 2
76
77
  end
77
78
 
78
79
  it "takes an optional second argument which overrides the entries_per_page setting" do
79
- Member.all_like_krs_1.page(1, 20).page_count.should.be 6
80
+ Member.all_like_krs_1.page(1, 20).page_count.must_equal 6
80
81
  end
81
82
 
82
83
  it "returns the count of all the entries across all pages for the current scope" do
83
- Member.all_like_krs_1.page(1).unpaged_count.should.be 110
84
- Member.all_like_krs_1.page(2).unpaged_count.should.be 110
85
- Member.all_like_krs_1.but_ending_with_9.page(1).unpaged_count.should.be 10
84
+ Member.all_like_krs_1.page(1).unpaged_count.must_equal 110
85
+ Member.all_like_krs_1.page(2).unpaged_count.must_equal 110
86
+ Member.all_like_krs_1.but_ending_with_9.page(1).unpaged_count.must_equal 10
86
87
  end
87
88
 
88
89
  it "works when chained with other regular named scopes" do
89
- Member.all_like_krs_1.page(1).page_count.should.be 11
90
- Member.all_like_krs_1.but_ending_with_9.page(2).page_count.should.be 1
90
+ Member.all_like_krs_1.page(1).page_count.must_equal 11
91
+ Member.all_like_krs_1.but_ending_with_9.page(2).page_count.must_equal 1
91
92
 
92
- Member.all_like_krs_1.page(2).should == Member.find(:all, :conditions => "name LIKE 'KRS 1%'", :offset => 10, :limit => 10)
93
- Member.all_like_krs_1.but_ending_with_9.page(1).should == Member.find(:all, :conditions => "name LIKE 'KRS 1%' AND name LIKE '%9'", :offset => 0, :limit => 10)
93
+ Member.all_like_krs_1.page(2).must_equal Member.find(:all, :conditions => "name LIKE 'KRS 1%'", :offset => 10, :limit => 10)
94
+ Member.all_like_krs_1.but_ending_with_9.page(1).must_equal Member.find(:all, :conditions => "name LIKE 'KRS 1%' AND name LIKE '%9'", :offset => 0, :limit => 10)
94
95
  end
95
96
 
96
97
  it "should still work when chained through an association proxy" do
@@ -99,10 +100,10 @@ describe "The PeijiSan extended scope" do
99
100
  5.times { member.works.create(:status => 'new') }
100
101
 
101
102
  page = member.reload.works.uploaded.page(1)
102
- page.length.should.be 5
103
- page.page_count.should.be 4
104
- member.works.uploaded.page(4).length.should.be 1
103
+ page.length.must_equal 5
104
+ page.page_count.must_equal 4
105
+ member.works.uploaded.page(4).length.must_equal 1
105
106
 
106
- member.works.page(1).page_count.should.be 5
107
+ member.works.page(1).page_count.must_equal 5
107
108
  end
108
- end
109
+ end
@@ -0,0 +1,43 @@
1
+ # -*- encoding : utf-8 -*-
2
+ require File.expand_path('../test_helper', __FILE__)
3
+ require 'rack/test'
4
+ require 'sinatra/base'
5
+ require 'sinatra/url_for'
6
+ require 'rexml/document'
7
+
8
+ class SimplisticApp < Sinatra::Base
9
+ helpers Sinatra::UrlForHelper, PeijiSan::ViewHelper
10
+ include Mocha::API
11
+
12
+ enable :raise_errors
13
+
14
+ get '/' do
15
+ collection = stub('Artists paginated collection')
16
+ collection.stubs(:current_page?).with(1).returns(false)
17
+ collection.stubs(:current_page?).with(2).returns(false)
18
+ collection.stubs(:page_count).returns(125)
19
+ link_to_page(2, collection)
20
+ end
21
+ end
22
+
23
+ ENV['RACK_ENV'] = 'test'
24
+
25
+ describe "A Sinatra app that uses Peiji-San" do
26
+ include Rack::Test::Methods
27
+
28
+ def app
29
+ SimplisticApp
30
+ end
31
+
32
+ def query_hash(link)
33
+ query = REXML::Document.new(link).root.attributes['href'].match(/\?(.+)$/)[1]
34
+ Rack::Utils.parse_query(query)
35
+ end
36
+
37
+ it "has it's link_to_page method put in place and operational" do
38
+ get '/'
39
+ last_response.status.must_equal 200
40
+ query_hash(last_response.body).must_equal 'page' => '2'
41
+ end
42
+ end
43
+
data/test/test_helper.rb CHANGED
@@ -1,17 +1,21 @@
1
+ # -*- encoding : utf-8 -*-
2
+
1
3
  module PeijiSanTest
2
4
  module Initializer
3
5
  def self.load_dependencies
4
- $:.unshift File.expand_path('../../lib', __FILE__)
5
-
6
- require 'rubygems' rescue LoadError
7
-
6
+ require 'rubygems'
7
+ require 'bundler'
8
+ Bundler.require
9
+
10
+ require 'minitest/autorun'
11
+ require 'minitest/spec'
12
+ require 'mocha'
13
+
8
14
  require 'active_support'
9
15
  require 'active_record'
10
16
  require 'action_view'
11
-
12
- require 'test/spec'
13
- require 'mocha'
14
-
17
+
18
+ $:.unshift File.expand_path('../../lib', __FILE__)
15
19
  require File.expand_path('../../init', __FILE__)
16
20
  end
17
21
 
@@ -65,4 +69,4 @@ class Work < ActiveRecord::Base
65
69
  self.entries_per_page = 5
66
70
 
67
71
  scope :uploaded, where(:status => 'uploaded')
68
- end
72
+ end
@@ -1,3 +1,4 @@
1
+ # -*- encoding : utf-8 -*-
1
2
  require File.expand_path('../test_helper', __FILE__)
2
3
 
3
4
  class TestController
@@ -44,35 +45,35 @@ describe "PeijiSan::ViewHelper::link_to_page" do
44
45
  include PeijiSan::ViewHelper
45
46
 
46
47
  it "should return a link for a given page number" do
47
- link_to_page(2, collection).should == '<a href="/collections?page=2">2</a>'
48
+ link_to_page(2, collection).must_equal '<a href="/collections?page=2">2</a>'
48
49
  end
49
50
 
50
51
  it "should return a link for a given page number with the specified page parameter" do
51
- link_to_page(2, collection, :page_parameter => 'pagina').should == '<a href="/collections?pagina=2">2</a>'
52
+ link_to_page(2, collection, :page_parameter => 'pagina').must_equal '<a href="/collections?pagina=2">2</a>'
52
53
  end
53
54
 
54
55
  it "should return a link for a given page number with the specified anchor" do
55
- link_to_page(2, collection, :anchor => 'dude_so_many_pages').should == '<a href="/collections?page=2#dude_so_many_pages">2</a>'
56
+ link_to_page(2, collection, :anchor => 'dude_so_many_pages').must_equal '<a href="/collections?page=2#dude_so_many_pages">2</a>'
56
57
  end
57
58
 
58
59
  it "should return a link for a given page number and include the original params" do
59
60
  controller.params[:starts_with] = 'h'
60
- link_to_page(2, collection).should == '<a href="/collections?page=2&amp;starts_with=h">2</a>'
61
+ link_to_page(2, collection).must_equal '<a href="/collections?page=2&amp;starts_with=h">2</a>'
61
62
  end
62
63
 
63
64
  it "should return a link which does not include the page GET variable if it's page number 1" do
64
65
  controller.params[:page] = 34
65
- link_to_page(1, collection).should.not.match /page=\d+/
66
+ link_to_page(1, collection).wont_match /page=\d+/
66
67
  end
67
68
 
68
69
  it "should return a link with the class current if it's for the currently selected page" do
69
70
  collection.stubs(:current_page?).with(2).returns(true)
70
- link_to_page(2, collection).should == '<a href="/collections?page=2" class="current">2</a>'
71
+ link_to_page(2, collection).must_equal '<a href="/collections?page=2" class="current">2</a>'
71
72
  end
72
73
 
73
74
  it "should return a link with the class current if it's for the currently selected page" do
74
75
  collection.stubs(:current_page?).with(2).returns(true)
75
- link_to_page(2, collection, :current_class => 'looking_at').should == '<a href="/collections?page=2" class="looking_at">2</a>'
76
+ link_to_page(2, collection, :current_class => 'looking_at').must_equal '<a href="/collections?page=2" class="looking_at">2</a>'
76
77
  end
77
78
  end
78
79
 
@@ -82,56 +83,56 @@ describe "PeijiSan::ViewHelper::pages_to_link_to" do
82
83
 
83
84
  it "should return a list of page numbers that should be included in the pagination list" do
84
85
  collection.stubs(:current_page).returns(83)
85
- pages_to_link_to(collection).should == [1, '…', 80, 81, 82, 83, 84, 85, 86, '…', 125]
86
+ pages_to_link_to(collection).must_equal [1, '…', 80, 81, 82, 83, 84, 85, 86, '…', 125]
86
87
  end
87
88
 
88
89
  it "should return a list of page links with an ellips between page 1 and the next if the current page is at the end of the list" do
89
90
  collection.stubs(:current_page).returns(119)
90
- pages_to_link_to(collection).should == [1, '…', 116, 117, 118, 119, 120, 121, 122, '…', 125]
91
+ pages_to_link_to(collection).must_equal [1, '…', 116, 117, 118, 119, 120, 121, 122, '…', 125]
91
92
 
92
93
  120.upto(124) do |page|
93
94
  collection.stubs(:current_page).returns(page)
94
- pages_to_link_to(collection).should == [1, '…', 117, 118, 119, 120, 121, 122, 123, 124, 125]
95
+ pages_to_link_to(collection).must_equal [1, '…', 117, 118, 119, 120, 121, 122, 123, 124, 125]
95
96
  end
96
97
  end
97
98
 
98
99
  it "should return a list of page links with an ellips between the last page and the previous one if the current page is at the beginning of the list" do
99
100
  1.upto(6) do |page|
100
101
  collection.stubs(:current_page).returns(page)
101
- pages_to_link_to(collection).should == [1, 2, 3, 4, 5, 6, 7, 8, 9, '…', 125]
102
+ pages_to_link_to(collection).must_equal [1, 2, 3, 4, 5, 6, 7, 8, 9, '…', 125]
102
103
  end
103
104
 
104
105
  collection.stubs(:current_page).returns(7)
105
- pages_to_link_to(collection).should == [1, '…', 4, 5, 6, 7, 8, 9, 10, '…', 125]
106
+ pages_to_link_to(collection).must_equal [1, '…', 4, 5, 6, 7, 8, 9, 10, '…', 125]
106
107
  end
107
108
 
108
109
  it "should not show an ellips but all pages if there are only 10 pages, this is the threshold for when an ellips starts to be necessary" do
109
110
  collection.stubs(:page_count).returns(10)
110
111
  collection.stubs(:current_page).returns(5)
111
- pages_to_link_to(collection).should == (1..10).to_a
112
+ pages_to_link_to(collection).must_equal((1..10).to_a)
112
113
  end
113
114
 
114
115
  it "should not return more page links if there aren't that many pages" do
115
116
  1.upto(9) do |page|
116
117
  collection.stubs(:page_count).returns(page)
117
118
  collection.stubs(:current_page).returns(page)
118
- pages_to_link_to(collection).should == (1..page).to_a
119
+ pages_to_link_to(collection).must_equal((1..page).to_a)
119
120
  end
120
121
  end
121
122
 
122
123
  it "should return a list of page numbers that should be included in the pagination list with the specified number of :max_visible" do
123
124
  collection.stubs(:current_page).returns(83)
124
- pages_to_link_to(collection, :max_visible => 5).should == [1, '…', 83, '…', 125]
125
- pages_to_link_to(collection, :max_visible => 15).should == [1, '…', 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, '…', 125]
125
+ pages_to_link_to(collection, :max_visible => 5).must_equal [1, '…', 83, '…', 125]
126
+ pages_to_link_to(collection, :max_visible => 15).must_equal [1, '…', 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, '…', 125]
126
127
 
127
128
  collection.stubs(:current_page).returns(3)
128
- pages_to_link_to(collection, :max_visible => 5).should == [1, 2, 3, '…', 125]
129
- pages_to_link_to(collection, :max_visible => 15).should == (1..13).to_a + ['…', 125]
129
+ pages_to_link_to(collection, :max_visible => 5).must_equal [1, 2, 3, '…', 125]
130
+ pages_to_link_to(collection, :max_visible => 15).must_equal( (1..13).to_a + ['…', 125] )
130
131
  end
131
132
 
132
133
  it "should return a list of page numbers with the specified separator instead of the default ellips" do
133
134
  collection.stubs(:current_page).returns(83)
134
- pages_to_link_to(collection, :separator => '...').should == [1, '...', 80, 81, 82, 83, 84, 85, 86, '...', 125]
135
+ pages_to_link_to(collection, :separator => '...').must_equal [1, '...', 80, 81, 82, 83, 84, 85, 86, '...', 125]
135
136
  end
136
137
  end
137
138
 
@@ -148,25 +149,25 @@ describe "ApplicationHelper, when overriding defaults" do
148
149
  include ApplicationHelperWithDefaults
149
150
 
150
151
  it "should return a link for a given page number with the specified page parameter" do
151
- link_to_page(2, collection).should == '<a href="/collections?pagina=2#dude_so_many_pages">2</a>'
152
+ link_to_page(2, collection).must_equal '<a href="/collections?pagina=2#dude_so_many_pages">2</a>'
152
153
  end
153
154
 
154
155
  it "should return a link for a given page number with the specified anchor" do
155
- link_to_page(2, collection).should == '<a href="/collections?pagina=2#dude_so_many_pages">2</a>'
156
+ link_to_page(2, collection).must_equal '<a href="/collections?pagina=2#dude_so_many_pages">2</a>'
156
157
  end
157
158
 
158
159
  it "should return a link with the class current if it's for the currently selected page" do
159
160
  collection.stubs(:current_page?).with(2).returns(true)
160
- link_to_page(2, collection, :current_class => 'looking_at').should == '<a href="/collections?pagina=2#dude_so_many_pages" class="looking_at">2</a>'
161
+ link_to_page(2, collection, :current_class => 'looking_at').must_equal '<a href="/collections?pagina=2#dude_so_many_pages" class="looking_at">2</a>'
161
162
  end
162
163
 
163
164
  it "should return a list of page numbers that should be included in the pagination list with the specified number of :max_visible" do
164
165
  collection.stubs(:current_page).returns(3)
165
- pages_to_link_to(collection).should == [1, 2, 3, '...', 125]
166
+ pages_to_link_to(collection).must_equal [1, 2, 3, '...', 125]
166
167
  end
167
168
 
168
169
  it "should return a list of page numbers with the specified separator instead of the default ellips" do
169
170
  collection.stubs(:current_page).returns(83)
170
- pages_to_link_to(collection).should == [1, '...', 83, '...', 125]
171
+ pages_to_link_to(collection).must_equal [1, '...', 83, '...', 125]
171
172
  end
172
- end
173
+ end