Sha256: 32339008e4afc1a12a42cfe437a01943983db01dd01f67e9e7a4e6a66ca691b7

Contents?: true

Size: 1.19 KB

Versions: 4

Compression:

Stored size: 1.19 KB

Contents

require File.dirname(__FILE__) + '/spec_helper'

describe Forgery do
  it "should load a dictionary when it is requested" do
    Forgery.dictionaries.reset!

    Forgery.dictionaries.should_not be_loaded(:colors)

    Forgery.dictionaries[:colors]

    Forgery.dictionaries.should be_loaded(:colors)
  end

  it "should load formats when it is requested" do
    Forgery.formats.reset!

    Forgery.formats.should_not be_loaded(:phone)

    Forgery.formats[:phone]

    Forgery.formats.should be_loaded(:phone)
  end

  it "should accept a symbol and return the appropriate forgery class" do
    Forgery(:address).should == AddressForgery
    Forgery(:basic).should == BasicForgery
    Forgery(:internet).should == InternetForgery
  end

  it "should accept two symbols, finding the right class and calling the appropriate method" do
    AddressForgery.should_receive(:street_name)
    Forgery(:address, :street_name)

    NameForgery.should_receive(:full_name)
    Forgery(:name, :full_name)
  end

  it "should accept two symbols and arguments, passing them along to the appropriate method" do
    LoremIpsumForgery.should_receive(:text).with(:sentences, 2)
    Forgery(:lorem_ipsum, :text, :sentences, 2)
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
sevenwire-forgery-0.2.0 spec/forgery_spec.rb
sevenwire-forgery-0.2.1 spec/forgery_spec.rb
sevenwire-forgery-0.2.2 spec/forgery_spec.rb
forgery-0.2.2 spec/forgery_spec.rb