rest_my_case 1.11.0 → 1.11.1

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: a0f32849ac70e42eea144b0fc564245bd76afa3a
4
- data.tar.gz: 78ed4d4e6833243cfce284be8ec5d22407084111
3
+ metadata.gz: 34b4504e3df6acbb8c22831dfb24851d6a7f2c5c
4
+ data.tar.gz: 1697d95e8a5982b48fc7ffeda931a4e0532982d1
5
5
  SHA512:
6
- metadata.gz: c3725d52e75e29c2b9b3724ac38522a95a45a48e282a1560e4ce39245094fbc6718911378f67810c3055aff84eef9a7f57da215a0a5e0da982641da4f67e0878
7
- data.tar.gz: 470adc3bfef70af304db5be018f7f57b5adb2d10eed7a17b325110148feccad8887d97fe258743e11f825982029bae19d9e2df5f4811fc430d0342f01cfa8cd1
6
+ metadata.gz: a944d96cb6a3523dcf6cd7223d2dccf917b86b476814e69616c265c1b800a5dd4eba758212c7cd5765b11c6dc4af9e9cdff68a0b0574bbb7bef141d88f7446f7
7
+ data.tar.gz: 40251630c342478270b19f2a6b28ef9cb881d2b19bf185a7be7e0a107c971a92422270f4a69ba9dabb332ba717ec4562213d5f59a5ab5bacedce94719c6a629e
@@ -24,6 +24,7 @@ module RestMyCase
24
24
  end
25
25
 
26
26
  @trial_case.use_cases.push use_case
27
+ @trial_case.defendant_child = use_case
27
28
  end
28
29
 
29
30
  def dependencies(use_case_class)
@@ -27,6 +27,8 @@ module RestMyCase
27
27
  end
28
28
 
29
29
  def run_perform_methods
30
+ validate_context_aborts?(@trial_case.defendant_child)
31
+
30
32
  @trial_case.use_cases.each do |use_case|
31
33
  validate_context_aborts?(use_case)
32
34
 
@@ -3,7 +3,7 @@ module RestMyCase
3
3
 
4
4
  class Case
5
5
 
6
- attr_accessor :use_cases, :should_abort
6
+ attr_accessor :use_cases, :should_abort, :defendant_child
7
7
 
8
8
  attr_reader :context,
9
9
  :defendant,
@@ -1,5 +1,5 @@
1
1
  module RestMyCase
2
2
 
3
- VERSION = '1.11.0'
3
+ VERSION = '1.11.1'
4
4
 
5
5
  end
@@ -12,6 +12,14 @@ describe RestMyCase::Base do
12
12
  end
13
13
  end
14
14
 
15
+ context "When the required_context of a class fails, its dependencies shouldn't run" do
16
+ before { @context = RequiredContext::Users::Create.perform }
17
+
18
+ it "context dependencies should not have ran" do
19
+ expect(@context.current_user).to be nil
20
+ end
21
+ end
22
+
15
23
  context "When dependencies also have a required_context" do
16
24
  before { @context = RequiredContext::Posts::Update.perform }
17
25
 
@@ -6,9 +6,28 @@ module RequiredContext
6
6
  :current_user
7
7
  ]
8
8
  def setup
9
- context.current_user = Object.new
9
+ context.current_user = OpenStruct.new
10
10
  end
11
11
  end
12
+
13
+ class BuildUser < RestMyCase::Base
14
+ def perform
15
+ context.current_user = OpenStruct.new context.current_user_attributes
16
+ end
17
+ end
18
+
19
+ class Save < RestMyCase::Base
20
+ def perform
21
+ context.current_user.save
22
+ end
23
+ end
24
+
25
+ class Create < RestMyCase::Base
26
+ depends BuildUser, Save
27
+
28
+ required_context \
29
+ :current_user
30
+ end
12
31
  end
13
32
 
14
33
  module Posts
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.0
4
+ version: 1.11.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - goncalvesjoao
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-22 00:00:00.000000000 Z
11
+ date: 2016-03-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry