-
-
Notifications
You must be signed in to change notification settings - Fork 710
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUU] Enable admin_style_v3 for new users from 3/07/2024 #12606
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class ActivateAdminStyleV3ForNewUsers < ActiveRecord::Migration[7.0] | ||
def up | ||
Flipper.enable_group(:admin_style_v3, :new_2024_07_03) | ||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'spec_helper' | ||
require_relative '../../db/migrate/20240625024328_activate_admin_style_v3_for_new_users' | ||
|
||
RSpec.describe ActivateAdminStyleV3ForNewUsers do | ||
it "activates new product screen for new users" do | ||
Timecop.freeze Time.zone.parse("2024-07-03") do | ||
user_new = create(:user) | ||
|
||
expect { | ||
subject.up | ||
}.to change { | ||
OpenFoodNetwork::FeatureToggle.enabled?(:admin_style_v3, user_new) | ||
}.to(true) | ||
end | ||
end | ||
|
||
it "doesn't activate new product screen for old users" do | ||
Timecop.freeze Time.zone.parse("2024-07-02") do | ||
user_old = create(:user) | ||
|
||
expect { | ||
subject.up | ||
}.not_to change { | ||
OpenFoodNetwork::FeatureToggle.enabled?(:admin_style_v3, user_old) | ||
} | ||
end | ||
end | ||
Comment on lines
+19
to
+29
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This doesn't quite capture the case of old users still not being activated in the future. So if the logic wasn't based on the creation date but on the current date then we wouldn't catch that. I would have structured the test like this:
But I've seen the code. This is simple enough. 👍 |
||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In another PR, shall we simplify this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea. This code is straight from the Flipper documentation. I'm guessing they chose that format to make it clear that an actor is not guaranteed to be a certain type of object.