Sha256: 8ab71ee0a3193df2d62f159912cd4d098cee337eed9866c8464c978f94ff199e

Contents?: true

Size: 926 Bytes

Versions: 5

Compression:

Stored size: 926 Bytes

Contents

require File.expand_path('../spec_helper',__FILE__)

describe Handle::Permissions do
  subject { Handle::Permissions.new :foo, :bar, :baz, :quux, 0b0110 }

  it "initialize" do
    expect(subject.bitmask).to eq(0b110)
    expect(subject).not_to be_foo
    expect(subject).to be_bar
    expect(subject).to be_baz
    expect(subject).not_to be_quux
  end

  it "modify" do
    subject.foo = true
    subject.bar = false
    expect(subject).to be_foo
    expect(subject).not_to be_bar
    expect(subject).to be_baz
    expect(subject).not_to be_quux
  end

  it "#to_bool" do
    expect(subject.to_bool).to eq([false, true, true, false])
  end

  it "#to_bool" do
    expect(subject.to_s).to eq('0110')
  end

  it "#inspect" do
    expect(subject.inspect).to eq("[:bar, :baz]")
  end

  it "dispatches" do
    expect { subject.foo    }.to raise_error(NameError)
    expect { subject.foobar }.to raise_error(NameError)
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
handle-system-0.0.7 spec/permissions_spec.rb
handle-system-0.0.6 spec/permissions_spec.rb
handle-system-0.0.5 spec/permissions_spec.rb
handle-system-0.0.4 spec/permissions_spec.rb
handle-system-0.0.3 spec/permissions_spec.rb