Sha256: a674daaed61a7c960ce91fdeda84ef7aa019773d27b4acae71f0721de494132e

Contents?: true

Size: 887 Bytes

Versions: 4

Compression:

Stored size: 887 Bytes

Contents

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

    it do
      result = apply(subject) {
        <<-RUBY
template 'all db template' do
  on '*.*' do
    grant 'SELECT'
  end
end

template 'test db template' do
  grant context.default

  context.extra.each do |priv|
    grant priv
  end
end

user 'scott', 'localhost', identified: 'tiger' do
  include_template 'all db template'

  on 'test.*' do
    context.default = 'SELECT'
    include_template 'test db template', extra: ['INSERT', 'UPDATE']
  end
end
        RUBY
      }

      expect(result).to be_truthy

      expect(show_grants).to match_array [
        "GRANT SELECT ON *.* TO 'scott'@'localhost' IDENTIFIED BY PASSWORD '*F2F68D0BB27A773C1D944270E5FAFED515A3FA40'",
        "GRANT SELECT, INSERT, UPDATE ON `test`.* TO 'scott'@'localhost'",
      ]
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
gratan-0.3.1.beta2 spec/create/create_user_with_template_spec.rb
gratan-0.3.1.beta spec/create/create_user_with_template_spec.rb
gratan-0.3.0 spec/create/create_user_with_template_spec.rb
gratan-0.3.0.beta spec/create/create_user_with_template_spec.rb