Sha256: 27518ba8432919a8a8b69bb06b212ad5ecbd18b65d9790c610d88ac9c41bb255
Contents?: true
Size: 1.1 KB
Versions: 9
Compression:
Stored size: 1.1 KB
Contents
require 'spec_helper' describe Influxer::Client do let(:conf) { Influxer.config } subject { Influxer.client } describe "#initialize" do it "sets config database value" do expect(subject.config.database).to eq conf.database end it "passes config params" do conf.username = 'admin' conf.port = 2222 expect(subject.config.username).to eq 'admin' expect(subject.config.port).to eq 2222 end end describe "cache", :query do let(:q) { "list series" } after { Rails.cache.clear } it "writes data to cache" do conf.cache = {} subject.query(q) expect(Rails.cache.exist?("influxer:listseries")).to be_truthy end it "should write data to cache with expiration" do conf.cache = { expires_in: 90 } subject.query(q) expect(Rails.cache.exist?("influxer:listseries")).to be_truthy Timecop.travel(1.minute.from_now) expect(Rails.cache.exist?("influxer:listseries")).to be_truthy Timecop.travel(2.minutes.from_now) expect(Rails.cache.exist?("influxer:listseries")).to be_falsey end end end
Version data entries
9 entries across 9 versions & 1 rubygems