spec/discoverer/model_spec.rb in discoverer-0.0.2 vs spec/discoverer/model_spec.rb in discoverer-0.0.3
- old
+ new
@@ -7,14 +7,10 @@
it 'should include Discoverer::Writer' do
Discoverer::Model.ancestors.should include Discoverer::Writer
end
- it 'should include Virtus' do
- Discoverer::Model.ancestors.should include Virtus
- end
-
it 'should include the attribute _id' do
flag = false
Discoverer::Model.attribute_set.each do |attribute|
flag = true if attribute.name == :_id
end
@@ -51,11 +47,11 @@
end
context 'only one attribute is set' do
context 'my_attr was set' do
it 'should return the attribute that was set' do
- Discoverer::Model.any_instance.should_receive(:from).and_return stub(:default => nil)
+ Discoverer::Model.any_instance.should_receive(:from).and_return double(:default => nil)
model = Discoverer::Model.new :my_attr => "value"
model.attributes!.should == { :my_attr => "value" }
end
end
@@ -112,22 +108,22 @@
end
end
context 'a Hash without _id key is passed' do
it 'should return a new instance with the attributes set' do
- reader = stub 'reader'
+ reader = double 'reader'
Discoverer::Model.any_instance.should_receive(:from).and_return reader
reader.should_receive :default
mod = Discoverer::Model.new :my_attr => "345345"
mod.my_attr.should == "345345"
end
it 'should call the reader #from and send the method #default' do
- reader = stub 'reader'
+ reader = double 'reader'
Discoverer::Model.any_instance.should_receive(:from).and_return reader
reader.should_receive :default
Discoverer::Model.new :my_attr => "234"
end
end
end
end
-end
\ No newline at end of file
+end