Sha256: da81d309a2dbe67d9bcb15b9b3373bb2cfe5d13be62d867de63c6e724cb68295

Contents?: true

Size: 1 KB

Versions: 2

Compression:

Stored size: 1 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/spec_helper')

describe "Endpoint generation" do
  
  it "should generate endpoints for metrics" do
    RestfulMetrics::Endpoint.metrics.should =~ /metrics.json/
  end
  
  it "should generate endpoints for compound metrics" do
    RestfulMetrics::Endpoint.compound_metrics.should =~ /compound_metrics.json/
  end


  describe '#endpoint_url' do
    let(:endpoint_url) { RestfulMetrics::Endpoint.endpoint_url('') }

    it 'generates URLs for track.restfulmetrics.com' do
      endpoint_url.should include 'track.restfulmetrics.com'
    end

    context 'when the RESTFUL_METRICS_REALM environment variable is set' do
      let(:realm) { 'track.example.com' }

      before do
        @original_env = ENV.to_hash
        ENV['RESTFUL_METRICS_REALM'] = 'https://track.example.com'
      end

      after do
        ENV.replace(@original_env)
      end

      it 'generates URLs for the given realm' do
        endpoint_url.should include realm
      end
    end

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
restful_metrics-2.0.0.pre.alpha.1 spec/endpoint_spec.rb
restful_metrics-1.1.5 spec/endpoint_spec.rb