Skip to content

Commit

Permalink
Pin mongoid on version 4
Browse files Browse the repository at this point in the history
  • Loading branch information
suweller committed Jul 11, 2014
1 parent cda4f81 commit e8299ca
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 18 deletions.
23 changes: 13 additions & 10 deletions mongoid-autoinc.gemspec
@@ -1,20 +1,23 @@
# -*- encoding: utf-8 -*-
$:.push File.expand_path("../lib", __FILE__)
$:.push File.expand_path('../lib', __FILE__)
require 'autoinc/version'

Gem::Specification.new do |s|
s.name = "mongoid-autoinc"
s.version = Mongoid::Autoinc::VERSION
s.platform = Gem::Platform::RUBY
s.authors = ["Robert Beekman", "Steven Weller", "Jacob Vosmaer"]
s.email = ["robert@80beans.com", "steven@80beans.com", "jacob@80beans.com"]
s.homepage = "https://github.com/80beans/mongoid-autoinc"
s.summary = %q{Add auto incrementing fields to mongoid documents}
s.description = %q{Think auto incrementing field from MySQL for mongoid.}
s.name = 'mongoid-autoinc'
s.version = Mongoid::Autoinc::VERSION
s.platform = Gem::Platform::RUBY
s.authors = ['Robert Beekman', 'Steven Weller', 'Jacob Vosmaer']
s.email = %w(robert@80beans.com steven@80beans.com jacob@80beans.com)
s.homepage = 'https://github.com/suweller/mongoid-autoinc'
s.summary = %q(Add auto incrementing fields to mongoid documents)
s.description = %q(Think auto incrementing field from SQL for mongoid.)
s.files = Dir.glob("lib/**/*") + %w(README.md)
s.license = 'MIT'
s.executables = s.files.grep(%r(^bin/)) { |f| File.basename(f) }
s.test_files = s.files.grep(%r(^(test|spec|features)/))
s.require_path = 'lib'

s.add_dependency 'mongoid', '~> 3.0'
s.add_dependency 'mongoid', '~> 4.0'
s.add_development_dependency 'rake'
s.add_development_dependency 'foreman'
s.add_development_dependency 'rspec'
Expand Down
16 changes: 8 additions & 8 deletions spec/autoinc_spec.rb
Expand Up @@ -7,23 +7,17 @@
subject { User }

it { should respond_to(:increments) }
it { should respond_to :incrementing_fields }
it { should respond_to(:incrementing_fields) }

describe "incrementing_fields" do
describe ".incrementing_fields" do
subject { User.incrementing_fields }

it { should == {:number => {:auto => true}} }
it "should protect number" do
User.protected_attributes.include? :number
end

context "for SpecialUser" do
subject { SpecialUser.incrementing_fields }

it { should == {:number => {:auto => true}} }
it "should protect number" do
User.protected_attributes.include? :number
end
end

context "for PatientFile" do
Expand Down Expand Up @@ -58,6 +52,12 @@
it { subject[:number][:step].should be_a Proc }
end
end

describe ".increments" do
before { SpecialUser.stub(:attr_protected) }
specify { SpecialUser.should_receive(:attr_protected).with(:foo) }
after { SpecialUser.increments(:foo) }
end
end

context "instance methods" do
Expand Down

0 comments on commit e8299ca

Please sign in to comment.