Sha256: 5742f38df5798a339a768372014aecbbd4804043a216782e6fc329db1dfbe297

Contents?: true

Size: 657 Bytes

Versions: 2

Compression:

Stored size: 657 Bytes

Contents

require 'spec_helper'

describe "exist" do
  it 'passes when the file exists' do
    allow(File).to receive(:exist?).with('/some/file/path').and_return(true)
    expect('/some/file/path').to exist
  end

  it 'fails when the file does not exist' do
    allow(File).to receive(:exist?).with('/some/file/path').and_return(false)
    expect('/some/file/path').to_not exist
  end

  it 'maintains default RSpec behavior', :aggregate_failures do
    path = Pathname.new('/some/file/path')
    allow(path).to receive(:exist?).and_return(true)
    expect(path).to exist
    allow(path).to receive(:exist?).and_return(false)
    expect(path).not_to exist
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ammeter-1.1.7 spec/ammeter/rspec/generator/matchers/exist_spec.rb
ammeter-1.1.6 spec/ammeter/rspec/generator/matchers/exist_spec.rb