Sha256: 393ea4ff65b008d449b834b18595ba2e1f27e825c989cbb2fb753464a37fd1e1
Contents?: true
Size: 1.14 KB
Versions: 17
Compression:
Stored size: 1.14 KB
Contents
require "spec_helper" describe Shamu::Features::FeaturesService do hunt( :features_service, Shamu::Features::FeaturesService ) let( :klass ) do Class.new( Shamu::Services::Service ) do include Shamu::Features::Support public :when_feature end end let( :service ) { scorpion.new klass } it "executes the block if enabled" do allow( features_service ).to receive( :enabled? ).and_return true expect do |b| service.when_feature( "example", &b ) end.to yield_control end it "doesn't execute if not enabled" do allow( features_service ).to receive( :enabled? ).and_return false expect do |b| service.when_feature( "example", &b ) end.not_to yield_control end it "can override enabled" do allow( features_service ).to receive( :enabled? ).and_return false expect do |b| service.when_feature( "example", override: true, &b ) end.to yield_control end it "can override disabled" do allow( features_service ).to receive( :enabled? ).and_return true expect do |b| service.when_feature( "example", override: false, &b ) end.not_to yield_control end end
Version data entries
17 entries across 17 versions & 1 rubygems