Sha256: 825f6dba6b499b69e3c2f711e7e216c6a879d7f4c5ff1654ae4dcd1d3edb1dc8

Contents?: true

Size: 977 Bytes

Versions: 12

Compression:

Stored size: 977 Bytes

Contents

require 'spec_helper'

describe "Authy::URL" do
  class Dummy
    include Authy::URL
  end

  describe "escape_for_url" do
    it "should user URI escape" do
      URI.should_receive :escape
      Dummy.escape_for_url("that")
    end

    it "should use Regexp" do
      Regexp.should_receive(:new).with("[^#{URI::PATTERN::UNRESERVED}]").and_return(/a/)
      Dummy.escape_for_url("that")
    end
  end

  describe "to_param" do
    it "should user HTTP::Message.escape" do
      HTTP::Message.should_receive(:escape).exactly(2).times.and_return "basic string"
      Dummy.to_param('key', 'value')
    end

    it "should paramify the left to right" do
      Dummy.to_param('key', 'value').should == 'key=value'
    end
  end

  describe "params_from_array" do
    it "should return an array of params" do
      Dummy.params_from_array("da key", ["one", "two"]).should == [HTTP::Message.escape("da key[]") + "=one", HTTP::Message.escape("da key[]") + "=two"]
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
authy-2.7.1 spec/authy/url_helpers_spec.rb
authy-2.7.0 spec/authy/url_helpers_spec.rb
authy-2.6.2 spec/authy/url_helpers_spec.rb
authy-2.6.1 spec/authy/url_helpers_spec.rb
authy-2.6.0 spec/authy/url_helpers_spec.rb
authy-2.5.0.pre spec/authy/url_helpers_spec.rb
authy-2.4.2 spec/authy/url_helpers_spec.rb
authy-2.4.1 spec/authy/url_helpers_spec.rb
authy-2.4.0 spec/authy/url_helpers_spec.rb
authy-2.3.1 spec/authy/url_helpers_spec.rb
authy-2.3.0 spec/authy/url_helpers_spec.rb
authy-2.2.0 spec/authy/url_helpers_spec.rb