Sha256: 790e3c4e31239b2efb1091dc56c341dc3878464bd2f2a8a7652d8c24a04d8fd8

Contents?: true

Size: 1.7 KB

Versions: 56

Compression:

Stored size: 1.7 KB

Contents

require File.join(File.dirname(__FILE__), '../test_helper.rb')

class Config::CreateTest < Test::Unit::TestCase
  def setup
    @config = ActiveScaffold::Config::Core.new :model_stub
    @default_link = @config.create.link
  end
  
  def teardown
    @config.create.link = @default_link
  end
  
  def test_default_options
    assert !@config.create.persistent
    assert @config.create.action_after_create.nil?
    assert_equal 'Create ModelStub', @config.create.label
  end

  def test_link_defaults
    link = @config.create.link
    assert !link.page?
    assert !link.popup?
    assert !link.confirm?
    assert_equal "new", link.action
    assert_equal "Create New", link.label
    assert link.inline?
    blank = {}
    assert_equal blank, link.html_options
    assert_equal :get, link.method
    assert_equal :collection, link.type
    assert_equal :create, link.crud_type
    assert_equal :create_authorized?, link.security_method
  end
  
  def test_setting_link
    @config.create.link = ActiveScaffold::DataStructures::ActionLink.new('update', :label => 'Monkeys')
    assert_not_equal(@default_link, @config.create.link)
  end
  
  def test_label
    label = 'create new monkeys'
    @config.create.label = label
    assert_equal label, @config.create.label
    I18n.backend.store_translations :en, :active_scaffold => {:create_new_model => 'Create new %{model}'}
    @config.create.label = :create_new_model
    assert_equal 'Create new ModelStub', @config.create.label
  end
  
  def test_persistent
    @config.create.persistent = true
    assert @config.create.persistent
  end
 
  def test_action_after_create
    @config.create.action_after_create = :edit
    assert_equal :edit, @config.create.action_after_create
  end
end

Version data entries

56 entries across 56 versions & 3 rubygems

Version Path
active_scaffold-sequel-0.8.0 test/config/create_test.rb
active_scaffold-sequel-0.7.1 test/config/create_test.rb
active_scaffold-sequel-0.7.0 test/config/create_test.rb
active_scaffold-sequel-0.6.2 test/config/create_test.rb
active_scaffold-sequel-0.6.1 test/config/create_test.rb
active_scaffold-sequel-0.6.0 test/config/create_test.rb
active_scaffold-3.3.2 test/config/create_test.rb
active_scaffold-3.3.1 test/config/create_test.rb
active_scaffold-3.3.0 test/config/create_test.rb
active_scaffold-3.2.20 test/config/create_test.rb
brisk-bills-0.8.2 vendor/plugins/active_scaffold/test/config/create_test.rb
active_scaffold-3.3.0.rc3 test/config/create_test.rb
active_scaffold-3.3.0.rc2 test/config/create_test.rb
brisk-bills-0.8.1 vendor/plugins/active_scaffold/test/config/create_test.rb
active_scaffold-3.2.19 test/config/create_test.rb
active_scaffold-3.2.18 test/config/create_test.rb
active_scaffold-3.3.0.rc test/config/create_test.rb
active_scaffold-3.2.17 test/config/create_test.rb
active_scaffold-3.2.16 test/config/create_test.rb
active_scaffold-3.2.15 test/config/create_test.rb