Sha256: ea7ec2cdc4989b5be4d348aecc3e29127f4cee61f4a191652e7d21bb58b124bb

Contents?: true

Size: 632 Bytes

Versions: 3

Compression:

Stored size: 632 Bytes

Contents

require 'test_helper'

class DesksControllerTest < ActionController::TestCase
  test "#index" do
    get :index
    assert_equal [ {'name'=> 'name1'}, {'name'=> 'name2'} ], JSON.parse(response.body)
  end

  test "#show validate failed" do
    assert_raise(Lina::ParamsCheckError) { get :show, id: 1, filter_name: 'x' * 6 }
  end

  test "#update return validate failed" do
    assert_raise(Lina::ReturnCheckError) { put :update, id: 1 }
  end

  test "default value" do
    get :default_value
    assert_equal( 'default', assigns(:filter) )

    get :default_value, filter: '1'
    assert_equal( '1', assigns(:filter) )
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
lina-0.0.4 test/dummy/test/controllers/desks_controller_test.rb
lina-0.0.3 test/dummy/test/controllers/desks_controller_test.rb
lina-0.0.2 test/dummy/test/controllers/desks_controller_test.rb