offs 1.1.2 → 1.1.3
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 +4 -4
- data/lib/offs/version.rb +1 -1
- data/lib/offs.rb +3 -1
- data/spec/offs_spec.rb +26 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 871d2b1af7faae40a4d2145ce5820f890fdf88b5
|
4
|
+
data.tar.gz: 3d496751487dd3bfe921d0756a9bacdfc470d161
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5862a48572b882820e151c81521777980f0772050ccc686ab5546b0c6ffc4e31cf6d63f9d812ae0a3df081eb4b65a2a5c155d85e74e99c68dc8e423b0d3b537c
|
7
|
+
data.tar.gz: 95d0e693eca8ce26cb2f84e112e926990a8fe5a6b353d37c05b38354fcb4cb7be54dbabc5b04b6130613c2c04a473f6b73f7a40a8b402658c14eda0f56186da5
|
data/lib/offs/version.rb
CHANGED
data/lib/offs.rb
CHANGED
@@ -24,6 +24,7 @@ class OFFS
|
|
24
24
|
|
25
25
|
def so_you_want_to(&block)
|
26
26
|
block.call(self)
|
27
|
+
return result
|
27
28
|
end
|
28
29
|
|
29
30
|
def would_like_to(&block)
|
@@ -37,9 +38,10 @@ class OFFS
|
|
37
38
|
private
|
38
39
|
|
39
40
|
attr_reader :flag
|
41
|
+
attr_accessor :result
|
40
42
|
|
41
43
|
def when_flag(bool, &block)
|
42
|
-
block.call if flag_status == bool
|
44
|
+
self.result = block.call if flag_status == bool
|
43
45
|
end
|
44
46
|
|
45
47
|
def flag_status
|
data/spec/offs_spec.rb
CHANGED
@@ -30,24 +30,39 @@ describe OFFS do
|
|
30
30
|
end
|
31
31
|
|
32
32
|
context "when the specified feature flag is defined" do
|
33
|
-
let(:would_like_to_blk) { ->{} }
|
34
|
-
let(:may_still_need_to_blk) { ->{} }
|
33
|
+
let(:would_like_to_blk) { ->{ :would_like_to_happened } }
|
34
|
+
let(:may_still_need_to_blk) { ->{ :may_still_need_to_happened } }
|
35
35
|
|
36
|
-
|
36
|
+
def do_it
|
37
37
|
subject.so_you_want_to do |you|
|
38
38
|
you.would_like_to(&would_like_to_blk)
|
39
39
|
you.may_still_need_to(&may_still_need_to_blk)
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
|
+
def do_it_backwards
|
44
|
+
subject.so_you_want_to do |you|
|
45
|
+
you.may_still_need_to(&may_still_need_to_blk)
|
46
|
+
you.would_like_to(&would_like_to_blk)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
43
50
|
context "and the feature is turned on by default" do
|
44
51
|
let(:feature_status) { true }
|
45
52
|
|
46
53
|
it 'executes the would_like_to block' do
|
47
54
|
expect(would_like_to_blk).to receive(:call)
|
55
|
+
do_it
|
48
56
|
end
|
57
|
+
|
49
58
|
it 'does not execute the may_still_need_to block' do
|
50
59
|
expect(may_still_need_to_blk).to_not receive(:call)
|
60
|
+
do_it
|
61
|
+
end
|
62
|
+
|
63
|
+
it 'returns the value of the would_like_to block' do
|
64
|
+
expect(do_it).to eq :would_like_to_happened
|
65
|
+
expect(do_it_backwards).to eq :would_like_to_happened
|
51
66
|
end
|
52
67
|
end
|
53
68
|
|
@@ -56,9 +71,17 @@ describe OFFS do
|
|
56
71
|
|
57
72
|
it "executes the may_still_need_to block" do
|
58
73
|
expect(may_still_need_to_blk).to receive(:call)
|
74
|
+
do_it
|
59
75
|
end
|
76
|
+
|
60
77
|
it 'does not execute the would_like_to block' do
|
61
78
|
expect(would_like_to_blk).to_not receive(:call)
|
79
|
+
do_it
|
80
|
+
end
|
81
|
+
|
82
|
+
it 'returns the value of the may_still_need_to block' do
|
83
|
+
expect(do_it).to eq :may_still_need_to_happened
|
84
|
+
expect(do_it_backwards).to eq :may_still_need_to_happened
|
62
85
|
end
|
63
86
|
end
|
64
87
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: offs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Wilger
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-09-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: injectable_dependencies
|