Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

More test fixes.

* Make sure allow_mult is true when testing conflicts.
* Make Time types compare properly on both sides of the expectation.
* For some reason ActiveModel classes have strange behavior when
  unnamed. We just remove the class constant at the end of each run.
  • Loading branch information...
commit f09ebf04ce18b10ab8a69c0a8375fad5e4c8fc69 1 parent 17d0ca4
@seancribbs seancribbs authored
View
2  Gemfile.rails30
@@ -1,3 +1,3 @@
-gem 'activemodel', '~> 3.0.0'
+gem 'activemodel', '~> 3.0.11'
instance_eval File.read(File.expand_path('../Gemfile', __FILE__))
View
5 spec/integration/ripple/conflict_resolution_spec.rb
@@ -37,11 +37,8 @@ class ConflictedJob
property :title, String
end
- before :all do
- ConflictedPerson.bucket.allow_mult = true
- end
-
before(:each) do
+ ConflictedPerson.bucket.allow_mult ||= true
ConflictedPerson.on_conflict { } # reset to no-op
end
View
2  spec/ripple/persistence_spec.rb
@@ -63,7 +63,7 @@
end
it "should instantiate and save a new object to riak" do
- json = @widget.attributes.merge(:size => 10, :shipped_at => "2000-01-01T20:15:01Z", :_type => 'Widget')
+ json = @widget.attributes.merge(:size => 10, :shipped_at => Time.utc(2000,"jan",1,20,15,1), :_type => 'Widget')
@client.should_receive(:store_object) do |obj, _, _, _|
obj.key.should be_nil
obj.data.should == json
View
15 spec/ripple/validations_spec.rb
@@ -3,20 +3,16 @@
describe Ripple::Validations do
# require 'support/models/box'
let(:klass) do
- Class.new do
+ class self.class::Valid
include Ripple::Document
self.bucket_name = "validators"
-
- # Anonymous classes have no name
- def self.model_name
- @_model_name ||= ActiveModel::Name.new(self, nil, "Valid")
- end
end
+ self.class::Valid
end
subject { klass.new }
let(:client) { Ripple.client }
-
+ after(:each) { self.class.send :remove_const, :Valid }
before :each do
client.stub(:store_object => true)
end
@@ -88,15 +84,18 @@ def self.model_name
lambda { klass.create! }.should raise_error(Ripple::DocumentInvalid)
end
+
it "should automatically add validations from property options" do
klass.property :size, Integer, :inclusion => {:in => 1..30 }
+
subject.size = 0
subject.should be_invalid
end
it "should run validations at the correct lifecycle state" do
klass.property :size, Integer, :inclusion => {:in => 1..30, :on => :update }
- subject.stub!(:new).and_return(true)
+
+ subject.stub!(:new?).and_return(true)
subject.size = 0
subject.should be_valid
end
Please sign in to comment.
Something went wrong with that request. Please try again.