Class: Specdown::Stats

Inherits:
Object
  • Object
show all
Defined in:
lib/specdown/readme/stats.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(readme = nil) ⇒ Stats

Returns a new instance of Stats.



5
6
7
# File 'lib/specdown/readme/stats.rb', line 5

def initialize(readme=nil)
  @readme = readme
end

Instance Attribute Details

#readmeObject (readonly)

Returns the value of attribute readme.



3
4
5
# File 'lib/specdown/readme/stats.rb', line 3

def readme
  @readme
end

Instance Method Details

#num_failingObject



17
18
19
# File 'lib/specdown/readme/stats.rb', line 17

def num_failing
  @readme.tests.select {|test| test.status == :failing}.count
end

#num_passingObject



13
14
15
# File 'lib/specdown/readme/stats.rb', line 13

def num_passing
  @readme.tests.select {|test| test.status == :passing}.count
end

#num_pendingObject



21
22
23
# File 'lib/specdown/readme/stats.rb', line 21

def num_pending
  @readme.tests.select {|test| test.status == :pending}.count
end

#num_testsObject



9
10
11
# File 'lib/specdown/readme/stats.rb', line 9

def num_tests
  @readme.tests.count
end

#num_undefinedObject



25
26
27
# File 'lib/specdown/readme/stats.rb', line 25

def num_undefined
  @readme.tests.select {|test| test.status == :undefined}.count
end