Sha256: 33eb93a11c1a6c153dff31d75dff913f2d0404017602aa5c913e61ffa734968f
Contents?: true
Size: 1.29 KB
Versions: 1
Compression:
Stored size: 1.29 KB
Contents
# frozen_string_literal: true require File.expand_path('spec_helper', __dir__) require 'undercover/cli' # rubocop:disable Metrics/BlockLength module DangerUndercover describe DangerUndercover::CLI do let!(:mock_message) { 'Test Passed' } let!(:directory) { File.join(Dir.getwd, 'coverage') } # default directory let!(:file) { File.join(Dir.getwd, 'coverage/undercover.txt') } # default file before(:each) do # mocks the undercover #{args&.join(' ')} CLI command output. allow(described_class).to receive(:`).and_return(mock_message) end after(:all) do # removes the folder after tests pass. FileUtils.rm_rf(File.join(Dir.getwd, 'coverage')) end it 'prints the undercover output' do expect(described_class.run).to eql(mock_message) end it "creates a default folder if doesn't exists" do FileUtils.rm_rf(directory) described_class.run expect(Dir.exist?(directory)).to be true end it 'creates default file undercover.txt' do described_class.run expect(File.exist?(file)).to be true end it 'writes undercover report to default file' do described_class.run report = File.open(file).read expect(report).to eql(mock_message) end end end # rubocop:enable Metrics/BlockLength
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
danger-undercover-1.1.0 | spec/cli_spec.rb |