Sha256: 00e1c4b968ec6caba38d79bd6511800c1e45bdba20d43ad7503da4fb5ba6a877

Contents?: true

Size: 984 Bytes

Versions: 1

Compression:

Stored size: 984 Bytes

Contents

require 'nc_first_fail'

describe NcFirstFail do
  let(:formatter) { NcFirstFail.new(StringIO.new) }
  let(:current_dir) { File.basename(File.expand_path '.') }
  let(:example) { double 'example' }
  let(:example2) { double 'example2' }

  let(:failure) { "\u26D4" }
  let(:exception) { 'exception' }
  let(:description) { 'description' }

  before do
    example.should_receive(:metadata).any_number_of_times.and_return({:full_description => description})
    example.should_receive(:exception).any_number_of_times.and_return(exception)
  end

  it 'notifies the first failure only' do
    TerminalNotifier.should_receive(:notify).with("#{description}\n#{exception}",
      :title => "#{failure} #{current_dir}: Failure"
    )

    formatter.example_failed(example)
    formatter.example_failed(example2)
  end

  it "doesn't notify in the end if there has been any failures" do
    TerminalNotifier.should_not_receive(:notify)

    formatter.dump_summary(0.0001, 2, 1, 0)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rspec-nc-0.0.6 spec/nc_first_fail_spec.rb