Sha256: f4bde25a7064ba9e747578c58945bb20d0d12713b0a3dfc2bd4e52afd3bf18dd

Contents?: true

Size: 1.03 KB

Versions: 28

Compression:

Stored size: 1.03 KB

Contents

require 'spec_helper'

describe CobotClient::UrlHelper, 'cobot_url' do
  let(:helper) do
    Object.new.tap do |o|
      o.extend CobotClient::UrlHelper
    end
  end

  after(:each) do
    CobotClient::UrlHelper.site = 'https://www.cobot.me'
  end

  it 'lets me change the site' do
    CobotClient::UrlHelper.site = 'https://www.cobot.com'

    expect(helper.cobot_url).to eql('https://www.cobot.com/')
  end

  it 'returns the default url' do
    expect(helper.cobot_url).to eql('https://www.cobot.me/')
  end

  it 'returns a url with a sudomain' do
    expect(helper.cobot_url('co-up')).to eql('https://co-up.cobot.me/')
  end

  it 'returns a url with a path' do
    expect(helper.cobot_url('co-up', '/x/y')).to eql('https://co-up.cobot.me/x/y')
  end

  it 'returns a url with params' do
    expect(helper.cobot_url('co-up', params: {x: 'y'})).to eql('https://co-up.cobot.me/?x=y')
  end

  it 'returns a url with params and path' do
    expect(helper.cobot_url('co-up', '/x/y', params: {a: 'b'})).to eql('https://co-up.cobot.me/x/y?a=b')
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
cobot_client-5.0.0 spec/cobot_client/url_helper_spec.rb
cobot_client-4.0.0 spec/cobot_client/url_helper_spec.rb
cobot_client-3.1.0 spec/cobot_client/url_helper_spec.rb
cobot_client-3.0.0 spec/cobot_client/url_helper_spec.rb
cobot_client-2.1.0 spec/cobot_client/url_helper_spec.rb
cobot_client-2.0.0 spec/cobot_client/url_helper_spec.rb
cobot_client-1.4.2 spec/cobot_client/url_helper_spec.rb
cobot_client-1.4.0 spec/cobot_client/url_helper_spec.rb
cobot_client-1.3.1 spec/cobot_client/url_helper_spec.rb
cobot_client-1.3.0 spec/cobot_client/url_helper_spec.rb
cobot_client-1.2.4 spec/cobot_client/url_helper_spec.rb
cobot_client-1.2.3 spec/cobot_client/url_helper_spec.rb
cobot_client-1.2.2 spec/cobot_client/url_helper_spec.rb
cobot_client-1.2.1 spec/cobot_client/url_helper_spec.rb
cobot_client-1.2.0 spec/cobot_client/url_helper_spec.rb
cobot_client-1.1.1 spec/cobot_client/url_helper_spec.rb
cobot_client-1.1.0 spec/cobot_client/url_helper_spec.rb
cobot_client-1.0.0 spec/cobot_client/url_helper_spec.rb
cobot_client-0.8.0 spec/cobot_client/url_helper_spec.rb
cobot_client-0.7.0 spec/cobot_client/url_helper_spec.rb