Sha256: db7be45a8debb6445d9879c48be6d95ba9c3cadbd18f44f0c0c29c8794b9345d

Contents?: true

Size: 974 Bytes

Versions: 9

Compression:

Stored size: 974 Bytes

Contents

require "spec_helper"

module Fx
  module Adapters
    describe Postgres::Functions, :db do
      describe ".all" do
        it "returns `Function` objects" do
          connection = ActiveRecord::Base.connection
          connection.execute <<-EOS.strip_heredoc
            CREATE OR REPLACE FUNCTION test()
            RETURNS text AS $$
            BEGIN
                RETURN 'test';
            END;
            $$ LANGUAGE plpgsql;
          EOS

          functions = Postgres::Functions.new(connection).all

          first = functions.first
          expect(functions.size).to eq 1
          expect(first.name).to eq "test"
          expect(first.definition).to eq <<-EOS.strip_heredoc
            CREATE OR REPLACE FUNCTION public.test()
             RETURNS text
             LANGUAGE plpgsql
            AS $function$
            BEGIN
                RETURN 'test';
            END;
            $function$
          EOS
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
fx-0.8.0 spec/fx/adapters/postgres/functions_spec.rb
fx-0.7.0 spec/fx/adapters/postgres/functions_spec.rb
fx-jets-0.6.3s spec/fx/adapters/postgres/functions_spec.rb
fx-0.6.2 spec/fx/adapters/postgres/functions_spec.rb
fx-0.6.1 spec/fx/adapters/postgres/functions_spec.rb
fx-0.6.0 spec/fx/adapters/postgres/functions_spec.rb
fx-0.5.0 spec/fx/adapters/postgres/functions_spec.rb
fx-0.4.0 spec/fx/adapters/postgres/functions_spec.rb
fx-0.3.1 spec/fx/adapters/postgres/functions_spec.rb