Sha256: e04d03dff8045b5b4d7da5fafa6ce74ce62a5c16141baf8c473cd27ca7c95d75

Contents?: true

Size: 722 Bytes

Versions: 1

Compression:

Stored size: 722 Bytes

Contents

require 'pork'
require 'pork-rspec/alias'

module RSpec
  module Suite
    include Pork::Suite::Imp
    include Alias

    def before *types
      super()
      warn("Ignored before arguments: #{types}") if types.any?
    end

    def after *types
      super()
      warn("Ignored after arguments: #{types}") if types.any?
    end

    def let name, &block
      define_method(name) do
        ivar = "@#{name}"
        instance_variable_get(ivar) ||
          instance_variable_set(ivar, instance_eval(&block))
      end
    end
    alias_method :given, :let

    def let! name, &block
      let(name, &block)
      before{ __send__(name) }
    end

    def subject &block
      let(:subject, &block)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pork-rspec-0.5.0 lib/pork-rspec/suite.rb