Class: RSpecFixtures::ApprovalHandler

Inherits:
Object
  • Object
show all
Includes:
Colsole
Defined in:
lib/rspec_fixtures/approval_handler.rb

Overview

Handles user input and interactive fixture approvals

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#actualObject (readonly)

Returns the value of attribute actual.



12
13
14
# File 'lib/rspec_fixtures/approval_handler.rb', line 12

def actual
  @actual
end

#expectedObject (readonly)

Returns the value of attribute expected.



12
13
14
# File 'lib/rspec_fixtures/approval_handler.rb', line 12

def expected
  @expected
end

#fixture_fileObject (readonly)

Returns the value of attribute fixture_file.



12
13
14
# File 'lib/rspec_fixtures/approval_handler.rb', line 12

def fixture_file
  @fixture_file
end

Instance Method Details

#run(expected, actual, fixture_file) ⇒ Object



14
15
16
17
18
19
20
21
# File 'lib/rspec_fixtures/approval_handler.rb', line 14

def run(expected, actual, fixture_file)
  @expected = expected
  @actual = actual
  @fixture_file = fixture_file

  show expected.empty? ? actual : diff
  prompt_user
end