Class: Specdown::Readme

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file_path) ⇒ Readme

Returns a new instance of Readme.



7
8
9
10
11
12
# File 'lib/specdown/readme.rb', line 7

def initialize(file_path)
  @file_path  = file_path
  @tests      = []
  @stats      = Stats.new self
  build_tests
end

Instance Attribute Details

#file_pathObject (readonly)

Returns the value of attribute file_path.



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

def file_path
  @file_path
end

#statsObject (readonly)

Returns the value of attribute stats.



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

def stats
  @stats
end

#testsObject (readonly)

Returns the value of attribute tests.



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

def tests
  @tests
end

Instance Method Details

#exceptionsObject



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

def exceptions
  @tests.collect(&:exception).compact
end

#executeObject



35
36
37
38
39
# File 'lib/specdown/readme.rb', line 35

def execute
  @tests.map &:execute

  self
end

#file_nameObject



30
31
32
# File 'lib/specdown/readme.rb', line 30

def file_name
  File.basename @file_path
end

#passing?Boolean

Returns:

  • (Boolean)


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

def passing?
  exceptions.empty? && pending_exceptions.empty? && undefined_implicits.empty?
end

#pending_exceptionsObject



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

def pending_exceptions
  exceptions.select {|e| e.exception_class == Specdown::PendingException }
end

#undefined_implicitsObject



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

def undefined_implicits
  @tests.collect(&:undefined_implicits).flatten
end