* FeatureFlag can work with user_id * Use the new methods * No thank you, rubocop * Some tests would be nice * Try to appease codecov --------- Co-authored-by: Ben Halpern <bendhalpern@gmail.com>
19 lines
575 B
Ruby
19 lines
575 B
Ruby
require "rails_helper"
|
|
|
|
RSpec.describe "ApplicationController", type: :request do
|
|
let!(:user) { create(:user) }
|
|
let!(:controller) { ApplicationController.new }
|
|
|
|
before do
|
|
allow(controller).to receive(:current_user).and_return(user)
|
|
end
|
|
|
|
describe "#feature_flag_enabled?" do
|
|
it "calls FeatureFlag.enabled_for_user with current_user" do
|
|
allow(FeatureFlag).to receive(:enabled_for_user?)
|
|
controller.feature_flag_enabled?("flag_name")
|
|
expect(FeatureFlag).to have_received(:enabled_for_user?)
|
|
.with("flag_name", user)
|
|
end
|
|
end
|
|
end
|