Sha256: 3955b8b01b80df1b2f291cebff07b38313c1c8601b0dec0795173363ed77b716

Contents?: true

Size: 1.3 KB

Versions: 23

Compression:

Stored size: 1.3 KB

Contents

require 'test_helper'

module Config
  class ShowTest < MiniTest::Test
    def setup
      @config = ActiveScaffold::Config::Core.new :model_stub
      @default_link = @config.show.link
    end

    def teardown
      @config.show.link = @default_link
    end

    def test_link_defaults
      link = @config.show.link
      refute link.page?
      refute link.popup?
      refute link.confirm?
      assert_equal 'show', link.action
      assert_equal 'Show', link.label
      assert link.inline?
      blank = {}
      assert_equal blank, link.html_options
      assert_equal :get, link.method
      assert_equal :member, link.type
      assert_equal :read, link.crud_type
      assert_equal :show_authorized?, link.security_method
    end

    def test_setting_link
      @config.show.link = ActiveScaffold::DataStructures::ActionLink.new('update', :label => 'Monkeys')
      refute_equal @default_link, @config.show.link
    end

    def test_label
      label = 'show monkeys'
      @config.show.label = label
      assert_equal label, @config.show.label
      I18n.backend.store_translations :en, :active_scaffold => {:view_model => 'View %<model>s'}
      @config.show.label = :view_model
      assert_equal 'View Model stub', @config.show.label
      assert_equal 'View record', @config.show.label('record')
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
active_scaffold-3.6.20 test/config/show_test.rb
active_scaffold-3.6.19 test/config/show_test.rb
active_scaffold-3.6.17 test/config/show_test.rb
active_scaffold-3.6.15 test/config/show_test.rb
active_scaffold-3.6.14 test/config/show_test.rb
active_scaffold-3.6.13 test/config/show_test.rb
active_scaffold-3.6.12 test/config/show_test.rb
active_scaffold-3.6.11.1 test/config/show_test.rb
active_scaffold-3.6.11 test/config/show_test.rb
active_scaffold-3.6.10 test/config/show_test.rb
active_scaffold-3.6.9 test/config/show_test.rb
active_scaffold-3.6.8 test/config/show_test.rb
active_scaffold-3.6.6 test/config/show_test.rb
active_scaffold-3.6.5 test/config/show_test.rb
active_scaffold-3.6.4.1 test/config/show_test.rb
active_scaffold-3.6.4 test/config/show_test.rb
active_scaffold-3.6.3 test/config/show_test.rb
active_scaffold-3.6.2 test/config/show_test.rb
active_scaffold-3.6.1 test/config/show_test.rb
active_scaffold-3.6.0 test/config/show_test.rb