Sha256: e2cab715fd7c08b857e732ffacd898710dac4bca9b573d2b417a6c9e7ce63283

Contents?: true

Size: 1.67 KB

Versions: 17

Compression:

Stored size: 1.67 KB

Contents

require 'test_helper'

module Config
  class NestedTest < MiniTest::Test
    class ModelStubsController < ActionController::Base
      include ActiveScaffold::Core
      active_scaffold
    end

    def setup
      @config = ActiveScaffold::Config::Core.new(:model_stub)
    end
    
    def test_default_options
      assert @config.nested.shallow_delete
      assert_equal 'Add Existing Model stub', @config.nested.label
    end
    
    def test_label
      label = 'nested monkeys'
      @config.nested.label = label
      assert_equal label, @config.nested.label
      I18n.backend.store_translations :en, :active_scaffold => {:test_create_model => 'Add new %{model}'}
      @config.nested.label = :test_create_model
      assert_equal 'Add new Model stub', @config.nested.label
    end
    
    def test_shallow_delete
      @config.nested.shallow_delete = true
      assert @config.nested.shallow_delete
    end
    
    def test_add_link
      assert_raises(ArgumentError) { @config.nested.add_link :assoc_1 }
      config = @config
      ModelStubsController.class_eval do
        config.configure { nested.add_link :other_models }
      end
      link = @config.action_links['index']
      assert_equal 'ModelStubs', link.label
      assert_equal 'index', link.action
      assert_equal :after, link.position
      refute link.page?
      refute link.popup?
      refute link.confirm?
      assert link.inline?
      assert link.refresh_on_close
      assert_equal :other_models, link.parameters[:association]
      assert_equal :get, link.method
      assert_equal :member, link.type
      assert_equal :read, link.crud_type
      assert_equal :nested_authorized?, link.security_method
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
active_scaffold-3.4.17 test/config/nested_test.rb
active_scaffold-3.4.16 test/config/nested_test.rb
active_scaffold-3.4.14 test/config/nested_test.rb
active_scaffold-3.4.13 test/config/nested_test.rb
active_scaffold-3.4.12 test/config/nested_test.rb
active_scaffold-3.4.11 test/config/nested_test.rb
active_scaffold-3.4.10 test/config/nested_test.rb
active_scaffold-3.4.9 test/config/nested_test.rb
active_scaffold-3.4.8 test/config/nested_test.rb
active_scaffold-3.4.7 test/config/nested_test.rb
active_scaffold-3.4.5 test/config/nested_test.rb
active_scaffold-3.4.4 test/config/nested_test.rb
active_scaffold-3.4.3 test/config/nested_test.rb
active_scaffold-3.4.2 test/config/nested_test.rb
active_scaffold-3.4.1 test/config/nested_test.rb
active_scaffold-3.4.0.1 test/config/nested_test.rb
active_scaffold-3.4.0 test/config/nested_test.rb