Sha256: bf3137eb83960ea99ad9bd293840d1e52d62c35cfb46a2fa2812389563f8846d
Contents?: true
Size: 936 Bytes
Versions: 1
Compression:
Stored size: 936 Bytes
Contents
require 'spec_helper' require 'vienna/output_buffer' describe Vienna::OutputBuffer do before do @buf = Vienna::OutputBuffer.new end it "collects content that can be concatenated together" do @buf.append "foo" @buf.append= "bar" @buf.append "baz" @buf.join.should == "foobarbaz" end describe "#capture" do it "replaces the buffer temporarily" do @buf.append "foo" @buf.capture { @buf.append "bar" } @buf.append "baz" @buf.join.should == "foobaz" end it "returns all buffered output for duration of block" do @buf.append "foo" out = @buf.capture { @buf.append "woosh"; @buf.append "kapow" } @buf.append "baz" out.should == "wooshkapow" end it "passes any arguments to block" do @buf.capture("adam", "beynon") do |first, last| @buf.append "hello #{first} #{last}" end.should == "hello adam beynon" end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
opal-vienna-0.7.0 | spec/output_buffer_spec.rb |