Sha256: 9a9a5e84d12f3e22aac1459fe94f19445dc7a6847551afd2888b2762b60e5cbc

Contents?: true

Size: 460 Bytes

Versions: 12

Compression:

Stored size: 460 Bytes

Contents

require "spec_helper"

describe "using" do
  let(:item) { double("item", dispose: true) }

  it "disposes the item" do
    using(item) { }
    item.should have_received(:dispose)
  end

  it "performs the action" do
    ran = false
    using(item) do
      ran = true
    end
    ran.should be_true
  end

  it "always cleans up the resource" do
    begin
      using(item) { raise "heck" }
    rescue
    end
    item.should have_received(:dispose)
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
nasty-0.0.1395464273 spec/unit/using_spec.rb
nasty-0.0.1388168019 spec/unit/using_spec.rb
nasty-0.0.1388167257 spec/unit/using_spec.rb
nasty-0.0.1388166944 spec/unit/using_spec.rb
nasty-0.0.1388166636 spec/unit/using_spec.rb
nasty-0.0.1388165564 spec/unit/using_spec.rb
nasty-0.0.1388164945 spec/unit/using_spec.rb
nasty-0.0.1388164765 spec/unit/using_spec.rb
nasty-0.0.1388163823 spec/unit/using_spec.rb
nasty-0.0.1388163382 spec/unit/using_spec.rb
nasty-0.0.1388163140 spec/unit/using_spec.rb
nasty-0.0.1388162472 spec/unit/using_spec.rb