kalibro_gem 0.0.1.rc13 → 0.0.1.rc14

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: dd8b60835b7edaa3b4e962a9231e6a66099de7b7
4
- data.tar.gz: e7cb4e3dd41a4c456cf8f06e062e7b52958a2726
3
+ metadata.gz: f437b3f0cf0bb7631a536d9d15297d39b6f71b34
4
+ data.tar.gz: fe0fa34a3c8946b5870675308bda01b7a2bfd249
5
5
  SHA512:
6
- metadata.gz: 1ceb5256578e7d651d9ba8b31528c606885a9102a2fe04c84583bef6996de11b63b0affe828b994dcc6e03966ddc71e9d30a4e7033305954333797a2fdb6c5e6
7
- data.tar.gz: c7308b5f8de49e0b3a9ea193abd4622ceca31b098018e0fee760d029d6ae862e99acdddb170dc309e3d4046b61e010c50f5ea76b9323a11a93d4da216f25ad8d
6
+ metadata.gz: 83c4613a5cd8ae7dfec27ad8188c190cae962ec15906d930cd9072baef5a901dd3849e9bf3ac45bb48bcabff8d2bcd85986127d8be6a9982487971776487590a
7
+ data.tar.gz: d3cdf0333cd55f9a7ae985d53161c5f64329c9ccbd6abeb1c36175d5a38b153cfc127557ba6298567f9ba43054ba31e5d317b3775530f3288ca6cf62b8820d1a
@@ -115,14 +115,6 @@ module KalibroGem
115
115
  response
116
116
  end
117
117
 
118
- def self.endpoint
119
- class_name
120
- end
121
-
122
- def instance_class_name
123
- self.class.name.gsub(/KalibroGem::Entities::/,"")
124
- end
125
-
126
118
  protected
127
119
 
128
120
  def instance_variable_names
@@ -145,6 +137,10 @@ module KalibroGem
145
137
  field.to_s[0] != '@' and field != :attributes! and (field.to_s =~ /xsi/).nil?
146
138
  end
147
139
 
140
+ # TODO: Rename to entitie_name
141
+ def instance_class_name
142
+ self.class.class_name
143
+ end
148
144
 
149
145
  include RequestMethods
150
146
  extend RequestMethods::ClassMethods
@@ -153,9 +149,19 @@ module KalibroGem
153
149
  @kalibro_errors << exception
154
150
  end
155
151
 
152
+ def self.endpoint
153
+ class_name
154
+ end
156
155
 
156
+ # TODO: Rename to entitie_name
157
157
  def self.class_name
158
- self.name.gsub(/KalibroGem::Entities::/,"")
158
+ # This loop is a generic way to make this work even when the children class has a different name
159
+ entitie_class = self
160
+ until entitie_class.name.include?("KalibroGem::Entities::") do
161
+ entitie_class = entitie_class.superclass
162
+ end
163
+
164
+ entitie_class.name.gsub(/KalibroGem::Entities::/,"")
159
165
  end
160
166
 
161
167
  include HashConverters
@@ -15,5 +15,5 @@
15
15
  # along with this program. If not, see <http://www.gnu.org/licenses/>.
16
16
 
17
17
  module KalibroGem
18
- VERSION = "0.0.1.rc13"
18
+ VERSION = "0.0.1.rc14"
19
19
  end
@@ -54,16 +54,34 @@ describe KalibroGem::Entities::Model do
54
54
  let(:fixture) { File.read("spec/savon/fixtures/project/does_not_exists.xml") }
55
55
  let(:client) { mock('client') }
56
56
 
57
- it 'should successfully get the Kalibro version' do
58
- client.expects(:call).
59
- with(:project_exists, message: {project_id: 1}).
60
- returns(mock_savon_response(fixture))
61
- KalibroGem::Entities::Model.
62
- expects(:client).
63
- with(any_parameters).
64
- returns(client)
65
- KalibroGem::Entities::Model.
66
- request(:project_exists, {project_id: 1})[:exists].should eq(false)
57
+ context 'for the KalibroGem::Entitie class' do
58
+ it 'should successfully get the Kalibro version' do
59
+ client.expects(:call).
60
+ with(:project_exists, message: {project_id: 1}).
61
+ returns(mock_savon_response(fixture))
62
+ KalibroGem::Entities::Model.
63
+ expects(:client).
64
+ with(any_parameters).
65
+ returns(client)
66
+ KalibroGem::Entities::Model.
67
+ request(:project_exists, {project_id: 1})[:exists].should eq(false)
68
+ end
69
+ end
70
+
71
+ context 'with a children class from outside' do
72
+ class Child < KalibroGem::Entities::Model; end
73
+
74
+ it 'should successfully get the Kalibro version' do
75
+ client.expects(:call).
76
+ with(:project_exists, message: {project_id: 1}).
77
+ returns(mock_savon_response(fixture))
78
+ Child.
79
+ expects(:client).
80
+ with(any_parameters).
81
+ returns(client)
82
+ Child.
83
+ request(:project_exists, {project_id: 1})[:exists].should eq(false)
84
+ end
67
85
  end
68
86
  end
69
87
 
@@ -272,16 +290,4 @@ describe KalibroGem::Entities::Model do
272
290
  end
273
291
  end
274
292
  end
275
-
276
- describe 'endpoint' do
277
- it 'should return the class name' do
278
- KalibroGem::Entities::Model.endpoint.should eq("Model")
279
- end
280
- end
281
-
282
- describe 'instance_class_name' do
283
- it 'should return the class name' do
284
- subject.instance_class_name.should eq("Model")
285
- end
286
- end
287
293
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kalibro_gem
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1.rc13
4
+ version: 0.0.1.rc14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carlos Morais