Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Update to latest plucky, toystore, and adapter-mongo.

  • Loading branch information...
commit d473080fb315ac168081b50b1bf4893776c22e9f 1 parent ecbd508
@jnunemaker authored
View
17 Gemfile
@@ -1,19 +1,16 @@
source "http://rubygems.org"
gemspec
-gem 'rake', '~> 0.9.0'
-
-# keep mongo and bson ext at same version
-gem 'mongo', '~> 1.6.0'
-gem 'bson_ext', '~> 1.6.0', :require => false
+gem 'rake'
+gem 'bson_ext', '~> 1.8', :require => false
group(:guard) do
- gem 'guard', '~> 1.0.0'
- gem 'guard-rspec', '~> 0.6.0'
- gem 'guard-bundler', '~> 0.1.0'
- gem 'growl', '~> 1.0.0'
+ gem 'guard'
+ gem 'guard-rspec'
+ gem 'guard-bundler'
+ gem 'growl'
end
group(:test) do
- gem 'rspec', '~> 2.8'
+ gem 'rspec'
end
View
2  lib/toy/mongo/atomic_updates.rb
@@ -42,7 +42,7 @@ def atomic_update(update, opts={})
options = {}
criteria = {:_id => id}
criteria.update(opts[:criteria]) if opts[:criteria]
- options[:safe] = opts.key?(:safe) ? opts[:safe] : adapter.options[:safe]
+ options = adapter.operation_options(nil)
run_callbacks(:save) do
run_callbacks(:update) do
View
2  spec/helper.rb
@@ -10,7 +10,7 @@
require 'support/constants'
require 'support/callbacks_helper'
-STORE = Mongo::Connection.new.db('testing')["toystore-mongo-#{RUBY_VERSION}"]
+STORE = Mongo::MongoClient.new.db('testing')["toystore-mongo-#{RUBY_VERSION}"]
RSpec.configure do |c|
c.include(Support::Constants)
View
29 spec/toy/mongo/atomic_updates_spec.rb
@@ -52,15 +52,24 @@
end
it "defaults to adapter's :safe option" do
- @user.adapter.client.should_receive(:update).with(kind_of(Hash), kind_of(Hash), :safe => nil)
+ User.adapter(:mongo, STORE, :safe => true)
+ @user.adapter.client.should_receive(:update).
+ with(kind_of(Hash), kind_of(Hash), :w => 1)
@user.atomic_update('$set' => {'name' => 'Frank'})
User.adapter(:mongo, STORE, :safe => false)
- @user.adapter.client.should_receive(:update).with(kind_of(Hash), kind_of(Hash), :safe => false)
+ @user.adapter.client.should_receive(:update).
+ with(kind_of(Hash), kind_of(Hash), :w => 0)
@user.atomic_update('$set' => {'name' => 'Frank'})
- User.adapter(:mongo, STORE, :safe => true)
- @user.adapter.client.should_receive(:update).with(kind_of(Hash), kind_of(Hash), :safe => true)
+ User.adapter(:mongo, STORE, :write_concern => {:w => 0})
+ @user.adapter.client.should_receive(:update).
+ with(kind_of(Hash), kind_of(Hash), :w => 0)
+ @user.atomic_update('$set' => {'name' => 'Frank'})
+
+ User.adapter(:mongo, STORE, :write_concern => {:w => 1})
+ @user.adapter.client.should_receive(:update).
+ with(kind_of(Hash), kind_of(Hash), :w => 1)
@user.atomic_update('$set' => {'name' => 'Frank'})
end
@@ -70,18 +79,6 @@
doc.history.should == [:before_save, :before_update, :after_update, :after_save]
end
- context "with :safe option" do
- it "overrides adapter's :safe option" do
- User.adapter(:mongo, STORE, :safe => false)
- @user.adapter.client.should_receive(:update).with(kind_of(Hash), kind_of(Hash), :safe => true)
- @user.atomic_update({'$set' => {'name' => 'Frank'}}, :safe => true)
-
- User.adapter(:mongo, STORE, :safe => true)
- @user.adapter.client.should_receive(:update).with(kind_of(Hash), kind_of(Hash), :safe => false)
- @user.atomic_update({'$set' => {'name' => 'Frank'}}, :safe => false)
- end
- end
-
context "with :criteria option" do
uses_constants('Site')
View
6 toystore-mongo.gemspec
@@ -12,9 +12,9 @@ Gem::Specification.new do |s|
s.summary = %q{Mongo integration for Toystore}
s.description = %q{Mongo integration for Toystore}
- s.add_dependency 'plucky', '~> 0.5'
- s.add_dependency 'toystore', '~> 0.10'
- s.add_dependency 'adapter-mongo', '~> 0.7.0'
+ s.add_dependency 'plucky', '~> 0.6'
+ s.add_dependency 'toystore', '~> 0.13.0'
+ s.add_dependency 'adapter-mongo', '~> 0.8.0'
s.files = `git ls-files`.split("\n") - ['specs.watchr']
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
Please sign in to comment.
Something went wrong with that request. Please try again.