active_model_form_objects 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7f8cb216c5ebba58e667784f548948f964d79be3
|
4
|
+
data.tar.gz: 428bb124bc17777b52bf87e292d0001f1cdb5fb7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c29b6a8af2f70b5a708cc88ee9cfee84645ba8b80795a762b028b7df2ca80ebea3492d23443d80d386ca2d4811f066d6c203a9437a0b327ef9e263748677807d
|
7
|
+
data.tar.gz: 52bfb2ea3a22a429dbf8ac138b7869637a55572cc1c14b2fd6ddab2f55c77c3687f48cb4db65e88546259715c16d6acc2b836481843b4442b959c7e881a36c5e
|
@@ -1,42 +1,46 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
shared_examples 'a form_object' do
|
4
|
-
|
4
|
+
describe "#persisted?" do
|
5
|
+
it "should be false" do
|
6
|
+
expect(subject.persisted?).to eq false
|
7
|
+
end
|
8
|
+
end
|
5
9
|
|
6
10
|
describe ".model_name" do
|
7
11
|
it "should be instance of ActiveModel::Name" do
|
8
|
-
subject.class.model_name.
|
12
|
+
expect(subject.class.model_name).to be_an_instance_of ActiveModel::Name
|
9
13
|
end
|
10
14
|
end
|
11
15
|
|
12
16
|
context "when valid" do
|
13
17
|
before(:each) do
|
14
|
-
subject.
|
18
|
+
allow(subject).to receive(:valid?).and_return(true)
|
15
19
|
end
|
16
20
|
|
17
21
|
it "should receive #persist!" do
|
18
|
-
subject.
|
22
|
+
expect(subject).to receive(:persist!)
|
19
23
|
subject.save
|
20
24
|
end
|
21
25
|
|
22
26
|
it "#save returns true" do
|
23
|
-
subject.
|
24
|
-
subject.save.
|
27
|
+
allow(subject).to receive(:persist!).and_return(true)
|
28
|
+
expect(subject.save).to eq(true)
|
25
29
|
end
|
26
30
|
end
|
27
31
|
|
28
32
|
context "when invalid" do
|
29
33
|
before(:each) do
|
30
|
-
subject.
|
34
|
+
allow(subject).to receive(:valid?).and_return(false)
|
31
35
|
end
|
32
36
|
|
33
37
|
it "shouldn't receive #persist!" do
|
34
|
-
subject.
|
38
|
+
expect(subject).not_to receive(:persist!)
|
35
39
|
subject.save
|
36
40
|
end
|
37
41
|
|
38
42
|
it "#save returns false" do
|
39
|
-
subject.save.
|
43
|
+
expect(subject.save).to eq false
|
40
44
|
end
|
41
45
|
end
|
42
46
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_model_form_objects
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Freer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-02-
|
11
|
+
date: 2014-02-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|