Skip to content

Clean up tests #26

Description

@ydaniju

Based on discussion on this thread #24, I did some research and found out an easier way to test what is being printed to STDOUT and STDERR without hassles.

The solution is Open3, it's really clean!

Testing could be as simple as:

require 'open3'

...

context 'when options is non verbose' do
  message, error = Open3.capture2e('hscode -c 422')
  it 'prints code title only' do
    expect(message).to include '422 - Unprocessable Entity'
    expect(error.exitstatus).to eql 0 # or
    expect(error.success?).to be true
  end
end 

Once this is accepted, I can go ahead cleaning up the whole test suite.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions