Sha256: 3d6f3395d7a2c362b17f53990749c102cca3914039a20aaee66af0fcf845343b

Contents?: true

Size: 1.03 KB

Versions: 34

Compression:

Stored size: 1.03 KB

Contents

describe 'Gratan::Client#apply' do
  before(:each) do
    apply {
      <<-RUBY
user 'scott', 'localhost', identified: 'tiger', required: 'SSL' do
  on '*.*' do
    grant 'SELECT'
    grant 'INSERT'
  end

  on 'test.*' do
    grant 'UPDATE'
    grant 'DELETE'
  end

  on 'mysql.user' do
    grant 'SELECT (user)'
  end
end

user 'bob', 'localhost' do
  on '*.*' do
    grant 'USAGE'
  end

  on 'test.*' do
    grant 'ALL PRIVILEGES'
  end
end
      RUBY
    }
  end

  context 'when drop user' do
    subject { client }

    it do
      apply(subject) {
        <<-RUBY
user 'bob', 'localhost' do
  on '*.*' do
    grant 'USAGE'
  end

  on 'test.*' do
    grant 'ALL PRIVILEGES'
  end
end
        RUBY
      }

      expect(show_grants).to match_array [
        "GRANT ALL PRIVILEGES ON `test`.* TO 'bob'@'localhost'",
        "GRANT USAGE ON *.* TO 'bob'@'localhost'",
      ]
    end
  end

  context 'when drop all users' do
    subject { client }

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

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
gratan-0.3.2 spec/drop/drop_user_spec.rb
gratan-0.3.1 spec/drop/drop_user_spec.rb
gratan-0.3.1.beta4 spec/drop/drop_user_spec.rb
gratan-0.3.1.beta3 spec/drop/drop_user_spec.rb
gratan-0.3.1.beta2 spec/drop/drop_user_spec.rb
gratan-0.3.1.beta spec/drop/drop_user_spec.rb
gratan-0.3.0 spec/drop/drop_user_spec.rb
gratan-0.3.0.beta spec/drop/drop_user_spec.rb
gratan-0.2.9 spec/drop/drop_user_spec.rb
gratan-0.2.9.beta3 spec/drop/drop_user_spec.rb
gratan-0.2.9.beta2 spec/drop/drop_user_spec.rb
gratan-0.2.9.beta spec/drop/drop_user_spec.rb
gratan-0.2.8 spec/drop/drop_user_spec.rb
gratan-0.2.8.beta3 spec/drop/drop_user_spec.rb
gratan-0.2.8.beta2 spec/drop/drop_user_spec.rb
gratan-0.2.8.beta spec/drop/drop_user_spec.rb
gratan-0.2.7 spec/drop/drop_user_spec.rb
gratan-0.2.6 spec/drop/drop_user_spec.rb
gratan-0.2.5 spec/drop/drop_user_spec.rb
gratan-0.2.4 spec/drop/drop_user_spec.rb