lib/rehearsal.rb in rehearsal-0.9.2 vs lib/rehearsal.rb in rehearsal-1.0.0
- old
+ new
@@ -2,11 +2,11 @@
require "rehearsal/engine"
module Rehearsal
def self.included(base)
base.extend ClassMethods
- base.helper_method :staging?
+ base.helper_method :rehearsing?
base.before_filter :require_http_basic_auth
end
module ClassMethods
def rehearse_with(options = {})
@@ -20,16 +20,30 @@
end
end
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 staging?
+ end if rehearsing?
end
- def staging?
- Rails.env.staging?
+ def rehearsing?
+ Rails.env.to_sym == Rehearsal.config.env
end
end