light-service 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 +4 -4
- data/README.md +6 -2
- data/lib/light-service/context.rb +5 -5
- data/lib/light-service/version.rb +1 -1
- data/spec/context_spec.rb +14 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 075a5390fc8de72c59eb0f3be049cff74a286a48
|
4
|
+
data.tar.gz: 7a86920ff7b6e4fe62d9123a3b868741cca216eb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3c35a6ce18183266e3df8aaa361b9d5271c95330507e276c0393bfbfea82614b5890d3ed043a3ce64bcd3912cdbb96ef7fe6b5b10d3785e8760ddeb796bff2c6
|
7
|
+
data.tar.gz: d2083efec69ab5b70ff3befe6f428ce742e687ab6e6f3ac8c32e7447970905e573cd6741c7f35460dd7842e40ab52b90ad1603a03866dcd1cc959367496590c6
|
data/README.md
CHANGED
@@ -189,9 +189,13 @@ Huge thanks to the [contributors](https://github.com/adomokos/light-service/grap
|
|
189
189
|
|
190
190
|
## Release Notes
|
191
191
|
|
192
|
+
### 0.2.1
|
193
|
+
* [Improving](https://github.com/adomokos/light-service/commit/fc7043241396b4a2556e9664c13c6929f8330025) deprecation warning for the renamed methods
|
194
|
+
* Making the message an optional argument for `succeed!` and `fail!` methods
|
195
|
+
|
192
196
|
### 0.2.0
|
193
|
-
* [Renaming](https://github.com/adomokos/light-service/commit/8d40ff7d393a157a8a558f9e4e021b8731550834) the `set_success!` and `set_failure!` methods to `succeed!` and `fail
|
194
|
-
* [Throwing](https://github.com/adomokos/light-service/commit/5ef315b8aeeafc99e38676adad3c11df5d93b0e3) an ArgumentError if the `make` method's argument is not Hash or LightService::Context
|
197
|
+
* [Renaming](https://github.com/adomokos/light-service/commit/8d40ff7d393a157a8a558f9e4e021b8731550834) the `set_success!` and `set_failure!` methods to `succeed!` and `fail!`
|
198
|
+
* [Throwing](https://github.com/adomokos/light-service/commit/5ef315b8aeeafc99e38676adad3c11df5d93b0e3) an ArgumentError if the `make` method's argument is not Hash or LightService::Context
|
195
199
|
|
196
200
|
## License
|
197
201
|
|
@@ -46,26 +46,26 @@ module LightService
|
|
46
46
|
end
|
47
47
|
|
48
48
|
def set_success!(message)
|
49
|
-
warn 'DEPRECATED:
|
49
|
+
warn '`set_success!` is DEPRECATED: please use `succeed!` instead'
|
50
50
|
succeed!(message)
|
51
51
|
end
|
52
52
|
|
53
|
-
def succeed!(message)
|
53
|
+
def succeed!(message=nil)
|
54
54
|
@message = message
|
55
55
|
@outcome = ::LightService::Outcomes::SUCCESS
|
56
56
|
end
|
57
57
|
|
58
58
|
def set_failure!(message)
|
59
|
-
warn 'DEPRECATED:
|
59
|
+
warn '`set_failure!` is DEPRECATED: please use `fail!` instead'
|
60
60
|
fail!(message)
|
61
61
|
end
|
62
62
|
|
63
|
-
def fail!(message)
|
63
|
+
def fail!(message=nil)
|
64
64
|
@message = message
|
65
65
|
@outcome = ::LightService::Outcomes::FAILURE
|
66
66
|
end
|
67
67
|
|
68
|
-
def skip_all!(message
|
68
|
+
def skip_all!(message=nil)
|
69
69
|
@message = message
|
70
70
|
@skip_all = true
|
71
71
|
end
|
data/spec/context_spec.rb
CHANGED
@@ -53,12 +53,26 @@ module LightService
|
|
53
53
|
expect(context).to be_success
|
54
54
|
end
|
55
55
|
|
56
|
+
it "can be pushed into a SUCCESS state without a message" do
|
57
|
+
context = Context.make
|
58
|
+
context.succeed!
|
59
|
+
expect(context).to be_success
|
60
|
+
expect(context.message).to be_nil
|
61
|
+
end
|
62
|
+
|
56
63
|
it "can be pushed into a FAILURE state" do
|
57
64
|
context = Context.make
|
58
65
|
context.fail!("a sad end")
|
59
66
|
expect(context).to be_failure
|
60
67
|
end
|
61
68
|
|
69
|
+
it "can be pushed into a FAILURE state without a message" do
|
70
|
+
context = Context.make
|
71
|
+
context.fail!
|
72
|
+
expect(context).to be_failure
|
73
|
+
expect(context.message).to be_nil
|
74
|
+
end
|
75
|
+
|
62
76
|
it "can set a flag to skip all subsequent actions" do
|
63
77
|
context = Context.make
|
64
78
|
context.skip_all!
|