Sha256: 4016f221365327bc35362d7d4700dd7466bebec95d4ab9b117b45d8890215274

Contents?: true

Size: 1.17 KB

Versions: 8

Compression:

Stored size: 1.17 KB

Contents

module Matest
  class SkippedExampleGroup
    attr_reader :scope_block

    attr_accessor :printer
    attr_reader :specs
    attr_reader :statuses

    def initialize(scope_block)
      @scope_block = scope_block
      @specs       = []
      @statuses       = []
    end

    def execute!
      instance_eval(&scope_block)
      specs.each do |spec|
        res = run_spec(spec)
        printer.prints(res)
      end
    end

    def run_spec(spec)
      status = Matest::SpecSkipped.new(spec, true)
      @statuses << status
      status
    end

    def let(*args)
    end

    def let!(*args)
    end

    def scope(description=nil, &block)
      Matest::Runner.runner << Matest::SkippedExampleGroup.new(block)
    end
    alias :xscope :scope
    alias :describe :scope
    alias :xdescribe :xscope

    alias :context :scope
    alias :xcontext :xscope

    alias :group :scope
    alias :xgroup :xscope

    def spec(description=nil, &block)
      current_example = Matest::SkipMe.new(caller)
      specs << Example.new(current_example, description, [])
    end
    alias :xspec :spec
    alias :example :spec
    alias :xexample :spec
    alias :it :spec
    alias :xit :spec
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
matest-1.7.4 lib/matest/skipped_example_group.rb
matest-1.7.3 lib/matest/skipped_example_group.rb
matest-1.7.2 lib/matest/skipped_example_group.rb
matest-1.7.1 lib/matest/skipped_example_group.rb
matest-1.7.0 lib/matest/skipped_example_group.rb
matest-1.6.9 lib/matest/skipped_example_group.rb
matest-1.6.6 lib/matest/skipped_example_group.rb
matest-1.6.5 lib/matest/skipped_example_group.rb