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.5.9 test/test_safety.rb
tracksperanto-3.5.8 test/test_safety.rb
tracksperanto-3.5.7 test/test_safety.rb
tracksperanto-3.5.6 test/test_safety.rb
tracksperanto-3.5.5 test/test_safety.rb
tracksperanto-3.5.4 test/test_safety.rb
tracksperanto-3.5.2 test/test_safety.rb
tracksperanto-3.5.1 test/test_safety.rb
tracksperanto-3.5.0 test/test_safety.rb
tracksperanto-3.4.1 test/test_safety.rb
tracksperanto-3.4.0 test/test_safety.rb
tracksperanto-3.3.13 test/test_safety.rb
tracksperanto-3.3.12 test/test_safety.rb
tracksperanto-3.3.11 test/test_safety.rb
tracksperanto-3.3.10 test/test_safety.rb
tracksperanto-3.3.9 test/test_safety.rb
tracksperanto-3.3.8 test/test_safety.rb
tracksperanto-3.3.7 test/test_safety.rb
tracksperanto-3.3.6 test/test_safety.rb
tracksperanto-3.3.0.pre test/test_safety.rb