collector 0.0.19 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/collector/repository.rb +3 -1
- data/lib/collector/version.rb +1 -1
- data/test/collector/repository_spec.rb +17 -0
- metadata +2 -2
data/lib/collector/repository.rb
CHANGED
data/lib/collector/version.rb
CHANGED
@@ -3,6 +3,11 @@ require File.expand_path("../../test_helper.rb", __FILE__)
|
|
3
3
|
describe Collector::Repository do
|
4
4
|
|
5
5
|
before do
|
6
|
+
Object.send(:remove_const, :TestModel) if Object.const_defined?(:TestModel)
|
7
|
+
class TestModel
|
8
|
+
include Collector::Model
|
9
|
+
end
|
10
|
+
|
6
11
|
Object.send(:remove_const, :TestRepository) if Object.const_defined?(:TestRepository)
|
7
12
|
class TestRepository
|
8
13
|
include Collector::Repository
|
@@ -47,6 +52,18 @@ describe Collector::Repository do
|
|
47
52
|
|
48
53
|
TestRepository.save_without_updating_timestamps(model)
|
49
54
|
end
|
55
|
+
|
56
|
+
it "returns the model with the its id set" do
|
57
|
+
model = TestModel.new
|
58
|
+
TestRepository.expects(:serialize!).with(model).returns({ foo: "bar" })
|
59
|
+
|
60
|
+
collection = mock { expects(:save).with({ foo: "bar" }).returns("123abc") }
|
61
|
+
TestRepository.stubs(:collection).returns(collection)
|
62
|
+
|
63
|
+
updated_model = TestRepository.save_without_updating_timestamps(model)
|
64
|
+
updated_model.must_equal model
|
65
|
+
updated_model.id.must_equal "123abc"
|
66
|
+
end
|
50
67
|
end
|
51
68
|
|
52
69
|
describe "delete" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: collector
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-01-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|