Sha256: 381b0c6930a27c098099bdf6e2c5f41f8733228be928b206c079934de3bbf46c
Contents?: true
Size: 1.3 KB
Versions: 2
Compression:
Stored size: 1.3 KB
Contents
require 'spec_helper' require 'aruba/aruba_path' RSpec.describe Aruba::ArubaPath do subject(:path) { described_class.new(new_path) } let(:new_path) { 'path/to/dir' } it { expect(path).to be } describe '#to_s' do end describe '#to_s' do context 'when string is used' do it { expect(path.to_s).to eq new_path } end # make it compatible with the old API context 'when array is used' do let(:net_path) { %w(path to dir) } it { expect(path.to_s).to eq File.join(*new_path) } end end describe '#push' do before(:each) { path.push 'subdir' } it { expect(path.to_s).to eq 'path/to/dir/subdir' } end describe '#<<' do before(:each) { path << 'subdir' } it { expect(path.to_s).to eq 'path/to/dir/subdir' } end describe '#pop' do before(:each) { path.pop } it { expect(path.to_s).to eq 'path/to' } end describe '#relative?' do context 'when is relative' do it { expect(path).to be_relative } end context 'when is absolute' do let(:new_path) { '/absolute/path' } it { expect(path).not_to be_relative } end end describe '#[]' do context 'when single index' do it { expect(path[0]).to eq 'p' } end context 'when range' do it { expect(path[0..1]).to eq 'pa' } end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
aruba-0.8.0.pre2 | spec/aruba/aruba_path_spec.rb |
aruba-0.8.0.pre | spec/aruba/aruba_path_spec.rb |