fedux_org-stdlib 0.0.19 → 0.0.20
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.
@@ -92,6 +92,8 @@ module FeduxOrg
|
|
92
92
|
#enables a specific instance
|
93
93
|
def enable(name)
|
94
94
|
find(name: name).enable
|
95
|
+
rescue NoMethodError => e
|
96
|
+
raise FeduxOrg::Stdlib::Models::Exceptions::InvalidSearchCriteria, "Sorry I'm not able to enable \"#{name}\". You need to create an instance with name \"#{name}\" first."
|
95
97
|
end
|
96
98
|
|
97
99
|
#finds a single instance
|
@@ -112,7 +114,6 @@ module FeduxOrg
|
|
112
114
|
i.send( "#{c}?".to_sym , v )
|
113
115
|
end
|
114
116
|
end
|
115
|
-
|
116
117
|
rescue NameError => e
|
117
118
|
raise FeduxOrg::Stdlib::Models::Exceptions::InvalidSearchCriteria, e.message
|
118
119
|
end
|
@@ -13,13 +13,37 @@ describe Models::BaseModel do
|
|
13
13
|
Models::BaseModel.register m1
|
14
14
|
end
|
15
15
|
|
16
|
-
|
17
|
-
|
18
|
-
|
16
|
+
context "#find" do
|
17
|
+
it "is possible to find an object" do
|
18
|
+
m1 = Models::BaseModel.new('name')
|
19
|
+
Models::BaseModel.register m1
|
19
20
|
|
20
|
-
|
21
|
+
m_found = Models::BaseModel.find('name')
|
22
|
+
|
23
|
+
expect(m1).to eq(m_found)
|
24
|
+
end
|
25
|
+
|
26
|
+
it "returns nil if no instance is available" do
|
27
|
+
m_found = Models::BaseModel.find('name')
|
28
|
+
|
29
|
+
expect(m_found).to eq(nil)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
context "#enable" do
|
34
|
+
it "enables instances" do
|
35
|
+
m = Models::BaseModel.create(:name1)
|
36
|
+
Models::BaseModel.enable :name1
|
37
|
+
|
38
|
+
expect(Models::BaseModel.all.first).to eq(m)
|
39
|
+
end
|
40
|
+
|
41
|
+
it "raises an error if instance given by name is not available" do
|
42
|
+
expect {
|
43
|
+
Models::BaseModel.enable :name1
|
44
|
+
}.to raise_error FeduxOrg::Stdlib::Models::Exceptions::InvalidSearchCriteria
|
45
|
+
end
|
21
46
|
|
22
|
-
expect(m1).to eq(m_found)
|
23
47
|
end
|
24
48
|
|
25
49
|
it "returns a string of all active instances" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fedux_org-stdlib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.20
|
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: 2013-07-
|
12
|
+
date: 2013-07-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|