Skip to content

Commit

Permalink
Merge pull request #5 from kickstarter/railtie-change
Browse files Browse the repository at this point in the history
Changed the railtie to use the before_configuration callback so we ca…
  • Loading branch information
chiliburger committed Aug 26, 2015
2 parents ad13758 + 50a134c commit 7a187d7
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 5 deletions.
1 change: 1 addition & 0 deletions gemfiles/activesupport3.2
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ source "https://rubygems.org"
gemspec path: '../'

gem 'activesupport', '~> 3.2.0'
gem 'minitest', '~> 4.7.5'
4 changes: 2 additions & 2 deletions lib/configs/railtie.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
module Configs
class Railtie < Rails::Railtie
initializer 'configs.rails_settings' do
config.before_configuration do
Configs.config_dir = Rails.root.join('config')
Configs.environment = Rails.env
end
end
end
end
2 changes: 1 addition & 1 deletion lib/configs/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Configs
VERSION = "1.3.0"
VERSION = "1.4.0"
end
6 changes: 5 additions & 1 deletion test/defaults_test.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
require File.expand_path(File.dirname(__FILE__) + '/test_helper')

class DefaultsTest < Configs::TestCase
def get_environment
ENV['RACK_ENV'] ? ENV['RACK_ENV'] : 'default'
end

should "have sane defaults" do
assert_equal Pathname.new('./configs'), Configs.config_dir
assert_equal 'default', Configs.environment
assert_equal get_environment, Configs.environment
end
end
2 changes: 1 addition & 1 deletion test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

require 'minitest/autorun'

class Configs::TestCase < Minitest::Test
class Configs::TestCase < Minitest::Unit::TestCase
def self.should(name, &block) # very simple syntax
define_method("test_should_#{name.gsub(/[ -\/]/, '_').gsub(/[^a-z0-9_]/i, '_')}", &block)
end
Expand Down

0 comments on commit 7a187d7

Please sign in to comment.