Sha256: 111b62b04dcb0a249e6471c4215ee2eede4fb066363ca0bd81ddef95fadf4aed

Contents?: true

Size: 1.01 KB

Versions: 6

Compression:

Stored size: 1.01 KB

Contents

module Remarkable
  module Macros

    protected

      def pending(description='TODO', &block)
        PendingSandbox.new(description, self).instance_eval(&block)
      end

      class PendingSandbox < Struct.new(:description, :spec) #:nodoc:
        include Macros

        def example(mather_description=nil)
          method_caller = caller.detect{ |c| c !~ /method_missing'/ }

          error = begin
            ::Spec::Example::ExamplePendingError.new(description, method_caller)
          rescue # For rspec <= 1.1.12 and rspec => 1.2.4
            ::Spec::Example::ExamplePendingError.new(description)
          end

          spec.send(:example, mather_description){ raise error }
        end
        alias :it      :example
        alias :specify :example

        def should_or_should_not_method_missing(should_or_should_not, method, calltrace, *args, &block)
          example(get_description_from_matcher(should_or_should_not, method, *args, &block))
        end
      end

  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
remarkable-3.0.3 lib/remarkable/pending.rb
remarkable-3.0.4 lib/remarkable/pending.rb
remarkable-3.0.5 lib/remarkable/pending.rb
remarkable-3.0.6 lib/remarkable/pending.rb
remarkable-3.0.7 lib/remarkable/pending.rb
remarkable-3.0.8 lib/remarkable/pending.rb