Sha256: 2b3ce112acc8e4115ab79f490bb26aa8827431fd932eb7e36db3e1da6362c6bb

Contents?: true

Size: 1.08 KB

Versions: 13

Compression:

Stored size: 1.08 KB

Contents

describe 'Gratan::Client#export' do
  context 'when function exists' do
    let(:grantfile) {
      <<-RUBY
user "scott", "%" do
  on "*.*" do
    grant "USAGE"
  end

  on "FUNCTION #{TEST_DATABASE}.my_func" do
    grant "EXECUTE"
  end
end
      RUBY
    }

    subject { client }

    before do
      mysql do |cli|
        drop_database(cli)
        create_database(cli)
        create_function(cli, :my_func)
      end

      apply(subject) do
        grantfile
      end
    end

    it do
      expect(subject.export.strip).to eq grantfile.strip
    end
  end

  context 'when procedure exists' do
    let(:grantfile) {
      <<-RUBY
user "scott", "%" do
  on "*.*" do
    grant "USAGE"
  end

  on "PROCEDURE #{TEST_DATABASE}.my_prcd" do
    grant "EXECUTE"
  end
end
      RUBY
    }

    subject { client }

    before do
      mysql do |cli|
        drop_database(cli)
        create_database(cli)
        create_procedure(cli, :my_prcd)
      end

      apply(subject) do
        grantfile
      end
    end

    it do
      expect(subject.export.strip).to eq grantfile.strip
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
gratan-0.3.2 spec/export/export_func_prcd_spec.rb
gratan-0.3.1 spec/export/export_func_prcd_spec.rb
gratan-0.3.1.beta4 spec/export/export_func_prcd_spec.rb
gratan-0.3.1.beta3 spec/export/export_func_prcd_spec.rb
gratan-0.3.1.beta2 spec/export/export_func_prcd_spec.rb
gratan-0.3.1.beta spec/export/export_func_prcd_spec.rb
gratan-0.3.0 spec/export/export_func_prcd_spec.rb
gratan-0.3.0.beta spec/export/export_func_prcd_spec.rb
gratan-0.2.9 spec/export/export_func_prcd_spec.rb
gratan-0.2.9.beta3 spec/export/export_func_prcd_spec.rb
gratan-0.2.9.beta2 spec/export/export_func_prcd_spec.rb
gratan-0.2.9.beta spec/export/export_func_prcd_spec.rb
gratan-0.2.8 spec/export/export_func_prcd_spec.rb