Sha256: 68bac1533d8efbaa96eca2d52c0106cf9599c3f2b509107ae73477d498294369

Contents?: true

Size: 732 Bytes

Versions: 5

Compression:

Stored size: 732 Bytes

Contents

require "test_helper"

describe "Internal Null" do
  let(:admin) { Order.act_with_booleans }

  def setup
    reset_order
    Order.add_to_booleans
  end

  it "respond to act_with_booleans" do
    assert Order.respond_to?(:act_with_booleans)
    refute_nil Order.act_with_booleans
  end

  it "tests to_boolean" do
    assert admin.to_boolean(true)
    assert admin.to_boolean("true")
    assert admin.to_boolean(1)
    assert admin.to_boolean("1")
    refute admin.to_boolean(false)
    refute admin.to_boolean("false")
    refute admin.to_boolean(0)
    refute admin.to_boolean("0")
    assert_raises { admin.to_boolean(nil) }
    assert_raises { admin.to_boolean(2) }
    assert_raises { admin.to_boolean("unknown") }
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
act_with_booleans-0.0.5 test/coding_null_test.rb
act_with_booleans-0.0.4 test/coding_null_test.rb
act_with_booleans-0.0.3 test/coding_null_test.rb
act_with_booleans-0.0.2 test/coding_null_test.rb
act_with_booleans-0.0.1 test/coding_null_test.rb