Permalink
Browse files

Adding *.gem to ignore list

  • Loading branch information...
1 parent e408a1d commit c391f67a832b5fa215823b6a473c0ebf91061fac @durran durran committed Oct 1, 2009
Showing with 2 additions and 97 deletions.
  1. +2 −1 .gitignore
  2. +0 −22 lib/mongoid/paginator.rb
  3. +0 −74 spec/unit/mongoid/paginator_spec.rb
View
@@ -2,4 +2,5 @@
coverage/*
pkg/*
scratch_directory/*
-tmp/*
+tmp/*
+*.gem
View
@@ -1,22 +0,0 @@
-module Mongoid #:nodoc:
- class Paginator #:nodoc:
-
- attr_reader :limit, :offset
-
- # Create the new Paginator with the supplied options.
- # * Will default to offset 0 if no page defined in the options.
- # * Will default to limit 20 if no per_page defined in the options.
- def initialize(options = {})
- page = options[:page]
- @limit = options[:per_page] || 20
- @offset = page ? (page - 1) * @limit : 0
- end
-
- # Generate the options needed for returning the correct
- # results given the supplied parameters
- def options
- { :limit => @limit, :offset => @offset }
- end
-
- end
-end
@@ -1,74 +0,0 @@
-require File.join(File.dirname(__FILE__), "/../../spec_helper.rb")
-
-describe Mongoid::Paginator do
-
- describe "#limit" do
-
- context "when per_page is defined" do
-
- before do
- @options = { :per_page => 50 }
- @paginator = Mongoid::Paginator.new(@options)
- end
-
- it "returns the per_page value" do
- @paginator.limit.should == 50
- end
-
- end
-
- context "when per_page is not defined" do
-
- before do
- @options = {}
- @paginator = Mongoid::Paginator.new(@options)
- end
-
- it "returns the default of 20" do
- @paginator.limit.should == 20
- end
-
- end
-
- end
-
- describe "#offset" do
-
- context "when page is defined" do
-
- before do
- @options = { :page => 11 }
- @paginator = Mongoid::Paginator.new(@options)
- end
-
- it "returns the page value - 1 * limit" do
- @paginator.offset.should == 200
- end
-
- end
-
- context "when page is not defined" do
-
- before do
- @options = {}
- @paginator = Mongoid::Paginator.new(@options)
- end
-
- it "returns the default of 0" do
- @paginator.offset.should == 0
- end
-
- end
-
- end
-
- describe "#options" do
-
- it "returns a hash of the limit and offset" do
- @paginator = Mongoid::Paginator.new
- @paginator.options.should == { :limit => 20, :offset => 0 }
- end
-
- end
-
-end

0 comments on commit c391f67

Please sign in to comment.