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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8b2f87cd93693142ff67b6ceeed1444b6f7b012f
4
- data.tar.gz: 31f38685142d8e670acaf735beaea1432810b873
3
+ metadata.gz: 10e3a6fccd6b5a4d02f64e2d2e4ccab70c6ae4ae
4
+ data.tar.gz: ab2d1dc16c1044aaa99015c0f01a1a00e4d40551
5
5
  SHA512:
6
- metadata.gz: 5d465bf8cf158efb1f6edb3c57ef6f952d9f6b2667cf39c59a1040884b7cbab83b69f2bd33758bd50187b47604b9385b635e65894bd91dcd92695e61582c59bb
7
- data.tar.gz: 318e9de9d3ce75c78bd78d2802fecd91eb855f0120b55793428e7a3ee01896f3f56cbf5c004ed5855ba524969a931613f03cf1c4aec1e3faef2113167a0400ed
6
+ metadata.gz: 5a81a08295b974c06b928c94f17335495aeb73945c8119305c1634d4c546f8297e5c8b1cc2835abadc971e59b8c096fab719e0ea6237b2c3e96c35d0c498521c
7
+ data.tar.gz: ee7c085267937cab1f9816b638da4c320bfc75ce764b3404247fa3fb9cd856870011a243d49ef4e2b832dc2e4ffb293da1ae7423fdcdce9b0ca61ea6765b6a66
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ language: ruby
2
+
3
+ rvm:
4
+ - '2.0'
5
+ - '2.1'
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
@@ -1 +1,6 @@
1
1
  require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task default: :spec
@@ -55,7 +55,7 @@ module Flipper
55
55
  # @return [Class] the adapter singleton class
56
56
  #
57
57
  def adapter=(adapter)
58
- adapter.singleton_class.include Flipper::Echo::InstanceMethods
58
+ adapter.singleton_class.send :include, Flipper::Echo::InstanceMethods
59
59
  end
60
60
  end
61
61
  end
@@ -59,12 +59,12 @@ module Flipper
59
59
  target if target.is_a?(Flipper::Types::PercentageOfActors)
60
60
  end
61
61
 
62
- # Percentage of random target
62
+ # Percentage of time target
63
63
  #
64
- # @return [Flipper::Types::PercentageOfRandom, nil]
64
+ # @return [Flipper::Types::PercentageOfTime, nil]
65
65
  #
66
- def percentage_of_random
67
- target if target.is_a?(Flipper::Types::PercentageOfRandom)
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.percentage_of_random
50
- "for #{event.percentage_of_random.value}% of random"
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.percentage_of_random
39
- "#{event.percentage_of_random.value}% of random"
38
+ elsif event.percentage_of_time
39
+ "#{event.percentage_of_time.value}% of time"
40
40
  end
41
41
  end
42
42
  end
@@ -4,6 +4,6 @@ module Flipper
4
4
  module Echo
5
5
  # Current gem version
6
6
  #
7
- VERSION = '0.0.2'
7
+ VERSION = '0.0.3'
8
8
  end
9
9
  end
@@ -28,8 +28,8 @@ describe Flipper::Echo::Event do
28
28
  Flipper::Types::PercentageOfActors.new(nil)
29
29
  end
30
30
 
31
- let :percentage_of_random do
32
- Flipper::Types::PercentageOfRandom.new(nil)
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 '#percentage_of_random' do
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.percentage_of_random).to eq(nil)
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: percentage_of_random)
101
+ feature, action, target: percentage_of_time)
102
102
 
103
- expect(event.percentage_of_random).to eq(percentage_of_random)
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 random string' do
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(:percentage_of_random).and_return(percentage)
66
+ allow(event).to receive(:percentage_of_time).and_return(percentage)
67
67
 
68
- expect(message.send(:filters)).to eq('for 10% of random')
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 random message' do
45
+ it 'builds percentage of time message' do
46
46
  allow(event).to(
47
- receive(:percentage_of_random).and_return(double(:random, value: 15)))
47
+ receive(:percentage_of_time).and_return(double(:time, value: 15)))
48
48
 
49
- expect(notifier.send(:target_message, event)).to eq('15% of random')
49
+ expect(notifier.send(:target_message, event)).to eq('15% of time')
50
50
  end
51
51
  end
52
52
  end
@@ -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.2
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: 2015-03-16 00:00:00.000000000 Z
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: