Sha256: af344b9fe259c2c260d87aaf266543b78a97fc45ac02012ba209a69563215e3b

Contents?: true

Size: 1.75 KB

Versions: 9

Compression:

Stored size: 1.75 KB

Contents

require File.dirname(__FILE__) + '/base'
require 'taps/operation'

describe Taps::Operation do
  before do
    @op = Taps::Operation.new('dummy://localhost', 'http://x:y@localhost:5000')
  end

  it 'returns an array of tables that match the regex table_filter' do
    @op = Taps::Operation.new('dummy://localhost', 'http://x:y@localhost:5000', table_filter: 'abc')
    @op.apply_table_filter(%w[abc def]).should == ['abc']
  end

  it 'returns a hash of tables that match the regex table_filter' do
    @op = Taps::Operation.new('dummy://localhost', 'http://x:y@localhost:5000', table_filter: 'abc')
    @op.apply_table_filter('abc' => 1, 'def' => 2).should == { 'abc' => 1 }
  end

  it 'returns an array of tables without the exclude_tables tables' do
    @op = Taps::Operation.new('dummy://localhost', 'http://x:y@localhost:5000', exclude_tables: %w[abc ghi jkl])
    @op.apply_table_filter(%w[abc def ghi jkl mno]).should == %w[def mno]
  end

  it 'returns a hash of tables without the exclude_tables tables' do
    @op = Taps::Operation.new('dummy://localhost', 'http://x:y@localhost:5000', exclude_tables: %w[abc ghi jkl])
    @op.apply_table_filter('abc' => 1, 'def' => 2, 'ghi' => 3, 'jkl' => 4, 'mno' => 5).should == { 'def' => 2, 'mno' => 5 }
  end

  it "masks a url's password" do
    @op.safe_url('mysql://root:password@localhost/mydb').should == 'mysql://root:[hidden]@localhost/mydb'
  end

  it 'returns http headers with compression enabled' do
    @op.http_headers.should == { taps_version: Taps::Version.current, accept_encoding: 'gzip, deflate' }
  end

  it 'returns http headers with compression disabled' do
    @op.stubs(:compression_disabled?).returns(true)
    @op.http_headers.should == { taps_version: Taps::Version.current, accept_encoding: '' }
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
taps2-0.6.10 spec/operation_spec.rb
taps2-0.6.9 spec/operation_spec.rb
taps2-0.6.8 spec/operation_spec.rb
taps2-0.6.7 spec/operation_spec.rb
taps2-0.6.6 spec/operation_spec.rb
taps2-0.6.5 spec/operation_spec.rb
taps2-0.6.4 spec/operation_spec.rb
taps2-0.6.3 spec/operation_spec.rb
taps2-0.6.2 spec/operation_spec.rb