Sha256: 1189cd024ea3c7af6d97704587a2fe27a027440906c6b514c6c8ae888195ab75

Contents?: true

Size: 417 Bytes

Versions: 9

Compression:

Stored size: 417 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

9 entries across 9 versions & 1 rubygems

Version Path
attr_extras-6.2.1 spec/attr_extras/attr_id_query_spec.rb
attr_extras-6.2.0 spec/attr_extras/attr_id_query_spec.rb
attr_extras-6.1.0 spec/attr_extras/attr_id_query_spec.rb
attr_extras-5.2.0 spec/attr_extras/attr_id_query_spec.rb
attr_extras-5.1.0 spec/attr_extras/attr_id_query_spec.rb
attr_extras-5.0.0 spec/attr_extras/attr_id_query_spec.rb
attr_extras-4.6.0 spec/attr_extras/attr_id_query_spec.rb
attr_extras-4.5.0 spec/attr_extras/attr_id_query_spec.rb
attr_extras-4.4.0 spec/attr_extras/attr_id_query_spec.rb