Sha256: 62e755d72ca4de5494b93b4e3ed034e2e1ecb2b67ba7f65f8f281ac7ffa12f3f

Contents?: true

Size: 1.66 KB

Versions: 4

Compression:

Stored size: 1.66 KB

Contents

describe 'Gratan::Client#apply' do
  context 'when user does not exist' do
    subject { client }

    it do
      result = apply(subject) { '' }
      expect(result).to be_falsey
      expect(show_grants).to match_array []
    end
  end

  context 'when create user with ignore_object' do
    subject { client(ignore_object: /test/) }

    it do
      result = apply(subject) {
        <<-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
      }

      expect(result).to be_truthy

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

  context 'when create user with ignore_object (2)' do
    subject { client(ignore_object: /test2/) }

    it do
      result = apply(subject) {
        <<-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
      }

      expect(result).to be_truthy

      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'",
      ].normalize
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
gratan-0.3.2 spec/create/create_user_with_ignore_object_spec.rb
gratan-0.3.1 spec/create/create_user_with_ignore_object_spec.rb
gratan-0.3.1.beta4 spec/create/create_user_with_ignore_object_spec.rb
gratan-0.3.1.beta3 spec/create/create_user_with_ignore_object_spec.rb