Sha256: 0fd1c5b48b7f985abfb10277a547d84eb8b4afbfd2fa18831c530ab0ae9e50ac
Contents?: true
Size: 1.25 KB
Versions: 1
Compression:
Stored size: 1.25 KB
Contents
require "spec_helper" RSpec.shared_examples_for "with additional tags" do |series_names| context "when tags_middleware is overwritten" do before do allow(config).to receive(:tags_middleware).and_return(tags_middleware) end let(:tags_middleware) { ->(tags) { tags.merge(static: "value", nil: nil, empty: "") } } it "processes tags throught the middleware" do tags = data[:tags].merge(static: "value") series_names.each do |series_name| expect_any_instance_of(InfluxDB::Client).to receive(:write_point).with(series_name, include(tags: tags)) end subject.call("unused", start, finish, "unused", payload) end end context "when tags are set in the current context" do let(:input) do { another: :value, nil: nil, empty: "" } end let(:output) do { another: :value } end after do InfluxDB::Rails.current.reset end it "does include the tags" do InfluxDB::Rails.current.tags = input tags = data[:tags].merge(output) series_names.each do |series_name| expect_any_instance_of(InfluxDB::Client).to receive(:write_point).with(series_name, include(tags: tags)) end subject.call("unused", start, finish, "unused", payload) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
experimental-influxdb-rails-1.0.0.beta5 | spec/shared_examples/tags.rb |