Sha256: 2c1dd1bf9640e652b0c4604a41838f309bceec6efe225de83215b779b523b50e

Contents?: true

Size: 563 Bytes

Versions: 3

Compression:

Stored size: 563 Bytes

Contents

require "spec_helper"

describe Object do
  subject(:object) { Object.new }

  describe "#as" do
    let(:as) { object.as(&block) }

    specify { expect{|block| object.as(&block) }.to yield_with_args(object) }

    context "when the block returns nil" do
      let(:block) { Proc.new {|arg| nil } }

      specify { expect(as).to eq object }
    end

    context "when the block does not return nil" do
      let(:block_return) { Object.new }
      let(:block) { Proc.new {|arg| block_return } }

      specify { expect(as).to eq block_return }
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
tfg_support-1.1.1 spec/tfg/support/core_ext/object/as_spec.rb
tfg_support-1.0.1 spec/tfg/support/core_ext/object/as_spec.rb
tfg_support-1.0.0 spec/tfg/support/core_ext/object/as_spec.rb