Sha256: 690239bfcd8b612bd5210a9bed2dc8d8f11fc88a445d32d4ab19d67f18bcc10e

Contents?: true

Size: 420 Bytes

Versions: 6

Compression:

Stored size: 420 Bytes

Contents

require "spec_helper"

describe Object, ".attr_id_query" do
  it "creates id query methods" do
    klass = Class.new do
      attr_id_query :baz?, :boink?
      attr_accessor :baz_id
    end

    example = klass.new
    refute example.baz?

    example.baz_id = 123
    assert example.baz?
  end

  it "requires a trailing questionmark" do
    _(lambda { Object.attr_id_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_id_query_spec.rb
attr_extras-7.0.0 spec/attr_extras/attr_id_query_spec.rb
attr_extras-6.2.5 spec/attr_extras/attr_id_query_spec.rb
attr_extras-6.2.4 spec/attr_extras/attr_id_query_spec.rb
attr_extras-6.2.3 spec/attr_extras/attr_id_query_spec.rb
attr_extras-6.2.2 spec/attr_extras/attr_id_query_spec.rb