Sha256: 28352f66b159d3b2dbee7915909fb215c99ef9c038271f6026723a12a18a2217

Contents?: true

Size: 960 Bytes

Versions: 12

Compression:

Stored size: 960 Bytes

Contents

require "spec_helper"

RSpec.describe InfluxDB::Rails::Sql::Query do
  let(:payload) do
    {
      sql:  "select * from users where user_id = 42;",
      name: "User Load",
    }
  end
  subject { described_class.new(payload) }

  describe "#class_name" do
    it { expect(subject.class_name).to eq("User") }
  end

  describe "#operation" do
    it { expect(subject.operation).to eq("SELECT") }
  end

  describe "#track?" do
    it { expect(described_class.new(sql: "INSERT").track?).to be true }
    it { expect(described_class.new(sql: "UPDATE").track?).to be true }
    it { expect(described_class.new(sql: "SELECT").track?).to be true }
    it { expect(described_class.new(sql: "DELETE").track?).to be true }
    it { expect(described_class.new(sql: "SCHEMA").track?).to be false }
    it { expect(described_class.new(sql: "BEGIN").track?).to be false }
    it { expect(described_class.new(sql: "SELECT", name: "SCHEMA").track?).to be false }
  end
end

Version data entries

12 entries across 12 versions & 3 rubygems

Version Path
influxdb-rails-1.0.3 spec/unit/sql/query_spec.rb
influxdb-rails-1.0.2 spec/unit/sql/query_spec.rb
influxdb-rails-1.0.1 spec/unit/sql/query_spec.rb
influxdb-rails-1.0.1.beta3 spec/unit/sql/query_spec.rb
influxdb-rails-1.0.1.beta2 spec/unit/sql/query_spec.rb
influxdb-rails-1.0.1.beta1 spec/unit/sql/query_spec.rb
influxdb-rails-1.0.0 spec/unit/sql/query_spec.rb
asklytics-influxdb-rails-1.0.0 spec/unit/sql/query_spec.rb
asklytics-influxdb-rails-1.0.0.beta3 spec/unit/sql/query_spec.rb
influxdb-rails-1.0.0.beta4 spec/unit/sql/query_spec.rb
experimental-influxdb-rails-1.0.0.beta5 spec/unit/sql/query_spec.rb
influxdb-rails-1.0.0.beta3 spec/unit/sql/query_spec.rb