Sha256: d11d93931500d069b997917958049b108c1939c43bca602795e852bc1d500a30

Contents?: true

Size: 1.13 KB

Versions: 6

Compression:

Stored size: 1.13 KB

Contents

require 'spec_helper'

describe Faraday::Conductivity::UserAgent do

  subject(:user_agent) { response.env[:request_headers]["User-Agent"] }

  it "includes the name and version of the app" do
    user_agent.should start_with "MarketingSite/1.1"
  end

  it "includes the current ruby version" do
    user_agent.should include RUBY_VERSION
  end

  it "includes the current ruby engine" do
    user_agent.should include RUBY_ENGINE
  end

  it "includes the current ruby patch level" do
    user_agent.should include RUBY_PATCHLEVEL.to_s
  end

  it "includes the platform" do
    user_agent.should include RUBY_PLATFORM
  end

  it "includes the pid" do
    user_agent.should include "1337"
  end

  it "includes the current host" do
    user_agent.should include "my.hostname"
  end

  it "includes the current user name" do
    user_agent.should include "linus"
  end

  let(:environment) {
    double :environment, :login => "linus", :hostname => "my.hostname", :pid => 1337
  }

  def connection
    create_connection do |faraday|
      faraday.request :user_agent, :app => "MarketingSite", :version => "1.1", :environment => environment
    end
  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
faraday-conductivity-0.3.0 spec/middleware/user_agent_spec.rb
faraday-conductivity-0.2.1 spec/middleware/user_agent_spec.rb
faraday-conductivity-0.2.0 spec/middleware/user_agent_spec.rb
faraday-conductivity-0.1.1 spec/middleware/user_agent_spec.rb
faraday-conductivity-0.1.0 spec/middleware/user_agent_spec.rb
faraday-conductivity-0.0.4 spec/middleware/user_agent_spec.rb