Sha256: 29fae875c026fe884ac21d081f0da80dff7cec02a45c942ac0b10fcbc239e070

Contents?: true

Size: 759 Bytes

Versions: 2

Compression:

Stored size: 759 Bytes

Contents

require 'test_helper'

describe Casting::Null do
  it 'will answer to any method with nil' do
    client = TestPerson.new
    client.extend(Casting::Client)
    attendant = Casting::Null

    assert_nil client.delegate('greet', attendant)
  end
end

describe Casting::Blank do
  it 'will answer to any method with an empty string' do
    client = TestPerson.new
    client.extend(Casting::Client)
    attendant = Casting::Blank

    assert_empty client.delegate('greet', attendant)
  end
end

describe "making null objects" do
  it "answers to missing methods" do
    client = TestPerson.new
    client.extend(Casting::Client)
    client.delegate_missing_methods
    attendant = Casting::Blank

    assert_respond_to client.cast_as(attendant), 'xyz'
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
casting-0.7.2 test/null_module_test.rb
casting-0.7.1 test/null_module_test.rb