flipper-echo 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +5 -0
- data/README.md +2 -0
- data/Rakefile +5 -0
- data/lib/flipper/echo/configuration.rb +1 -1
- data/lib/flipper/echo/event.rb +4 -4
- data/lib/flipper/echo/slack/message.rb +2 -2
- data/lib/flipper/echo/stdout/notifier.rb +2 -2
- data/lib/flipper/echo/version.rb +1 -1
- data/spec/flipper/echo/event_spec.rb +6 -6
- data/spec/flipper/echo/slack/message_spec.rb +3 -3
- data/spec/flipper/echo/stdout/notifier_spec.rb +3 -3
- data/spec/flipper/echo_spec.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 10e3a6fccd6b5a4d02f64e2d2e4ccab70c6ae4ae
|
4
|
+
data.tar.gz: ab2d1dc16c1044aaa99015c0f01a1a00e4d40551
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5a81a08295b974c06b928c94f17335495aeb73945c8119305c1634d4c546f8297e5c8b1cc2835abadc971e59b8c096fab719e0ea6237b2c3e96c35d0c498521c
|
7
|
+
data.tar.gz: ee7c085267937cab1f9816b638da4c320bfc75ce764b3404247fa3fb9cd856870011a243d49ef4e2b832dc2e4ffb293da1ae7423fdcdce9b0ca61ea6765b6a66
|
data/README.md
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
# Flipper::Echo
|
2
2
|
|
3
|
+
[![Build Status](https://travis-ci.org/mode/flipper-echo.svg?branch=master)](https://travis-ci.org/mode/flipper-echo)
|
3
4
|
[![Gem Version](https://badge.fury.io/rb/flipper-echo.svg)](http://badge.fury.io/rb/flipper-echo)
|
5
|
+
[![Code Climate](https://codeclimate.com/github/mode/flipper-echo/badges/gpa.svg)](https://codeclimate.com/github/mode/flipper-echo)
|
4
6
|
|
5
7
|
This gem adds a simple callback interface for
|
6
8
|
[Flipper](https://github.com/jnunemaker/flipper) adapter events.
|
data/Rakefile
CHANGED
data/lib/flipper/echo/event.rb
CHANGED
@@ -59,12 +59,12 @@ module Flipper
|
|
59
59
|
target if target.is_a?(Flipper::Types::PercentageOfActors)
|
60
60
|
end
|
61
61
|
|
62
|
-
# Percentage of
|
62
|
+
# Percentage of time target
|
63
63
|
#
|
64
|
-
# @return [Flipper::Types::
|
64
|
+
# @return [Flipper::Types::PercentageOfTime, nil]
|
65
65
|
#
|
66
|
-
def
|
67
|
-
target if target.is_a?(Flipper::Types::
|
66
|
+
def percentage_of_time
|
67
|
+
target if target.is_a?(Flipper::Types::PercentageOfTime)
|
68
68
|
end
|
69
69
|
|
70
70
|
# Passes this event to the configured notifier
|
@@ -46,8 +46,8 @@ module Flipper
|
|
46
46
|
"for actor `#{event.actor.flipper_id}`"
|
47
47
|
elsif event.percentage_of_actors
|
48
48
|
"for #{event.percentage_of_actors.value}% of actors"
|
49
|
-
elsif event.
|
50
|
-
"for #{event.
|
49
|
+
elsif event.percentage_of_time
|
50
|
+
"for #{event.percentage_of_time.value}% of time"
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
@@ -35,8 +35,8 @@ module Flipper
|
|
35
35
|
"actor #{event.actor.flipper_id}"
|
36
36
|
elsif event.percentage_of_actors
|
37
37
|
"#{event.percentage_of_actors.value}% of actors"
|
38
|
-
elsif event.
|
39
|
-
"#{event.
|
38
|
+
elsif event.percentage_of_time
|
39
|
+
"#{event.percentage_of_time.value}% of time"
|
40
40
|
end
|
41
41
|
end
|
42
42
|
end
|
data/lib/flipper/echo/version.rb
CHANGED
@@ -28,8 +28,8 @@ describe Flipper::Echo::Event do
|
|
28
28
|
Flipper::Types::PercentageOfActors.new(nil)
|
29
29
|
end
|
30
30
|
|
31
|
-
let :
|
32
|
-
Flipper::Types::
|
31
|
+
let :percentage_of_time do
|
32
|
+
Flipper::Types::PercentageOfTime.new(nil)
|
33
33
|
end
|
34
34
|
|
35
35
|
describe '#boolean' do
|
@@ -89,18 +89,18 @@ describe Flipper::Echo::Event do
|
|
89
89
|
end
|
90
90
|
end
|
91
91
|
|
92
|
-
describe '#
|
92
|
+
describe '#percentage_of_time' do
|
93
93
|
it 'returns nil if target type does not match' do
|
94
94
|
event = Flipper::Echo::Event.new(feature, action, target: boolean)
|
95
95
|
|
96
|
-
expect(event.
|
96
|
+
expect(event.percentage_of_time).to eq(nil)
|
97
97
|
end
|
98
98
|
|
99
99
|
it 'returns target if target type matches' do
|
100
100
|
event = Flipper::Echo::Event.new(
|
101
|
-
feature, action, target:
|
101
|
+
feature, action, target: percentage_of_time)
|
102
102
|
|
103
|
-
expect(event.
|
103
|
+
expect(event.percentage_of_time).to eq(percentage_of_time)
|
104
104
|
end
|
105
105
|
end
|
106
106
|
|
@@ -58,14 +58,14 @@ describe Flipper::Echo::Slack::Message do
|
|
58
58
|
expect(message.send(:filters)).to eq('for 10% of actors')
|
59
59
|
end
|
60
60
|
|
61
|
-
it 'builds percentage of
|
61
|
+
it 'builds percentage of time string' do
|
62
62
|
event = Flipper::Echo::Event.new(feature, :disabled)
|
63
63
|
message = Flipper::Echo::Slack::Message.new(event)
|
64
64
|
|
65
65
|
percentage = double(:percentage, value: '10')
|
66
|
-
allow(event).to receive(:
|
66
|
+
allow(event).to receive(:percentage_of_time).and_return(percentage)
|
67
67
|
|
68
|
-
expect(message.send(:filters)).to eq('for 10% of
|
68
|
+
expect(message.send(:filters)).to eq('for 10% of time')
|
69
69
|
end
|
70
70
|
end
|
71
71
|
|
@@ -42,11 +42,11 @@ describe Flipper::Echo::Stdout::Notifier do
|
|
42
42
|
expect(notifier.send(:target_message, event)).to eq('15% of actors')
|
43
43
|
end
|
44
44
|
|
45
|
-
it 'builds percentage of
|
45
|
+
it 'builds percentage of time message' do
|
46
46
|
allow(event).to(
|
47
|
-
receive(:
|
47
|
+
receive(:percentage_of_time).and_return(double(:time, value: 15)))
|
48
48
|
|
49
|
-
expect(notifier.send(:target_message, event)).to eq('15% of
|
49
|
+
expect(notifier.send(:target_message, event)).to eq('15% of time')
|
50
50
|
end
|
51
51
|
end
|
52
52
|
end
|
data/spec/flipper/echo_spec.rb
CHANGED
@@ -24,7 +24,7 @@ describe Flipper::Echo do
|
|
24
24
|
describe Flipper::Echo::InstanceMethods do
|
25
25
|
let :adapter do
|
26
26
|
adapter_class.new.tap do |inst|
|
27
|
-
inst.singleton_class.include Flipper::Echo::InstanceMethods
|
27
|
+
inst.singleton_class.send :include, Flipper::Echo::InstanceMethods
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flipper-echo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Heather Rivers
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-09-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: flipper
|
@@ -102,6 +102,7 @@ extensions: []
|
|
102
102
|
extra_rdoc_files: []
|
103
103
|
files:
|
104
104
|
- ".gitignore"
|
105
|
+
- ".travis.yml"
|
105
106
|
- Gemfile
|
106
107
|
- LICENSE.txt
|
107
108
|
- README.md
|
@@ -157,4 +158,3 @@ test_files:
|
|
157
158
|
- spec/flipper/echo_spec.rb
|
158
159
|
- spec/spec_helper.rb
|
159
160
|
- spec/support/adapter_support.rb
|
160
|
-
has_rdoc:
|