Sha256: d6b20f3332bc7754aa3bccf00c1bcd98c26cae2f6c8fd7bbc73d182ca555c012

Contents?: true

Size: 1.12 KB

Versions: 17

Compression:

Stored size: 1.12 KB

Contents

require "spec_helper"

module Scenic
  module Adapters
    describe Postgres::Views, :db do
      it "returns scenic view objects for plain old views" do
        connection = ActiveRecord::Base.connection
        connection.execute <<-SQL
          CREATE VIEW children AS SELECT text 'Elliot' AS name
        SQL

        views = Postgres::Views.new(connection).all
        first = views.first

        expect(views.size).to eq 1
        expect(first.name).to eq "children"
        expect(first.materialized).to be false
        expect(first.definition).to eq "SELECT 'Elliot'::text AS name;"
      end

      it "returns scenic view objects for materialized views" do
        connection = ActiveRecord::Base.connection
        connection.execute <<-SQL
          CREATE MATERIALIZED VIEW children AS SELECT text 'Owen' AS name
        SQL

        views = Postgres::Views.new(connection).all
        first = views.first

        expect(views.size).to eq 1
        expect(first.name).to eq "children"
        expect(first.materialized).to be true
        expect(first.definition).to eq "SELECT 'Owen'::text AS name;"
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 2 rubygems

Version Path
scenic-1.8.0 spec/scenic/adapters/postgres/views_spec.rb
scenic-1.7.0 spec/scenic/adapters/postgres/views_spec.rb
scenic-1.6.0 spec/scenic/adapters/postgres/views_spec.rb
scenic-1.5.5 spec/scenic/adapters/postgres/views_spec.rb
scenic-jets-1.5.5 spec/scenic/adapters/postgres/views_spec.rb
scenic-jets-1.5.4 spec/scenic/adapters/postgres/views_spec.rb
scenic-1.5.4 spec/scenic/adapters/postgres/views_spec.rb
scenic-1.5.3 spec/scenic/adapters/postgres/views_spec.rb
scenic-1.5.2 spec/scenic/adapters/postgres/views_spec.rb
scenic-1.5.1 spec/scenic/adapters/postgres/views_spec.rb
scenic-1.5.0 spec/scenic/adapters/postgres/views_spec.rb
scenic-1.4.1 spec/scenic/adapters/postgres/views_spec.rb
scenic-1.4.0 spec/scenic/adapters/postgres/views_spec.rb
scenic-1.3.0 spec/scenic/adapters/postgres/views_spec.rb
scenic-1.2.0 spec/scenic/adapters/postgres/views_spec.rb
scenic-1.1.1 spec/scenic/adapters/postgres/views_spec.rb
scenic-1.1.0 spec/scenic/adapters/postgres/views_spec.rb