Skip to content

Commit

Permalink
Add new methods to get rollout details (#94)
Browse files Browse the repository at this point in the history
* add new methods to get rollout details

* add new tests cases for new methods

* add rollout informations to yml file
  • Loading branch information
beatrizlf authored Mar 2, 2022
1 parent 4dfcb62 commit 3953181
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
12 changes: 12 additions & 0 deletions lib/feature_flagger/feature.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,18 @@ def description
@data['description']
end

def created_at
@data['created_at']
end

def owner
@data['owner']
end

def full_rollout_until
@data['full_rollout_until']
end

def key
@feature_key.join(':')
end
Expand Down
15 changes: 15 additions & 0 deletions spec/feature_flagger/feature_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,21 @@ module FeatureFlagger
it { expect(subject.description).to eq 'Enable behavior score experiment' }
end

describe '#created_at' do
let(:key) { [:email_marketing, :behavior_score] }
it { expect(subject.created_at).to eq("2019-05-31") }
end

describe '#owner' do
let(:key) { [:email_marketing, :behavior_score] }
it { expect(subject.owner).to eq("Team Name") }
end

describe '#full_rollout_until' do
let(:key) { [:email_marketing, :behavior_score] }
it { expect(subject.full_rollout_until).to eq("2020-12-31") }
end

describe '#key' do
let(:key) { [:email_marketing, :behavior_score] }
let(:resolved_key) { 'feature_flagger_dummy_class:email_marketing:behavior_score' }
Expand Down
5 changes: 4 additions & 1 deletion spec/fixtures/rollout_example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ feature_flagger_dummy_class:
email_marketing:
behavior_score:
description: "Enable behavior score experiment"
created_at: "2019-05-31"
full_rollout_until: "2020-12-31"
owner: "Team Name"
whitelabel:
description: "Enables whitelabel"
other_feature_flagger_dummy_class:
Expand All @@ -25,4 +28,4 @@ other_feature_flagger_dummy_class:
account:
email_marketing:
behavior_score:
description: "Enable behavior score experiment"
description: "Enable behavior score experiment"

0 comments on commit 3953181

Please sign in to comment.