Class: RSpec::Core::ExampleGroup

Inherits:
Object
  • Object
show all
Defined in:
lib/queencheck/rspec.rb

Class Method Summary collapse

Class Method Details

.labelingQueenCheck(name, labels, *args, &block) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/queencheck/rspec.rb', line 33

def self.labelingQueenCheck(name, labels, *args, &block)
  checker = ::QueenCheck::Testable.new(*args, &block)
  report = checker.check_with_label(labels)
  describe(*[name]) {
    it "all tests passes" do
      report.count(:all).should == report.count(:success)
    end

    describe "labels" do
      labels.each_pair do | label, p |
        it label do
          report.count(label).should == report.count(label, report.successes)
        end
      end
    end
  }
end

.QueenCheck(name, *args, &block) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/queencheck/rspec.rb', line 7

def self.QueenCheck(name, *args, &block)
  describe(*[name]) {
    report = nil

    it "running tests" do
      report = ::QueenCheck::Testable.new(*args, &block).check
    end

    it "all tests passes" do
      report.count(:all).should == report.count(:success)
    end
  }
end

.verboseQueenCheck(name, *args, &block) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
# File 'lib/queencheck/rspec.rb', line 21

def self.verboseQueenCheck(name, *args, &block)
  describe(*[name]) {
    assert = proc { | *props |
      proc{ block.call(*props) }
    }
    its = proc { | *props |
      it("Gen: #{props.map{|i| i.inspect}.join(', ')}", &assert.call(*props))
    }
    ::QueenCheck::Testable.new(*args, &its).check
  }
end