Sha256: e5790fb63378a639f6a3d00ca862f681bd150974fede58888975d4f0610d9e52

Contents?: true

Size: 1.61 KB

Versions: 19

Compression:

Stored size: 1.61 KB

Contents

require 'test_helper'

class RefinerySettingTest < ActiveSupport::TestCase

  fixtures :refinery_settings

  def test_title
    assert_equal "Site Name", refinery_settings(:site_name).title
  end

  def test_getter_method
    assert_equal "My Site", RefinerySetting[:site_name]
    assert_equal "My Site", RefinerySetting['site_name']
    assert_equal "My Site", RefinerySetting.site_name
  end

  def test_find_or_set
    # creating a new setting on the fly
    assert_equal "test", RefinerySetting.find_or_set(:my_setting, "test")
    assert_equal "test", RefinerySetting[:my_setting]
  end

  def test_setter_methods
    assert_equal "My Site", RefinerySetting[:site_name]

    # change the site name setting
    RefinerySetting[:site_name] = "My New Site Name"
    assert_equal "My New Site Name", RefinerySetting[:site_name]

    # change the site name setting again this time with quotes not symbols
    RefinerySetting['site_name'] = "My Site 2"
    assert_equal "My Site 2", RefinerySetting[:site_name]
  end

  def test_per_page
    assert_equal 10, RefinerySetting.per_page
  end

  def test_boolean_settings
    RefinerySetting[:show_dashboard] = true
    assert RefinerySetting[:show_dashboard]

    RefinerySetting[:show_dashboard] = false
    assert !RefinerySetting[:show_dashboard]
  end

  def test_hash_settings
    RefinerySetting[:site_owner_information] = {:name => "david", :email => "dave@test.com"}
    assert_equal "david", RefinerySetting[:site_owner_information][:name]
  end

  def test_integer_settings
    RefinerySetting[:recent_activity_size] = 19
    assert_equal 19, RefinerySetting[:recent_activity_size]
  end

end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
refinerycms-0.9.6.34 test/unit/refinery_setting_test.rb
refinerycms-0.9.6.33 test/unit/refinery_setting_test.rb
refinerycms-0.9.6.32 test/unit/refinery_setting_test.rb
refinerycms-0.9.6.31 test/unit/refinery_setting_test.rb
refinerycms-0.9.6.30 test/unit/refinery_setting_test.rb
refinerycms-0.9.6.29 test/unit/refinery_setting_test.rb
refinerycms-0.9.6.28 test/unit/refinery_setting_test.rb
refinerycms-0.9.6.27 test/unit/refinery_setting_test.rb
refinerycms-0.9.6.26 test/unit/refinery_setting_test.rb
refinerycms-0.9.6.25 test/unit/refinery_setting_test.rb
refinerycms-0.9.6.24 test/unit/refinery_setting_test.rb
refinerycms-0.9.6.23 test/unit/refinery_setting_test.rb
refinerycms-0.9.6.22 test/unit/refinery_setting_test.rb
refinerycms-0.9.6.21 test/unit/refinery_setting_test.rb
refinerycms-0.9.6.19 test/unit/refinery_setting_test.rb
refinerycms-0.9.6.18 test/unit/refinery_setting_test.rb
refinerycms-0.9.6.17 test/unit/refinery_setting_test.rb
refinerycms-0.9.6.16 test/unit/refinery_setting_test.rb
refinerycms-0.9.6.15 test/unit/refinery_setting_test.rb