Sha256: d6619d8c2d074a88a827fad90dfc028a2d3da5217e3bdddb361bf297c956334d
Contents?: true
Size: 1.15 KB
Versions: 9
Compression:
Stored size: 1.15 KB
Contents
require 'spec_helper' require 'sugar-high/dsl' describe "SugarHigh" do describe "DSL pack" do describe '#with' do it "should allow calls on instance in block" do with(Hash.new) do merge!(:a => 1) merge!(:b => 2) end.should == {:a => 1, :b => 2} end it "should allow calls on instance in block + pass *args to block" do with(Hash.new, 1, 2, 3) do |*args| merge!(:first => args.first) merge!(:a => 1) merge!(:b => 2) end.should == {:a => 1, :b => 2, :first => 1} end it "should allow calls on instance in block + pass options hash (variable) to block" do options = {:session => 1, :request => 2, :params => 3} with(Hash.new, options) do |options| merge! options end.should == {:session => 1, :request => 2, :params => 3} end it "should allow calls on instance in block + pass options hash (explicitly) to block" do with(Hash.new, :session => 1, :request => 2, :params => 3) do |options| merge! options end.should == {:session => 1, :request => 2, :params => 3} end end end end
Version data entries
9 entries across 9 versions & 1 rubygems