Sha256: 7659bcb28e6f000727530e64d78d3b5d9e05340c4c01fee1f62b30d2a1735ba2

Contents?: true

Size: 1.3 KB

Versions: 3

Compression:

Stored size: 1.3 KB

Contents

require 'nc'

RSpec.describe Nc do
  let(:formatter) { Nc.new(StringIO.new) }
  let(:current_dir) { File.basename(File.expand_path '.') }

  context 'with failing examples' do
    let(:notification) do
      instance_double(RSpec::Core::Notifications::SummaryNotification,
        formatted_duration: '0.0001 seconds',
        totals_line: '3 examples, 1 failure, 1 pending',
        failure_count: 1,
      )
    end

    it 'sends a failure summary notification' do
      expect(TerminalNotifier).to receive(:notify).with(
        "Finished in 0.0001 seconds\n3 examples, 1 failure, 1 pending",
        :title => "#{Nc::FAILURE_EMOJI} #{current_dir}: 1 failed example"
      )
      formatter.dump_summary(notification)
    end
  end

  context 'with all examples passing' do
    let(:notification) do
      instance_double(RSpec::Core::Notifications::SummaryNotification,
        formatted_duration: '0.0001 seconds',
        totals_line: '3 examples, 0 failures, 1 pending',
        failure_count: 0,
      )
    end

    it 'sends a success summary notification' do
      expect(TerminalNotifier).to receive(:notify).with(
        "Finished in 0.0001 seconds\n3 examples, 0 failures, 1 pending",
        :title => "#{Nc::SUCCESS_EMOJI} #{current_dir}: Success"
      )
      formatter.dump_summary(notification)
    end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
gameboard-3.1.0 vendor/bundle/ruby/2.3.0/gems/rspec-nc-0.3.0/spec/nc_spec.rb
gameboard-3.0.0 vendor/bundle/ruby/2.3.0/gems/rspec-nc-0.3.0/spec/nc_spec.rb
rspec-nc-0.3.0 spec/nc_spec.rb