Skip to content

Commit 67e5583

Browse files
committed
clean up Fixnum usage in rails_spec
1 parent b9e0ff8 commit 67e5583

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

spec/rails_spec.rb

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,14 @@ class Fixnum
281281
end
282282
end
283283

284+
after :all do
285+
class Fixnum
286+
class << self
287+
undef_method :default_per_page, :per_page
288+
end
289+
end
290+
end
291+
284292
it 'should use default per page from model' do
285293
get :index_with_no_per_page, params: {count: 100}
286294

@@ -302,17 +310,10 @@ class Fixnum
302310
end
303311
)
304312
end
313+
end
305314

306-
# This spec has to be last because if we undefine these methods
307-
# at runtime and then invoke another test that uses them, they will
308-
# raise a NoMethodError
315+
context 'default per page in objects without paginator defaults' do
309316
it 'should not fail if model does not respond to per page' do
310-
class Fixnum
311-
class << self
312-
undef_method :default_per_page, :per_page
313-
end
314-
end
315-
316317
get :index_with_no_per_page, params: {count: 100}
317318

318319
expect(response.header['Per-Page']).to eq(

0 commit comments

Comments
 (0)