lib/rehearsal.rb in rehearsal-1.2.0 vs lib/rehearsal.rb in rehearsal-1.3.0

- old
+ new

@@ -2,11 +2,13 @@ require "rehearsal/engine" module Rehearsal def self.included(base) base.extend ClassMethods - base.helper_method :rehearsing? + base.helper_method :rehearsing?, + :rehearsing_with_auth?, + :rehearsing_with_banner? base.before_filter :require_http_basic_auth end module ClassMethods def rehearse_with(username, password) @@ -40,13 +42,20 @@ private def require_http_basic_auth authenticate_or_request_with_http_basic do |username, password| username == self.username && password == self.password - end if rehearsing? + end if rehearsing_with_auth? end def rehearsing? - return unless Rehearsal.config.enabled - Rails.env.to_sym == Rehearsal.config.env + Rehearsal.config.enabled + end + + def rehearsing_with_auth? + rehearsing? && Rehearsal.config.auth_envs.include?(Rails.env.to_sym) + end + + def rehearsing_with_banner? + rehearsing? && Rehearsal.config.banner_envs.include?(Rails.env.to_sym) end end