rest_my_case 1.11.6 → 1.11.7

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b2edc1683cfac54d73e202db382869d8c50be5ce
4
- data.tar.gz: 19425b028f784e2725900da5e083cb2d2db0d87d
3
+ metadata.gz: 626ba1eecdf25814ed56cafae419c38d7c4ea889
4
+ data.tar.gz: c797998649c9038af80eff4017293ee03c024f66
5
5
  SHA512:
6
- metadata.gz: 447a37cb0f32a72b7153cf76ae15678c5489e5846f3ad3854399b3a252ba75118cf5db4291d5cc391725360f47a054a1390757c5ec86f4fe7243944b706b9675
7
- data.tar.gz: eed1d526260974554e624cdd593ce24c27cf3fed83710c89a7e02fc9dc5b88e419c7dd6786c3175951968009b856fb036b174e49eb07339e7115031c0e748534
6
+ metadata.gz: c296d0cad02320de30050283c5c66b7bf96118383874a22861f7111fc04bd2443e449a20bb93d4ac44e9e808eb26345933c12a3afab821e5707cb65a7d26e7b0
7
+ data.tar.gz: 47818e573ff4a6b224bae82c803ee1bca29825bd09f1b77507032ef2427ac0680b840196887e7c9f889142fee9c64d9c9c93fb6375ff5af94589941d0a5b76a6
@@ -10,7 +10,7 @@ module RestMyCase
10
10
  super
11
11
 
12
12
  if error[:status].nil? && error[:message]
13
- error[:status] = error[:message]
13
+ error[:status] = error[:message]
14
14
  error[:message] = nil
15
15
  end
16
16
 
@@ -30,10 +30,10 @@ module RestMyCase
30
30
  validate_context_aborts?(@trial_case.defendant_child)
31
31
 
32
32
  @trial_case.use_cases.each do |use_case|
33
- validate_context_aborts?(use_case)
34
-
35
33
  next if use_case.options[:should_skip] || @use_case_that_aborted
36
34
 
35
+ validate_context_aborts?(use_case)
36
+
37
37
  @performed_use_cases.push use_case
38
38
 
39
39
  method_aborts?(:perform, use_case)
@@ -1,5 +1,5 @@
1
1
  module RestMyCase
2
2
 
3
- VERSION = '1.11.6'
3
+ VERSION = '1.11.7'
4
4
 
5
5
  end
@@ -32,21 +32,17 @@ describe RestMyCase::Base do
32
32
  expect(@context.ok?).to be false
33
33
  end
34
34
 
35
- it "context errors should include 3 context_errors" do
36
- expect(@context.errors.length).to be 3
35
+ it "context errors should only include the first context_errors" do
36
+ expect(@context.errors.length).to be 1
37
37
  expect(@context.errors[0][:context_errors][:id]).to be_truthy
38
- expect(@context.errors[1][:context_errors][:post]).to be_truthy
39
- expect(@context.errors[1][:context_errors][:post_attributes]).to be_truthy
40
- expect(@context.errors[2][:context_errors][:post]).to be_truthy
41
38
  end
42
39
  end
43
40
 
44
41
  context "When the required_context of a class fails and one of the dependencies aborts first" do
45
42
  before { @context = RequiredContext::Comments::Update.perform }
46
43
 
47
- xit "required_context should not have ran" do
48
- binding.pry
49
- # expect(@context.current_user).to be nil
44
+ it "required_context should not have ran" do
45
+ expect(@context.errors.length).to be 1
50
46
  end
51
47
  end
52
48
 
@@ -0,0 +1,33 @@
1
+ require 'spec_helper'
2
+
3
+ describe RestMyCase::Context::Base do
4
+
5
+ describe '#values_at' do
6
+ let(:context) { described_class.new(one: 1, two: 2, three: 3) }
7
+
8
+ context "no params are used" do
9
+ it 'empty array should be returned' do
10
+ expect(context.values_at).to eq []
11
+ end
12
+ end
13
+
14
+ context "when all of the params are known" do
15
+ it 'all of the values should be returned' do
16
+ expect(context.values_at(:one, :two, :three)).to eq [1, 2, 3]
17
+ end
18
+ end
19
+
20
+ context "when trying to extract less values then all of the known attributes" do
21
+ it 'nil will be returned in the place of the unknown' do
22
+ expect(context.values_at(:one, :two, :four)).to eq [1, 2, nil]
23
+ end
24
+ end
25
+
26
+ context "when one of the params is not known" do
27
+ it 'just the known values should be returned' do
28
+ expect(context.values_at(:one, :two)).to eq [1, 2]
29
+ end
30
+ end
31
+ end
32
+
33
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rest_my_case
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.11.6
4
+ version: 1.11.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - goncalvesjoao
@@ -157,6 +157,7 @@ files:
157
157
  - spec/rest_my_case/base/invoke_spec.rb
158
158
  - spec/rest_my_case/base/perform_spec.rb
159
159
  - spec/rest_my_case/base/required_context_spec.rb
160
+ - spec/rest_my_case/context/base_spec.rb
160
161
  - spec/rest_my_case/context/status_spec.rb
161
162
  - spec/rest_my_case/defense_attorney/base_spec.rb
162
163
  - spec/rest_my_case/http_status_spec.rb
@@ -214,6 +215,7 @@ test_files:
214
215
  - spec/rest_my_case/base/invoke_spec.rb
215
216
  - spec/rest_my_case/base/perform_spec.rb
216
217
  - spec/rest_my_case/base/required_context_spec.rb
218
+ - spec/rest_my_case/context/base_spec.rb
217
219
  - spec/rest_my_case/context/status_spec.rb
218
220
  - spec/rest_my_case/defense_attorney/base_spec.rb
219
221
  - spec/rest_my_case/http_status_spec.rb