From 39531817e106f56a6815ec4ac08266706e9fae39 Mon Sep 17 00:00:00 2001 From: Beatriz Fernandes Date: Wed, 2 Mar 2022 11:56:36 -0300 Subject: [PATCH] Add new methods to get rollout details (#94) * add new methods to get rollout details * add new tests cases for new methods * add rollout informations to yml file --- lib/feature_flagger/feature.rb | 12 ++++++++++++ spec/feature_flagger/feature_spec.rb | 15 +++++++++++++++ spec/fixtures/rollout_example.yml | 5 ++++- 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/lib/feature_flagger/feature.rb b/lib/feature_flagger/feature.rb index aef56d7..d2ef7a3 100644 --- a/lib/feature_flagger/feature.rb +++ b/lib/feature_flagger/feature.rb @@ -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 diff --git a/spec/feature_flagger/feature_spec.rb b/spec/feature_flagger/feature_spec.rb index 41ee782..b832872 100644 --- a/spec/feature_flagger/feature_spec.rb +++ b/spec/feature_flagger/feature_spec.rb @@ -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' } diff --git a/spec/fixtures/rollout_example.yml b/spec/fixtures/rollout_example.yml index 46fb35e..d982418 100644 --- a/spec/fixtures/rollout_example.yml +++ b/spec/fixtures/rollout_example.yml @@ -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: @@ -25,4 +28,4 @@ other_feature_flagger_dummy_class: account: email_marketing: behavior_score: - description: "Enable behavior score experiment" \ No newline at end of file + description: "Enable behavior score experiment"