Skip to content
Browse files

Gardening

  • Loading branch information...
1 parent eec2a15 commit b4bb50a8049184384d078f0f391e5d02c2cf7faf Francesc Esplugas committed Feb 13, 2010
Showing with 27 additions and 27 deletions.
  1. +9 −9 lib/typus/configuration.rb
  2. +18 −18 test/lib/configuration_test.rb
View
18 lib/typus/configuration.rb
@@ -3,25 +3,25 @@ module Typus
module Configuration
# Default options which can be overwritten from the initializer.
- typus_options = { :app_name => 'Typus',
- :config_folder => 'config/typus',
+ typus_options = { :app_name => "Typus",
+ :config_folder => "config/typus",
:default_password => "columbia",
:email => nil,
:file_preview => :typus_preview,
:file_thumbnail => :typus_thumbnail,
- :relationship => 'typus_users',
- :root => 'admin',
+ :relationship => "typus_users",
+ :root => "admin",
:ssl => false,
- :user_class_name => 'TypusUser',
- :user_fk => 'typus_user_id' }
+ :user_class_name => "TypusUser",
+ :user_fk => "typus_user_id" }
# Default options which can be overwritten from the initializer.
- model_options = { :default_action_on_item => 'edit',
+ model_options = { :default_action_on_item => "edit",
:end_year => nil,
:form_rows => 15,
:index_after_save => false,
:minute_step => 5,
- :nil => 'nil',
+ :nil => "nil",
:on_header => false,
:only_user_items => false,
:per_page => 15,
@@ -36,7 +36,7 @@ module Configuration
def self.config!
files = Dir["#{Rails.root}/#{options[:config_folder]}/**/*.yml"].sort
- files = files.delete_if { |x| x.include?('_roles.yml') }
+ files = files.delete_if { |x| x.include?("_roles.yml") }
@@config = {}
files.each do |file|
View
36 test/lib/configuration_test.rb
@@ -1,4 +1,4 @@
-require 'test/helper'
+require "test/helper"
class ConfigurationTest < ActiveSupport::TestCase
@@ -9,28 +9,28 @@ def test_should_verify_configuration_responds_to_options
def test_should_verify_application_wide_configuration_options
initializer = "#{Rails.root}/config/initializers/typus.rb"
return if File.exist?(initializer)
- assert_equal 'Typus', Typus::Configuration.options[:app_name]
- assert_equal 'vendor/plugins/typus/test/config/working', Typus::Configuration.options[:config_folder]
+ assert_equal "Typus", Typus::Configuration.options[:app_name]
+ assert_equal "vendor/plugins/typus/test/config/working", Typus::Configuration.options[:config_folder]
assert_equal "columbia", Typus::Configuration.options[:default_password]
assert_equal nil, Typus::Configuration.options[:email]
assert_equal :typus_preview, Typus::Configuration.options[:file_preview]
assert_equal :typus_thumbnail, Typus::Configuration.options[:file_thumbnail]
- assert_equal 'typus_users', Typus::Configuration.options[:relationship]
- assert_equal 'admin', Typus::Configuration.options[:root]
+ assert_equal "typus_users", Typus::Configuration.options[:relationship]
+ assert_equal "admin", Typus::Configuration.options[:root]
assert_equal false, Typus::Configuration.options[:ssl]
- assert_equal 'TypusUser', Typus::Configuration.options[:user_class_name]
- assert_equal 'typus_user_id', Typus::Configuration.options[:user_fk]
+ assert_equal "TypusUser", Typus::Configuration.options[:user_class_name]
+ assert_equal "typus_user_id", Typus::Configuration.options[:user_fk]
end
def test_should_verify_model_configuration_options
initializer = "#{Rails.root}/config/initializers/typus.rb"
return if File.exist?(initializer)
- assert_equal 'edit', Typus::Configuration.options[:default_action_on_item]
+ assert_equal "edit", Typus::Configuration.options[:default_action_on_item]
assert_nil Typus::Configuration.options[:end_year]
assert_equal 15, Typus::Configuration.options[:form_rows]
assert_equal false, Typus::Configuration.options[:index_after_save]
assert_equal 5, Typus::Configuration.options[:minute_step]
- assert_equal 'nil', Typus::Configuration.options[:nil]
+ assert_equal "nil", Typus::Configuration.options[:nil]
assert_equal false, Typus::Configuration.options[:on_header]
assert_equal false, Typus::Configuration.options[:only_user_items]
assert_equal 15, Typus::Configuration.options[:per_page]
@@ -49,41 +49,41 @@ def test_should_verify_typus_config_file_is_loaded
end
def test_should_load_configuration_files_from_config_broken
- options = { :config_folder => 'vendor/plugins/typus/test/config/broken' }
+ options = { :config_folder => "vendor/plugins/typus/test/config/broken" }
Typus::Configuration.stubs(:options).returns(options)
assert_not_equal Hash.new, Typus::Configuration.roles!
assert_not_equal Hash.new, Typus::Configuration.config!
end
def test_should_load_configuration_files_from_config_empty
- options = { :config_folder => 'vendor/plugins/typus/test/config/empty' }
+ options = { :config_folder => "vendor/plugins/typus/test/config/empty" }
Typus::Configuration.stubs(:options).returns(options)
assert_equal Hash.new, Typus::Configuration.roles!
assert_equal Hash.new, Typus::Configuration.config!
end
def test_should_load_configuration_files_from_config_ordered
- options = { :config_folder => 'vendor/plugins/typus/test/config/ordered' }
+ options = { :config_folder => "vendor/plugins/typus/test/config/ordered" }
Typus::Configuration.stubs(:options).returns(options)
files = Dir["#{Rails.root}/#{Typus::Configuration.options[:config_folder]}/*_roles.yml"]
expected = files.collect { |file| File.basename(file) }.sort
- assert_equal expected, ['001_roles.yml', '002_roles.yml']
- expected = { 'admin' => { 'categories' => 'read' } }
+ assert_equal expected, ["001_roles.yml", "002_roles.yml"]
+ expected = { "admin" => { "categories" => "read" } }
assert_equal expected, Typus::Configuration.roles!
end
def test_should_load_configuration_files_from_config_unordered
- options = { :config_folder => 'vendor/plugins/typus/test/config/unordered' }
+ options = { :config_folder => "vendor/plugins/typus/test/config/unordered" }
Typus::Configuration.stubs(:options).returns(options)
files = Dir["#{Rails.root}/#{Typus::Configuration.options[:config_folder]}/*_roles.yml"]
expected = files.collect { |file| File.basename(file) }
- assert_equal expected, ['app_one_roles.yml', 'app_two_roles.yml']
- expected = { 'admin' => { 'categories' => 'read, update' } }
+ assert_equal expected, ["app_one_roles.yml", "app_two_roles.yml"]
+ expected = { "admin" => { "categories" => "read, update" } }
assert_equal expected, Typus::Configuration.roles!
end
def test_should_load_configuration_files_from_config_default
- options = { :config_folder => 'vendor/plugins/typus/test/config/default' }
+ options = { :config_folder => "vendor/plugins/typus/test/config/default" }
Typus::Configuration.stubs(:options).returns(options)
assert_not_equal Hash.new, Typus::Configuration.roles!
assert_not_equal Hash.new, Typus::Configuration.config!

0 comments on commit b4bb50a

Please sign in to comment.
Something went wrong with that request. Please try again.