zertico 0.5.5 → 0.5.6
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +4 -4
- data/lib/zertico/service.rb +3 -3
- data/lib/zertico/version.rb +2 -2
- data/spec/fake_app/users_controller.rb +2 -0
- data/spec/zertico/service_spec.rb +11 -1
- metadata +5 -9
data/README.md
CHANGED
@@ -48,7 +48,7 @@ class UsersController < ApplicationController
|
|
48
48
|
```
|
49
49
|
|
50
50
|
```ruby
|
51
|
-
module
|
51
|
+
module UsersService
|
52
52
|
include Zertico::Service
|
53
53
|
end
|
54
54
|
```
|
@@ -71,10 +71,10 @@ have the same name of your controller, without the 'Controller' substring. The S
|
|
71
71
|
'Controller' substring with 'Service' like:
|
72
72
|
|
73
73
|
```ruby
|
74
|
-
class
|
74
|
+
class UsersController < Zertico::Controller
|
75
75
|
end
|
76
76
|
|
77
|
-
module
|
77
|
+
module UsersService
|
78
78
|
include Zertico::Service
|
79
79
|
end
|
80
80
|
|
@@ -93,7 +93,7 @@ It is good to put the services on a separate folder called services.
|
|
93
93
|
|
94
94
|
[@mfbmina](https://github.com/mfbmina)
|
95
95
|
|
96
|
-
[@
|
96
|
+
[@silviolrjunior](https://github.com/silviolrjunior)
|
97
97
|
|
98
98
|
## Contributing
|
99
99
|
|
data/lib/zertico/service.rb
CHANGED
@@ -36,10 +36,10 @@ module Zertico
|
|
36
36
|
|
37
37
|
def interface_class
|
38
38
|
begin
|
39
|
-
self.class.name.chomp('Controller').constantize
|
39
|
+
self.class.name.chomp('Controller').singularize.constantize
|
40
40
|
rescue NameError
|
41
|
-
self.class.name.chomp('Controller').split('::').last.constantize
|
41
|
+
self.class.name.chomp('Controller').split('::').last.singularize.constantize
|
42
42
|
end
|
43
43
|
end
|
44
44
|
end
|
45
|
-
end
|
45
|
+
end
|
data/lib/zertico/version.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
1
|
module Zertico
|
2
|
-
VERSION = '0.5.
|
3
|
-
end
|
2
|
+
VERSION = '0.5.6'
|
3
|
+
end
|
@@ -5,6 +5,16 @@ describe Zertico::Service do
|
|
5
5
|
let(:admin_controller) { Admin::UserController.new }
|
6
6
|
let(:profile_controller) { Person::ProfileController.new }
|
7
7
|
let(:object) { Object.new }
|
8
|
+
let(:pluralized_controller) { UsersController.new }
|
9
|
+
|
10
|
+
context 'on a pluralized name controller' do
|
11
|
+
it 'should find the interface model' do
|
12
|
+
pluralized_controller.send(:interface_name).should == 'user'
|
13
|
+
end
|
14
|
+
it 'should find the interface class' do
|
15
|
+
pluralized_controller.send(:interface_class).should == User
|
16
|
+
end
|
17
|
+
end
|
8
18
|
|
9
19
|
context 'on a namespaced controller and interface model' do
|
10
20
|
it 'should find the interface model' do
|
@@ -91,4 +101,4 @@ describe Zertico::Service do
|
|
91
101
|
controller.delete(1).should == { :person => object }
|
92
102
|
end
|
93
103
|
end
|
94
|
-
end
|
104
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zertico
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.6
|
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-
|
12
|
+
date: 2013-08-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -93,6 +93,7 @@ files:
|
|
93
93
|
- spec/fake_app/user_accessor.rb
|
94
94
|
- spec/fake_app/user_controller.rb
|
95
95
|
- spec/fake_app/user_service.rb
|
96
|
+
- spec/fake_app/users_controller.rb
|
96
97
|
- spec/spec_helper.rb
|
97
98
|
- spec/zertico/accessor_spec.rb
|
98
99
|
- spec/zertico/controller_spec.rb
|
@@ -110,21 +111,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
110
111
|
- - ! '>='
|
111
112
|
- !ruby/object:Gem::Version
|
112
113
|
version: '0'
|
113
|
-
segments:
|
114
|
-
- 0
|
115
|
-
hash: -1530396319492029873
|
116
114
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
117
115
|
none: false
|
118
116
|
requirements:
|
119
117
|
- - ! '>='
|
120
118
|
- !ruby/object:Gem::Version
|
121
119
|
version: '0'
|
122
|
-
segments:
|
123
|
-
- 0
|
124
|
-
hash: -1530396319492029873
|
125
120
|
requirements: []
|
126
121
|
rubyforge_project:
|
127
|
-
rubygems_version: 1.8.
|
122
|
+
rubygems_version: 1.8.23
|
128
123
|
signing_key:
|
129
124
|
specification_version: 3
|
130
125
|
summary: Models and patterns used by Zertico
|
@@ -142,6 +137,7 @@ test_files:
|
|
142
137
|
- spec/fake_app/user_accessor.rb
|
143
138
|
- spec/fake_app/user_controller.rb
|
144
139
|
- spec/fake_app/user_service.rb
|
140
|
+
- spec/fake_app/users_controller.rb
|
145
141
|
- spec/spec_helper.rb
|
146
142
|
- spec/zertico/accessor_spec.rb
|
147
143
|
- spec/zertico/controller_spec.rb
|