Sha256: 094b87c6024b3d33c340045660849b3ce9b5230559cc99192abf20d517956de7

Contents?: true

Size: 1.31 KB

Versions: 1

Compression:

Stored size: 1.31 KB

Contents

#encoding: UTF-8

require 'spec_helper'

describe Egnyte::Helper do
  describe "#normalize_path" do
  	it 'should remove leading and trailing slashes' do
	    expect(Egnyte::Helper.normalize_path('/banana')).to eq('banana')
	    expect(Egnyte::Helper.normalize_path('banana/')).to eq('banana')
	    expect(Egnyte::Helper.normalize_path('/banana/')).to eq('banana')
	    expect(Egnyte::Helper.normalize_path('banana')).to eq('banana')
	    expect(Egnyte::Helper.normalize_path('/ban/ana/')).to eq('ban/ana')
	end
  end

  describe "#params_to_s" do
    it 'should convert a parameters hash to an properly formatted params query string' do
      expect(Egnyte::Helper.params_to_s({email: 'test@egnyte.com'})).to eq "?email=test@egnyte.com"
      # expect(Egnyte::Helper.params_to_filter_string({authType: 'ad', userType: 'power'})).to eq "?filter=authType%20eq%20%22ad%22&filter=userType%20eq%20%22power%22"
    end
  end

  describe "#params_to_filter_string" do
  	it 'should convert a parameters hash to an Egnyte formatted filter string' do
  		expect(Egnyte::Helper.params_to_filter_string({email: 'test@egnyte.com'})).to eq "?filter=email eq \"test@egnyte.com\""
  		expect(Egnyte::Helper.params_to_filter_string({authType: 'ad', userType: 'power'})).to eq "?filter=authType eq \"ad\"&filter=userType eq \"power\""
  	end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ruby-egnyte-0.1.6 spec/helper_spec.rb