Sha256: 61d9c110ce744cd8b9022e53868d93b0a6a6d8ac420d625310e95bcc77271844

Contents?: true

Size: 832 Bytes

Versions: 40

Compression:

Stored size: 832 Bytes

Contents

require 'lib/spec_helper'

# Below the helpers expected from a spec that
# includes these shared examples:
#
# @object [PathReader] path_reader the object under test
# @method [String]     path        the path we want to read
# @method [String]     contents    the contents we expect to be read
#
shared_examples :path_reader do
  describe '#paths' do
    it 'is an Enumberable' do
      expect(path_reader.paths).to be_an(Enumerable)
    end

    it 'includes Opal.paths' do
      paths = path_reader.paths.to_a
      Opal.paths.each { |path| expect(paths).to include(path) }
    end
  end

  describe '#read' do
    it 'responds to #path' do
      expect(path_reader.read(path)).to eq(contents)
    end

    it 'returns nil if the file is missing' do
      expect(path_reader.read('unexpected-path!')).to be_nil
    end
  end
end

Version data entries

40 entries across 40 versions & 3 rubygems

Version Path
opal-0.10.6 spec/lib/shared/path_reader_shared.rb
opal-0.10.6.beta spec/lib/shared/path_reader_shared.rb
opal-0.10.5 spec/lib/shared/path_reader_shared.rb
opal-0.10.4 spec/lib/shared/path_reader_shared.rb
opal-0.11.0.rc1 spec/lib/shared/path_reader_shared.rb
opal-0.10.3 spec/lib/shared/path_reader_shared.rb
opal-0.10.2 spec/lib/shared/path_reader_shared.rb
opal-0.10.1 spec/lib/shared/path_reader_shared.rb
opal-0.10.0 spec/lib/shared/path_reader_shared.rb
opal-0.10.0.rc2 spec/lib/shared/path_reader_shared.rb
opal-0.9.4 spec/lib/shared/path_reader_shared.rb
opal-0.9.3 spec/lib/shared/path_reader_shared.rb
opal-0.10.0.rc1 spec/lib/shared/path_reader_shared.rb
opal-0.10.0.beta5 spec/lib/shared/path_reader_shared.rb
opal-0.10.0.beta4 spec/lib/shared/path_reader_shared.rb
opal-0.10.0.beta3 spec/lib/shared/path_reader_shared.rb
opal-0.10.0.beta2 spec/lib/shared/path_reader_shared.rb
opal-0.10.0.beta1 spec/lib/shared/path_reader_shared.rb
opal-0.9.2 spec/lib/shared/path_reader_shared.rb
opal-0.9.0 spec/lib/shared/path_reader_shared.rb