yeti 0.3.7 → 0.3.9
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/yeti/editor.rb +5 -0
- data/lib/yeti/version.rb +1 -1
- data/lib/yeti/viewer.rb +5 -0
- data/spec/yeti/editor_spec.rb +18 -6
- data/spec/yeti/viewer_spec.rb +13 -5
- metadata +3 -3
data/lib/yeti/editor.rb
CHANGED
data/lib/yeti/version.rb
CHANGED
data/lib/yeti/viewer.rb
CHANGED
data/spec/yeti/editor_spec.rb
CHANGED
@@ -288,7 +288,7 @@ describe ::Yeti::Editor do
|
|
288
288
|
subject.mandatory?(:invalid).should be false
|
289
289
|
end
|
290
290
|
end
|
291
|
-
describe "
|
291
|
+
describe "equality" do
|
292
292
|
let(:existing){ mock :object, id: 1, persisted?: true }
|
293
293
|
let(:another){ mock :object, id: 2, persisted?: true }
|
294
294
|
subject{ described_class.from_id context, 1 }
|
@@ -296,21 +296,33 @@ describe ::Yeti::Editor do
|
|
296
296
|
described_class.stub(:find_by_id).with(context, 1).and_return existing
|
297
297
|
described_class.stub(:find_by_id).with(context, 2).and_return another
|
298
298
|
described_class.stub(:new_object).with(context).and_return do
|
299
|
-
mock persisted?: false
|
299
|
+
mock persisted?: false, id: nil
|
300
300
|
end
|
301
301
|
end
|
302
302
|
it "two new editors are not equal" do
|
303
303
|
subject = described_class.new context
|
304
|
-
|
304
|
+
other = described_class.new context
|
305
|
+
subject.should_not == other
|
306
|
+
subject.should_not eql other
|
307
|
+
subject.hash.should == other.hash
|
305
308
|
end
|
306
309
|
it "two editors of the same class with the same id are equal" do
|
307
|
-
|
310
|
+
other = described_class.from_id context, 1
|
311
|
+
subject.should == other
|
312
|
+
subject.should eql other
|
313
|
+
subject.hash.should == other.hash
|
308
314
|
end
|
309
315
|
it "two editors of the same class with different ids are not equal" do
|
310
|
-
|
316
|
+
other = described_class.from_id context, 2
|
317
|
+
subject.should_not == other
|
318
|
+
subject.should_not eql other
|
319
|
+
subject.hash.should_not == other.hash
|
311
320
|
end
|
312
321
|
it "two editors of different classes with the same id are not equal" do
|
313
|
-
|
322
|
+
other = Class.new(described_class).from_id context, 1
|
323
|
+
subject.should_not == other
|
324
|
+
subject.should_not eql other
|
325
|
+
subject.hash.should == other.hash
|
314
326
|
end
|
315
327
|
end
|
316
328
|
end
|
data/spec/yeti/viewer_spec.rb
CHANGED
@@ -2,7 +2,6 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
describe ::Yeti::Viewer do
|
4
4
|
let(:context){ mock :context }
|
5
|
-
subject{ described_class.new context }
|
6
5
|
it ".find_by_id is virtual" do
|
7
6
|
lambda do
|
8
7
|
described_class.find_by_id context, 1
|
@@ -37,7 +36,7 @@ describe ::Yeti::Viewer do
|
|
37
36
|
subject.decorated.should be existing_object
|
38
37
|
end
|
39
38
|
end
|
40
|
-
describe "
|
39
|
+
describe "equality" do
|
41
40
|
let(:existing){ mock :object, id: 1 }
|
42
41
|
let(:another){ mock :object, id: 2 }
|
43
42
|
subject{ described_class.from_id context, 1 }
|
@@ -46,13 +45,22 @@ describe ::Yeti::Viewer do
|
|
46
45
|
described_class.stub(:find_by_id).with(context, 2).and_return another
|
47
46
|
end
|
48
47
|
it "two viewers of the same class with the same id are equal" do
|
49
|
-
|
48
|
+
other = described_class.from_id context, 1
|
49
|
+
subject.should == other
|
50
|
+
subject.should eql other
|
51
|
+
subject.hash.should == other.hash
|
50
52
|
end
|
51
53
|
it "two viewers of the same class with different ids are not equal" do
|
52
|
-
|
54
|
+
other = described_class.from_id context, 2
|
55
|
+
subject.should_not == other
|
56
|
+
subject.should_not eql other
|
57
|
+
subject.hash.should_not == other.hash
|
53
58
|
end
|
54
59
|
it "two viewers of different classes with the same id are not equal" do
|
55
|
-
|
60
|
+
other = Class.new(described_class).from_id context, 1
|
61
|
+
subject.should_not == other
|
62
|
+
subject.should_not eql other
|
63
|
+
subject.hash.should == other.hash
|
56
64
|
end
|
57
65
|
end
|
58
66
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yeti
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.9
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -116,7 +116,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
116
116
|
version: '0'
|
117
117
|
segments:
|
118
118
|
- 0
|
119
|
-
hash:
|
119
|
+
hash: 8619314941788214
|
120
120
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
121
121
|
none: false
|
122
122
|
requirements:
|
@@ -125,7 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
125
125
|
version: '0'
|
126
126
|
segments:
|
127
127
|
- 0
|
128
|
-
hash:
|
128
|
+
hash: 8619314941788214
|
129
129
|
requirements: []
|
130
130
|
rubyforge_project:
|
131
131
|
rubygems_version: 1.8.23
|