Sha256: 7c794a1e81a3d3017703607eec8fe2419fcf15d69618b6c715aa1c234e6eb60a

Contents?: true

Size: 412 Bytes

Versions: 6

Compression:

Stored size: 412 Bytes

Contents

require "spec_helper"

describe Object, ".attr_query" do
  it "creates attribute query methods" do
    klass = Class.new do
      attr_query :flurp?
      attr_accessor :flurp
    end

    example = klass.new
    refute example.flurp?
    example.flurp = "!"
    assert example.flurp?
  end

  it "requires a trailing questionmark" do
    _(lambda { Object.attr_query(:foo) }).must_raise ArgumentError
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
attr_extras-7.1.0 spec/attr_extras/attr_query_spec.rb
attr_extras-7.0.0 spec/attr_extras/attr_query_spec.rb
attr_extras-6.2.5 spec/attr_extras/attr_query_spec.rb
attr_extras-6.2.4 spec/attr_extras/attr_query_spec.rb
attr_extras-6.2.3 spec/attr_extras/attr_query_spec.rb
attr_extras-6.2.2 spec/attr_extras/attr_query_spec.rb