Sha256: 65743dafc4eda1761c8671b83c23c3b7e1e5591a9bc4d20e72681ab56d9fd053

Contents?: true

Size: 1.22 KB

Versions: 13

Compression:

Stored size: 1.22 KB

Contents

describe 'Gratan::Client#apply' do
  context 'when create user with function' do
    subject { client }

    it do
      create_functions(:foo) do
        result = apply(subject) {
          <<-RUBY
  user 'scott', 'localhost' do
    on '*.*' do
      grant 'USAGE'
    end

    on 'FUNCTION #{TEST_DATABASE}.foo' do
      grant 'EXECUTE'
    end
  end
          RUBY
        }

        expect(result).to be_truthy

        expect(show_grants).to match_array [
          "GRANT USAGE ON *.* TO 'scott'@'localhost'",
          "GRANT EXECUTE ON FUNCTION `#{TEST_DATABASE}`.`foo` TO 'scott'@'localhost'"
        ]
      end
    end
  end

  context 'when create user with procedure' do
    subject { client }

    it do
      create_procedures(:foo) do
        result = apply(subject) {
          <<-RUBY
  user 'scott', 'localhost' do
    on '*.*' do
      grant 'USAGE'
    end

    on 'PROCEDURE #{TEST_DATABASE}.foo' do
      grant 'EXECUTE'
    end
  end
          RUBY
        }

        expect(result).to be_truthy

        expect(show_grants).to match_array [
          "GRANT USAGE ON *.* TO 'scott'@'localhost'",
          "GRANT EXECUTE ON PROCEDURE `#{TEST_DATABASE}`.`foo` TO 'scott'@'localhost'"
        ]
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

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