Sha256: 0cdc4bd8320935e16d09928caddd372282a4ba245576edd851ca03d9b931c5a8
Contents?: true
Size: 1.24 KB
Versions: 7
Compression:
Stored size: 1.24 KB
Contents
require "rails_helper" describe Shamu::Rails::Features, type: :controller do controller ActionController::Base do public :feature_enabled? def show render text: "" end end hunt( :features_service, Shamu::Features::FeaturesService ) do scorpion.new Shamu::Features::FeaturesService, File.expand_path( "../features.yml", __FILE__ ), {} end hunt( :session_store, Shamu::Sessions::CookieStore ) it "resolves toggles" do expect( session_store ).to receive( :fetch ).and_return nil allow( session_store ).to receive( :set ) expect( controller ).to receive( :show ) do expect( controller.feature_enabled?( "shopping/nux" ) ).to be_truthy controller.render text: "" end get :show, id: 1 end it "allows toggles to be overridden by query param" do expect( session_store ).to receive( :fetch ).and_return nil allow( session_store ).to receive( :set ) override = features_service.toggle_codec.pack( "shopping/discounts" => true ) expect( controller ).to receive( :show ) do expect( controller.feature_enabled?( "shopping/discounts" ) ).to be_truthy controller.render text: "" end get :show, id: 1, Shamu::Features::EnvStore::RACK_PARAMS_KEY => override end end
Version data entries
7 entries across 7 versions & 1 rubygems