Sha256: f204aab7e5e47f51bdd38e1e8d10b51b514684aa5e6ab4d12270bcd02faba54b

Contents?: true

Size: 1.61 KB

Versions: 30

Compression:

Stored size: 1.61 KB

Contents

describe 'Gratan::Client#apply' do
  context 'when load group file' do
    subject { client }

    it do
      dsl = <<-RUBY
user 'scott', 'localhost', identified: 'tiger' do
  on '*.*' do
    grant 'SELECT'
    grant 'INSERT'
    grant 'UPDATE'
    grant 'DELETE'
  end

  on 'test.*' do
    grant 'SELECT'
    grant 'INSERT'
    grant 'UPDATE'
    grant 'DELETE'
  end
end
      RUBY

      tempfile(dsl) do |f|
        apply(subject) {
          <<-RUBY
require 'time'
require '#{f.path}'
          RUBY
        }
      end

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

  context 'when load group file (.rb)' do
    subject { client }

    it do
      dsl = <<-RUBY
user 'scott', 'localhost', identified: 'tiger' do
  on '*.*' do
    grant 'SELECT'
    grant 'INSERT'
    grant 'UPDATE'
    grant 'DELETE'
  end

  on 'test.*' do
    grant 'SELECT'
    grant 'INSERT'
    grant 'UPDATE'
    grant 'DELETE'
  end
end
      RUBY

      tempfile(dsl, ext: '.rb') do |f|
        apply(subject) {
          <<-RUBY
require 'time'
require '#{f.path.sub(/\.rb\z/, '')}'
          RUBY
        }
      end

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

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
gratan-0.3.1.beta2 spec/misc/require_spec.rb
gratan-0.3.1.beta spec/misc/require_spec.rb
gratan-0.3.0 spec/misc/require_spec.rb
gratan-0.3.0.beta spec/misc/require_spec.rb
gratan-0.2.9 spec/misc/require_spec.rb
gratan-0.2.9.beta3 spec/misc/require_spec.rb
gratan-0.2.9.beta2 spec/misc/require_spec.rb
gratan-0.2.9.beta spec/misc/require_spec.rb
gratan-0.2.8 spec/misc/require_spec.rb
gratan-0.2.8.beta3 spec/misc/require_spec.rb
gratan-0.2.8.beta2 spec/misc/require_spec.rb
gratan-0.2.8.beta spec/misc/require_spec.rb
gratan-0.2.7 spec/misc/require_spec.rb
gratan-0.2.6 spec/misc/require_spec.rb
gratan-0.2.5 spec/misc/require_spec.rb
gratan-0.2.4 spec/misc/require_spec.rb
gratan-0.2.3 spec/misc/require_spec.rb
gratan-0.2.2 spec/misc/require_spec.rb
gratan-0.2.1 spec/misc/require_spec.rb
gratan-0.2.0 spec/misc/require_spec.rb