Class: RSpecLive::ResultDetail

Inherits:
Object
  • Object
show all
Defined in:
lib/rspec-live/result_detail.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(suite) ⇒ ResultDetail

Returns a new instance of ResultDetail.



5
6
7
8
9
# File 'lib/rspec-live/result_detail.rb', line 5

def initialize(suite)
  @suite = suite
  @show_all = false
  @verbosity = 1
end

Instance Attribute Details

#verbosityObject (readonly)

Returns the value of attribute verbosity.



3
4
5
# File 'lib/rspec-live/result_detail.rb', line 3

def verbosity
  @verbosity
end

Instance Method Details

#cycle_verbosityObject



19
20
21
# File 'lib/rspec-live/result_detail.rb', line 19

def cycle_verbosity
  @verbosity = (@verbosity + 1) % 4
end

#detailed_examplesObject



23
24
25
26
27
28
29
30
# File 'lib/rspec-live/result_detail.rb', line 23

def detailed_examples
  all = @suite.ordered_examples
  if @focused
    index = @suite.ordered_example_names.index(@focused) || 0
    all = all[index, all.length-index] + all[0, index]
  end
  @show_all ? all : all.select(&:failed?)
end

#focus_nextObject



15
16
17
# File 'lib/rspec-live/result_detail.rb', line 15

def focus_next
  @focused = detailed_examples[1].name if detailed_examples[1]
end

#toggle_allObject



11
12
13
# File 'lib/rspec-live/result_detail.rb', line 11

def toggle_all
  @show_all = !@show_all
end