Sha256: 3f1e59cb3839292511f0444fae9682e31b5634bc7d6682a1296321f94a4bcceb
Contents?: true
Size: 1.26 KB
Versions: 3
Compression:
Stored size: 1.26 KB
Contents
require "rehearsal/version" require "rehearsal/engine" module Rehearsal def self.included(base) base.extend ClassMethods 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) class_eval do define_method(:username) do username end define_method(:password) do password end end Rehearsal.config.enabled = true end end class << self def configure yield(config) end def config=(config_instance) @config = config_instance end def config @config ||= Configuration.new end end private def require_http_basic_auth authenticate_or_request_with_http_basic do |username, password| username == self.username && password == self.password end if rehearsing_with_auth? end def rehearsing? 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
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rehearsal-1.3.3 | lib/rehearsal.rb |
rehearsal-1.3.2 | lib/rehearsal.rb |
rehearsal-1.3.0 | lib/rehearsal.rb |