Sha256: 303198e8693f4e3b48372865769d7f96a1264f8ff91ac2ad4c90a6ddd8f97be8

Contents?: true

Size: 765 Bytes

Versions: 24

Compression:

Stored size: 765 Bytes

Contents

require 'spec_helper'

describe Dragonfly::Register do

  let (:register) { Dragonfly::Register.new }
  let (:thing) { proc{ "BOO" } }

  it "adds an item" do
    register.add(:thing, thing)
    register.get(:thing).should == thing
  end

  it "adds from a block" do
    register.add(:thing, &thing)
    register.get(:thing).should == thing
  end

  it "raises an error if neither are given" do
    expect {
      register.add(:something)
    }.to raise_error(ArgumentError)
  end

  it "raises an error if getting one that doesn't exist" do
    expect {
      register.get(:thing)
    }.to raise_error(Dragonfly::Register::NotFound)
  end

  it "allows getting with a string" do
    register.add(:thing, thing)
    register.get('thing').should == thing
  end

end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
dragonfly-1.4.1 spec/dragonfly/register_spec.rb
dragonfly-1.4.0 spec/dragonfly/register_spec.rb
dragonfly-1.3.0 spec/dragonfly/register_spec.rb
dragonfly-1.2.1 spec/dragonfly/register_spec.rb
dragonfly-1.2.0 spec/dragonfly/register_spec.rb
dragonfly-1.1.5 spec/dragonfly/register_spec.rb
dragonfly-1.1.4 spec/dragonfly/register_spec.rb
dragonfly-1.1.3 spec/dragonfly/register_spec.rb
dragonfly-1.1.2 spec/dragonfly/register_spec.rb
dragonfly-1.1.1 spec/dragonfly/register_spec.rb
dragonfly-1.1.0 spec/dragonfly/register_spec.rb
dragonfly-1.0.12 spec/dragonfly/register_spec.rb
dragonfly-1.0.11 spec/dragonfly/register_spec.rb
dragonfly-1.0.10 spec/dragonfly/register_spec.rb
dragonfly-1.0.9 spec/dragonfly/register_spec.rb
dragonfly-1.0.8 spec/dragonfly/register_spec.rb
dragonfly-1.0.7 spec/dragonfly/register_spec.rb
dragonfly-1.0.6 spec/dragonfly/register_spec.rb
dragonfly-1.0.5 spec/dragonfly/register_spec.rb
dragonfly-1.0.4 spec/dragonfly/register_spec.rb