rest_my_case 1.11.5 → 1.11.6

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: 4c5660e340fca5a2c72493838b568106de58b8b7
4
- data.tar.gz: 6cdf81465f94361d5a360032a7bd7e7886846685
3
+ metadata.gz: b2edc1683cfac54d73e202db382869d8c50be5ce
4
+ data.tar.gz: 19425b028f784e2725900da5e083cb2d2db0d87d
5
5
  SHA512:
6
- metadata.gz: fd3046f196683afef78a77e4dd3e0f67db3f035ab5f6f6ab0888546a42ee47e47606fd963608c45efc8f443c37157522d5647267a4269a52fcdf435a5c9e5078
7
- data.tar.gz: 4f9f36ef7279fc9f354a09cd7b75d530a329bf8d09764185f5e1c9169466990134d6a67a397ed952ba32ad248cd47f9138ef8a5f994a9560292a6052a0feba17
6
+ metadata.gz: 447a37cb0f32a72b7153cf76ae15678c5489e5846f3ad3854399b3a252ba75118cf5db4291d5cc391725360f47a054a1390757c5ec86f4fe7243944b706b9675
7
+ data.tar.gz: eed1d526260974554e624cdd593ce24c27cf3fed83710c89a7e02fc9dc5b88e419c7dd6786c3175951968009b856fb036b174e49eb07339e7115031c0e748534
data/README.md CHANGED
@@ -247,6 +247,7 @@ Methods | Behaviour
247
247
  ------- | ---------
248
248
  **#attributes** | Alias to **#marshal_dump**, returns all of the context's stored data.
249
249
  **#to_hash** | Serializes and unserializes **#attributes** turning any existing ruby objects into serialized strings.
250
+ **#values_at(*keys)** | Short for **#attributes.values_at(*keys)**, returns an array with correspondent values for each key.
250
251
  **#valid?** | Checks if **#errors** is empty
251
252
  **#ok?** | Alias to **#valid?**
252
253
  **#success?** | Alias to **#ok?**
@@ -20,6 +20,10 @@ module RestMyCase
20
20
  SchemaValidator::Base
21
21
  end
22
22
 
23
+ def values_at(*keys)
24
+ attributes.values_at(*keys)
25
+ end
26
+
23
27
  def to_hash
24
28
  Marshal.load Marshal.dump(attributes)
25
29
  end
@@ -38,7 +38,6 @@ module RestMyCase
38
38
 
39
39
  method_aborts?(:perform, use_case)
40
40
  end
41
-
42
41
  end
43
42
 
44
43
  def run_rollback_methods
@@ -1,5 +1,5 @@
1
1
  module RestMyCase
2
2
 
3
- VERSION = '1.11.5'
3
+ VERSION = '1.11.6'
4
4
 
5
5
  end
@@ -41,6 +41,15 @@ describe RestMyCase::Base do
41
41
  end
42
42
  end
43
43
 
44
+ context "When the required_context of a class fails and one of the dependencies aborts first" do
45
+ before { @context = RequiredContext::Comments::Update.perform }
46
+
47
+ xit "required_context should not have ran" do
48
+ binding.pry
49
+ # expect(@context.current_user).to be nil
50
+ end
51
+ end
52
+
44
53
  end
45
54
 
46
55
  end
@@ -65,4 +65,24 @@ module RequiredContext
65
65
  end
66
66
  end
67
67
 
68
+ module Comments
69
+ class FindOne < RestMyCase::Base
70
+ def perform
71
+ error!(:not_found)
72
+ end
73
+ end
74
+
75
+ class AssignAttributes < RestMyCase::Base
76
+ required_context :comment
77
+ end
78
+
79
+ class Save < RestMyCase::Base
80
+ required_context :comment
81
+ end
82
+
83
+ class Update < RestMyCase::Base
84
+ depends FindOne, AssignAttributes, Save
85
+ end
86
+ end
87
+
68
88
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rest_my_case
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.11.5
4
+ version: 1.11.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - goncalvesjoao
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-22 00:00:00.000000000 Z
11
+ date: 2016-05-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry