Sha256: d06566251d0c4e78f9836015eec951d234d8cf42f6eb508e7b20379abffe4e37

Contents?: true

Size: 1.3 KB

Versions: 13

Compression:

Stored size: 1.3 KB

Contents

require "spec_helper"

RSpec.describe InfluxDB::Rails::Sql::Normalizer do
  describe "#perform" do
    it { expect(described_class.new("SELECT * FROM posts WHERE id = 1").perform).to eq("SELECT * FROM posts WHERE id = xxx") }
    it { expect(described_class.new("SELECT * FROM posts WHERE id = 1".freeze).perform).to eq("SELECT * FROM posts WHERE id = xxx") }
    it { expect(described_class.new("SELECT * FROM posts LIMIT 10").perform).to eq("SELECT * FROM posts LIMIT xxx") }
    it { expect(described_class.new("SELECT * FROM posts OFFSET 10").perform).to eq("SELECT * FROM posts OFFSET xxx") }
    it { expect(described_class.new("SELECT * FROM posts WHERE name LIKE '%foobar%'").perform).to eq("SELECT * FROM posts WHERE name LIKE xxx") }
    it { expect(described_class.new("SELECT * FROM posts WHERE id IN (1,2,3)").perform).to eq("SELECT * FROM posts WHERE id IN (xxx)") }
    it { expect(described_class.new("SELECT * FROM products WHERE price BETWEEN 10 AND 20").perform).to eq("SELECT * FROM products WHERE price BETWEEN xxx AND xxx") }
    it { expect(described_class.new("INSERT INTO products (title, price) VALUES ('Computer', 100)").perform).to eq("INSERT INTO products (title, price) VALUES (xxx)") }
    it { expect(described_class.new("   SELECT * FROM   POSTS    ").perform).to eq("SELECT * FROM POSTS") }
  end
end

Version data entries

13 entries across 13 versions & 3 rubygems

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