Sha256: 450656388007ccf30b438682f198bad978b7189c3be0a8b8dd3ab5d36609c717

Contents?: true

Size: 893 Bytes

Versions: 19

Compression:

Stored size: 893 Bytes

Contents

require 'spec_helper'

describe GroupDocs::Api::Helpers::Path do

  describe '.verify_starts_with_root' do
    it 'does not raise error if path starts with /' do
      -> { described_class.verify_starts_with_root('/Test') }.should_not raise_error(ArgumentError)
    end

    it 'raises error if path does not start with /' do
      -> { described_class.verify_starts_with_root('Test') }.should raise_error(ArgumentError)
    end
  end

  describe '.append_file_name' do
    it 'does not change path if filename is present' do
      path = '/upload_path/test.pdf'
      described_class.append_file_name(path, __FILE__)
      path.should == '/upload_path/test.pdf'
    end

    it 'appends filename to path if it is not passed' do
      path = '/upload_path'
      described_class.append_file_name(path, __FILE__)
      path.should == "/upload_path/#{File.basename(__FILE__)}"
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
groupdocs-0.3.11 spec/groupdocs/api/helpers/path_helper_spec.rb
groupdocs-0.3.10 spec/groupdocs/api/helpers/path_helper_spec.rb
groupdocs-0.3.9 spec/groupdocs/api/helpers/path_helper_spec.rb
groupdocs-0.3.8 spec/groupdocs/api/helpers/path_helper_spec.rb
groupdocs-0.3.7 spec/groupdocs/api/helpers/path_helper_spec.rb
groupdocs-0.3.6 spec/groupdocs/api/helpers/path_helper_spec.rb
groupdocs-0.3.5 spec/groupdocs/api/helpers/path_helper_spec.rb
groupdocs-0.3.0 spec/groupdocs/api/helpers/path_helper_spec.rb
groupdocs-0.2.11 spec/groupdocs/api/helpers/path_helper_spec.rb
groupdocs-0.2.10 spec/groupdocs/api/helpers/path_helper_spec.rb
groupdocs-0.2.9 spec/groupdocs/api/helpers/path_helper_spec.rb
groupdocs-0.2.8 spec/groupdocs/api/helpers/path_helper_spec.rb
groupdocs-0.2.7 spec/groupdocs/api/helpers/path_helper_spec.rb
groupdocs-0.2.6 spec/groupdocs/api/helpers/path_helper_spec.rb
groupdocs-0.2.5 spec/groupdocs/api/helpers/path_helper_spec.rb
groupdocs-0.2.4 spec/groupdocs/api/helpers/path_helper_spec.rb
groupdocs-0.2.3 spec/groupdocs/api/helpers/path_helper_spec.rb
groupdocs-0.2.2 spec/groupdocs/api/helpers/path_helper_spec.rb
groupdocs-0.2.1 spec/groupdocs/api/helpers/path_helper_spec.rb