Sha256: 4b7cdd7f792d62433d3327c1f4e1fa7e49f77639f94e235c6ad19ce06cad2268

Contents?: true

Size: 584 Bytes

Versions: 5

Compression:

Stored size: 584 Bytes

Contents

require 'spec_helper'

class Mummy
  attr_accessor :attributes

  def initialize(opts = {})
    self.attributes = opts
  end

end

class Dummy < Hash; end

class Rummy < Hash; end

describe "Custom Builders" do

  it "should be able to define custom builders" do

    Mummy.define {{
      :left  => /\w{3,10}/.gen,
      :right => /\w{3,10}/.gen
    }}

    Mummy.define(:custom) {{
      :center => /\w{3,10}/.gen
    }}

    mummy = Mummy.generate(:custom, :mumble => true)
    mummy.attributes[:center].should_not be_nil
    mummy.attributes[:mumble].should eql(true)

  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
jelly_bird-0.1.0 spec/jelly_bird/custom_builders_spec.rb
jelly_bird-0.0.6 spec/jelly_bird/custom_builders_spec.rb
jelly_bird-0.0.5 spec/jelly_bird/custom_builders_spec.rb
jelly_bird-0.0.4 spec/jelly_bird/custom_builders_spec.rb
jelly_bird-0.0.3b spec/jelly_bird/custom_builders_spec.rb