Sha256: b64b7e9be955ea1bdef1d5bc069fcc3457ceffc20a912b3df7b8b35b13fece51

Contents?: true

Size: 879 Bytes

Versions: 1

Compression:

Stored size: 879 Bytes

Contents

module Render
  describe Attribute do
    context "generators" do
      before(:each) do
        @original_generators = Render.generators
        @original_live = Render.live
        Render.live = false
      end

      after(:each) do
        Render.generators = @original_generators
        Render.live = @original_live
      end

      it "uses matching generator for #faux_value" do
        name = "Canada Dry"
        generator = Generator.new({ type: String, matcher: %r{.*name.*}, algorithm: proc { name } })
        Render.generators << generator

        HashAttribute.new({ name: { type: String } }).default_value.should == name
      end

      it "uses really bare-boned type if no generator is found" do
        bare_boned_string = "A String"
        HashAttribute.new({ foo: { type: String } }).default_value.should == bare_boned_string
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
render-0.0.3 spec/functional/representation/attribute_spec.rb