From 1aff4640421ad0c3a05ae731b3beef57e5cfe7cc Mon Sep 17 00:00:00 2001 From: Brandon Mitchell Date: Thu, 18 Sep 2008 13:29:36 +0800 Subject: [PATCH] Couple of reasonable specs for Munger::Data.new NOTE: Could we test yield self better? Signed-off-by: Scott Chacon --- spec/munger/data/new_spec.rb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 spec/munger/data/new_spec.rb diff --git a/spec/munger/data/new_spec.rb b/spec/munger/data/new_spec.rb new file mode 100644 index 0000000..80efd5e --- /dev/null +++ b/spec/munger/data/new_spec.rb @@ -0,0 +1,18 @@ +require File.dirname(__FILE__) + '/../../spec_helper' + +describe Munger::Data do + + describe '.new' do + + it 'initializes the data attribute to the :data value' do + data = [{:foo => '1'}, {:foo => 2}] + Munger::Data.new(:data => data).data.should == data + end + + it 'yields itself to the given block' do + Munger::Data.new { |data| data.should be_kind_of(Munger::Data) } + end + + end + +end \ No newline at end of file