Sha256: 96e57c185cf978b6c184c4d98847d6d6a4eafe1aa9ba2978de2113510aac14ca

Contents?: true

Size: 1.1 KB

Versions: 108

Compression:

Stored size: 1.1 KB

Contents

module EnsureSpec
  class Container
    attr_reader :executed

    def initialize
      @executed = []
    end

    def raise_in_method_with_ensure
      @executed << :method
      raise "An Exception"
    ensure
      @executed << :ensure
    end

    def raise_and_rescue_in_method_with_ensure
      @executed << :method
      raise "An Exception"
    rescue
      @executed << :rescue
    ensure
      @executed << :ensure
    end

    def throw_in_method_with_ensure
      @executed << :method
      throw(:symbol)
    ensure
      @executed << :ensure
    end

    def implicit_return_in_method_with_ensure
      :method
    ensure
      :ensure
    end

    def explicit_return_in_method_with_ensure
      return :method
    ensure
      return :ensure
    end
  end
end

module EnsureSpec

  class Test

    def initialize
      @values = []
    end

    attr_reader :values

    def call_block
      begin
        @values << :start
        yield
      ensure
        @values << :end
      end
    end

    def do_test
      call_block do
        @values << :in_block
        return :did_test
      end
    end
  end
end

Version data entries

108 entries across 108 versions & 5 rubygems

Version Path
rhodes-7.6.0 spec/framework_spec/app/spec/language/fixtures/ensure.rb
rhodes-7.5.1 spec/framework_spec/app/spec/language/fixtures/ensure.rb
rhodes-7.4.1 spec/framework_spec/app/spec/language/fixtures/ensure.rb
rhodes-7.1.17 spec/framework_spec/app/spec/language/fixtures/ensure.rb
rhodes-6.2.0 spec/framework_spec/app/spec/language/fixtures/ensure.rb
opal-0.10.6 spec/opal/core/language/fixtures/ensure.rb
opal-0.10.6.beta spec/opal/core/language/fixtures/ensure.rb
rhodes-6.0.11 spec/framework_spec/app/spec/language/fixtures/ensure.rb
opal-0.10.5 spec/opal/core/language/fixtures/ensure.rb
opal-0.10.4 spec/opal/core/language/fixtures/ensure.rb
opal-0.11.0.rc1 spec/opal/core/language/fixtures/ensure.rb
rhodes-5.5.18 spec/framework_spec/app/spec/language/fixtures/ensure.rb
rhodes-5.5.17 spec/framework_spec/app/spec/language/fixtures/ensure.rb
rhodes-5.5.15 spec/framework_spec/app/spec/language/fixtures/ensure.rb
rhodes-5.5.0.22 spec/framework_spec/app/spec/language/fixtures/ensure.rb
rhodes-5.5.2 spec/framework_spec/app/spec/language/fixtures/ensure.rb
rhodes-5.5.0.7 spec/framework_spec/app/spec/language/fixtures/ensure.rb
opal-0.10.3 spec/opal/core/language/fixtures/ensure.rb
rhodes-5.5.0.3 spec/framework_spec/app/spec/language/fixtures/ensure.rb
rhodes-5.5.0 spec/framework_spec/app/spec/language/fixtures/ensure.rb