Sha256: 50c67d5477f97b008a77daaa4e490dd19341ee05773eae7089748887c59516a5

Contents?: true

Size: 709 Bytes

Versions: 4

Compression:

Stored size: 709 Bytes

Contents

require_relative 'spec_helper'

describe Module do
  attr_pow :foo, default: 20
  attr_pow :bar, default: 'stringy affair'
  attr_pow :hook_func, hooks: true
  attr_pow :queue, queue: true

  it "default & basic functionality" do
    expect(foo).to eq(20)
    expect(bar).to eq('stringy affair')
  end

  it "hooks" do
    hook_func_add { [:h, 1] }
    hook_func_add { [:h, 2] }
    result = hook_func_hooks()
    expect(result.first).to eq [:h, 1]
    expect(result.last).to  eq [:h, 2]
  end

  it "queues" do
    t = Thread.new { queue << 1 << 2 << 3; }
    expect(queue.next).to eq 1
    expect(queue.next).to eq 2
    expect(queue.next).to eq 3
    expect(queue.empty?).to be_truthy
    t.join
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
attr_pow-0.0.5 spec/attr_pow_spec.rb
attr_pow-0.0.4 spec/attr_pow_spec.rb
attr_pow-0.0.3 spec/attr_pow_spec.rb
attr_pow-0.0.2 spec/attr_pow_spec.rb