Sha256: 7ebd134e2456915a0292c11bf4407791393fcc74842ef0fe2c697be374dd6eb6

Contents?: true

Size: 1.11 KB

Versions: 2

Compression:

Stored size: 1.11 KB

Contents

require "render/generator"

module Render
  describe Generator do
    it "exists" do
      expect { Generator }.to_not raise_error
    end

    describe "properties" do
      before(:each) do
        @mandatory_options = { algorithm: proc {} }
      end

      it "is a type-specific generator for flexibility" do
        Generator.new(@mandatory_options.merge({ type: String })).type.should == String
      end

      it "has a matcher to only be used on specific properties" do
        matcher = %r{.*name.*}
        Generator.new(@mandatory_options.merge({ matcher: matcher })).matcher.should == matcher
      end

      describe "#algorith" do
        it "has an algorithm that generates a value to be used" do
          algorithm = lambda { "The Darjeeling limited" }
          Generator.new({ algorithm: algorithm }).algorithm.should == algorithm
        end

        it "raises an error if algorithm does not respond to call" do
          expect {
            Generator.new({ algorithm: "want this to be the fake value" })
          }.to raise_error(Errors::Generator::MalformedAlgorithm)
        end
      end
    end

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
render-0.0.4 spec/unit/render/generator_spec.rb
render-0.0.3 spec/unit/render/generator_spec.rb