Sha256: 59154e953a40771a208ce51d06e24069f9fbfe883d018c12e43049b5e642f05e

Contents?: true

Size: 685 Bytes

Versions: 4

Compression:

Stored size: 685 Bytes

Contents

require "#{File.dirname(__FILE__)}/../spec_helper"

RSpec.describe "Context", type: :request do
  it "resets the context after a request" do
    get "/metrics"

    expect_metric(
      tags: a_hash_including(
        location: "MetricsController#index",
        hook:     "sql"
      )
    )

    expect(InfluxDB::Rails.current.tags).to be_empty
    expect(InfluxDB::Rails.current.values).to be_empty
  end

  it "resets the context after a request when exceptioni occurs" do
    setup_broken_client

    get "/metrics"

    expect_no_metric(hook: "process_action")
    expect(InfluxDB::Rails.current.tags).to be_empty
    expect(InfluxDB::Rails.current.values).to be_empty
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
influxdb-rails-1.0.3 spec/requests/context_spec.rb
influxdb-rails-1.0.2 spec/requests/context_spec.rb
influxdb-rails-1.0.1 spec/requests/context_spec.rb
influxdb-rails-1.0.1.beta3 spec/requests/context_spec.rb