Sha256: a67bbd42ceecdadf0018b495cce62bf84e6ae9f6bb82da39bdec2145c691cec8

Contents?: true

Size: 516 Bytes

Versions: 37

Compression:

Stored size: 516 Bytes

Contents

# -*- encoding : utf-8 -*-
require File.expand_path(File.dirname(__FILE__)) + '/helper'

class TestSafety < Test::Unit::TestCase
  class Testable
    include Tracksperanto::Safety
    attr_accessor :foo, :bar
    safe_reader :foo, :bar
  end
  
  def test_safe_reader_raises_with_no_ivar
    t = Testable.new
    assert_raise(RuntimeError) { t.foo }
  end

  def test_safe_reader_does_not_raise_with_value_assigned
    t = Testable.new
    t.foo = 123
    assert_nothing_raised { assert_equal 123, t.foo }
  end
end

Version data entries

37 entries across 37 versions & 1 rubygems

Version Path
tracksperanto-3.2.2 test/test_safety.rb
tracksperanto-3.2.1 test/test_safety.rb
tracksperanto-3.2.0 test/test_safety.rb
tracksperanto-3.1.0 test/test_safety.rb
tracksperanto-3.0.1 test/test_safety.rb
tracksperanto-3.0.0 test/test_safety.rb
tracksperanto-2.12.0 test/test_safety.rb
tracksperanto-2.11.3 test/test_safety.rb
tracksperanto-2.11.2 test/test_safety.rb
tracksperanto-2.11.1 test/test_safety.rb
tracksperanto-2.11.0 test/test_safety.rb
tracksperanto-2.10.0 test/test_safety.rb
tracksperanto-2.9.9 test/test_safety.rb
tracksperanto-2.9.8 test/test_safety.rb
tracksperanto-2.9.7 test/test_safety.rb
tracksperanto-2.9.6 test/test_safety.rb
tracksperanto-2.9.5 test/test_safety.rb