Sha256: cf426064a76ce3619587042656cc0ba0950066aacc2001cad3763b7b7ca0c5e1

Contents?: true

Size: 1.6 KB

Versions: 23

Compression:

Stored size: 1.6 KB

Contents

require 'test_helper'

module Config
  class UpdateTest < MiniTest::Test
    include ActiveScaffold::Helpers::ControllerHelpers

    def setup
      @config = ActiveScaffold::Config::Core.new :model_stub
    end

    def test_copy_columns_from_create
      @config.create.columns = %i[a c d]
      assert_equal %i[a d], @config.create.columns.visible_columns_names
      @config.update.columns = @config.create.columns
      assert_equal %i[a c d], @config.update.columns.visible_columns_names
    end

    def test__params_for_columns__returns_all_params
      @config.columns[:a].params.add :keep_a, :a_temp
      assert @config.columns[:a].params.include?(:keep_a)
      assert @config.columns[:a].params.include?(:a_temp)
    end

    def test_default_options
      refute @config.update.persistent
      refute @config.update.nested_links
      assert_equal 'Model stub', @config.update.label
    end

    def test_persistent
      @config.update.persistent = true
      assert @config.update.persistent
    end

    def test_nested_links
      old = @config.update.nested_links
      @config.update.nested_links = true
      assert @config.update.nested_links
      @config.update.nested_links = old
    end

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

Version data entries

23 entries across 23 versions & 1 rubygems

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