spec/unit/render/generator_spec.rb in render-0.0.6 vs spec/unit/render/generator_spec.rb in render-0.0.7

- old
+ new

@@ -1,10 +1,11 @@ require "render/generator" module Render describe Generator do before(:each) do + Render.stub({ live: false }) @original_generators = Generator.instances.dup end after(:each) do Generator.instances = @original_generators @@ -21,9 +22,16 @@ Generator.instances.clear first_generator = Generator.create!(String, /.*/, proc { "first" }) second_generator = Generator.create!(String, /.*/, proc { "second" }) Generator.find(String, :anything).trigger.should == second_generator.trigger + end + end + + describe ".trigger" do + it "triggers matching generator for Render types" do + enum_attribute = HashAttribute.new({ attribute_name: { type: String, enum: ["foo"] } }) + Generator.trigger(:enum, "anything", enum_attribute).should == "foo" end end describe "#initialize" do it "sets the type of data it can be used to generate data for" do