caze 0.2.0 → 0.2.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: 4348280a267c35d66793ac71a0bbef6ff6ee3513
4
- data.tar.gz: dd7ecc669f618e9067493246a2210a69b5caa65e
3
+ metadata.gz: 43eeb61fade546b7defd563a4213927a4c2259e2
4
+ data.tar.gz: 77a3de82def4f7d885ff4f1195e24841f5887ccb
5
5
  SHA512:
6
- metadata.gz: 8b63e83e36489b90fb83d508f2309f811437a9a5d4bb8b521040423c588f0de0ebb3d4df453ecfdf1f9cbfadc208a6d742bc06c3bbd5a1e514f67bf24cb528ea
7
- data.tar.gz: 7afbd83e99b8f85b58df53fca3a1ca2f8b4a44f1e84d65c7b050c4ddacf449f8f7d1d97d756b9c103c5ffb4bc32963d8429d94d3c8d004262d6d47fa96a828d3
6
+ metadata.gz: b61f32601639b4bec51770350468c58f49740327d2df99bf8d7b9ca9700cd4585a2952c864a8d449b4d0a4e73f2fdbe7e05aaf46c38f4d8544ac6785cc770648
7
+ data.tar.gz: e38452d8574ed90ad1a8a94c9adc63ad9af91f3b69c832ea0dd7ca0fffb1bb403b8ebc1a91eb387a5a128eeba4070414647ac8ca44ff3e9b654a1bf5248cb76c
@@ -3,6 +3,13 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  This project adheres to [Semantic Versioning](http://semver.org/).
5
5
 
6
+ ## [0.2.1] - 2016-02-29
7
+
8
+ ### Change
9
+
10
+ - Change the way we raise the errors with the `raise_use_case_exception` option:
11
+ it does not instantiate the error again, but changes the parent class reference.
12
+
6
13
  ## [0.2.0] - 2016-01-07
7
14
 
8
15
  ### Change
@@ -36,7 +43,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
36
43
  - Change main methods to define use cases and export them.
37
44
  - Add more details about the API and how to use the lib at README.
38
45
 
39
- [unreleased]: https://github.com/magnetis/caze/compare/v0.2.0...HEAD
46
+ [unreleased]: https://github.com/magnetis/caze/compare/v0.2.1...HEAD
47
+ [0.2.1]: https://github.com/magnetis/caze/compare/v0.2.0...v0.2.1
40
48
  [0.2.0]: https://github.com/magnetis/caze/compare/v0.1.1...v0.2.0
41
49
  [0.1.1]: https://github.com/magnetis/caze/compare/v0.1.0...v0.1.1
42
50
  [0.1.0]: https://github.com/magnetis/caze/compare/v0.0.4...v0.1.0
data/README.md CHANGED
@@ -81,8 +81,8 @@ Inside the use case classes you can use the `.export` method, so in the `UseCase
81
81
  module Project
82
82
  module UseCases
83
83
  class Sum
84
- def self.sum(x ,y)
85
- new(x,y).sum
84
+ def self.sum(x, y)
85
+ new(x, y).sum
86
86
  end
87
87
 
88
88
  def initialize(x, y)
@@ -68,10 +68,11 @@ module Caze
68
68
 
69
69
  error_class = use_case.const_set(demodulized_error_class, base_class)
70
70
 
71
- error_instance = error_class.new(error.message)
72
- error_instance.set_backtrace(error.backtrace)
71
+ error.define_singleton_method(:class) do
72
+ error_class
73
+ end
73
74
 
74
- raise error_instance
75
+ raise error
75
76
  end
76
77
  end
77
78
  end
@@ -1,3 +1,3 @@
1
1
  module Caze
2
- VERSION = "0.2.0"
2
+ VERSION = '0.2.1'
3
3
  end
@@ -2,13 +2,19 @@ require 'spec_helper'
2
2
  require 'caze'
3
3
 
4
4
  describe Caze do
5
+
5
6
  before do
6
7
  # Removing constant definitions if they exist
7
8
  # This avoids state to be permanent through tests
8
- [:DummyUseCase, :DummyUseCaseWithParam, :Dummy, :DummyUseCaseTest].each do |const|
9
+ [:DummyUseCase,
10
+ :DummyUseCaseWithParam,
11
+ :Dummy,
12
+ :DummyError,
13
+ :DummyUseCaseTest].each do |const|
9
14
  Object.send(:remove_const, const) if Object.constants.include?(const)
10
15
  end
11
16
 
17
+ class DummyError < StandardError; end
12
18
  class DummyUseCase
13
19
  include Caze
14
20
 
@@ -48,7 +54,7 @@ describe Caze do
48
54
  export :the_question
49
55
 
50
56
  def the_question
51
- raise 'We do not know the question'
57
+ raise DummyError.new("We don't know the question")
52
58
  end
53
59
  end
54
60
 
@@ -134,7 +140,7 @@ describe Caze do
134
140
  it 'raises with the namespace of the use case' do
135
141
  expect {
136
142
  namespaced_use_case.the_question
137
- }.to raise_error(DummyUseCaseTest::RuntimeError)
143
+ }.to raise_error(DummyUseCaseTest::DummyError)
138
144
  end
139
145
  end
140
146
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: caze
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Philip Sampaio
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-01-07 00:00:00.000000000 Z
12
+ date: 2016-02-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler