spec/unit/configuration_spec.rb in influxdb-rails-0.4.999 vs spec/unit/configuration_spec.rb in influxdb-rails-1.0.0.beta1

- old
+ new

@@ -1,20 +1,20 @@ -require 'spec_helper' +require "spec_helper" RSpec.describe InfluxDB::Rails::Configuration do before do @configuration = InfluxDB::Rails::Configuration.new end describe "#ignore_user_agent?" do it "should be true for user agents that have been set as ignorable" do - @configuration.ignored_user_agents = %w{Googlebot} + @configuration.ignored_user_agents = %w[Googlebot] expect(@configuration.ignore_user_agent?("Googlebot/2.1")).to be_truthy end it "should be false for user agents that have not been set as ignorable" do - @configuration.ignored_user_agents = %w{Googlebot} + @configuration.ignored_user_agents = %w[Googlebot] expect(@configuration.ignore_user_agent?("Mozilla/5.0")).to be_falsey end it "should be false if the ignored user agents list is empty" do @configuration.ignored_user_agents = [] @@ -27,12 +27,10 @@ end end describe "#retry" do it "defaults to nil" do - InfluxDB::Rails.configure do |config| - end expect(InfluxDB::Rails.configuration.retry).to be_nil end it "can be updated" do InfluxDB::Rails.configure do |config| @@ -42,12 +40,10 @@ end end describe "#open_timeout" do it "defaults to 5" do - InfluxDB::Rails.configure do |config| - end expect(InfluxDB::Rails.configuration.open_timeout).to eql(5) end it "can be updated" do InfluxDB::Rails.configure do |config| @@ -57,12 +53,10 @@ end end describe "#read_timeout" do it "defaults to 300" do - InfluxDB::Rails.configure do |config| - end expect(InfluxDB::Rails.configuration.read_timeout).to eql(300) end it "can be updated" do InfluxDB::Rails.configure do |config| @@ -72,12 +66,10 @@ end end describe "#max_delay" do it "defaults to 30" do - InfluxDB::Rails.configure do |config| - end expect(InfluxDB::Rails.configuration.max_delay).to eql(30) end it "can be updated" do InfluxDB::Rails.configure do |config| @@ -87,18 +79,30 @@ end end describe "#time_precision" do it "defaults to seconds" do + expect(InfluxDB::Rails.configuration.time_precision).to eql("s") + end + + it "can be updated" do InfluxDB::Rails.configure do |config| + config.time_precision = "ms" end - expect(InfluxDB::Rails.configuration.time_precision).to eql('s') + expect(InfluxDB::Rails.configuration.time_precision).to eql("ms") end + end - it "can be updated" do + describe "#rails_app_name" do + it "defaults to nil" do + expect(InfluxDB::Rails.configuration.rails_app_name).to be(nil) + end + + it "can be set to own name" do InfluxDB::Rails.configure do |config| - config.time_precision = 'ms' + config.rails_app_name = "my-app" end - expect(InfluxDB::Rails.configuration.time_precision).to eql('ms') + + expect(InfluxDB::Rails.configuration.rails_app_name).to eq("my-app") end end end