Sha256: 433f05789396b8d8e8fc86d1b07e0a3accd89590e5b59e2b2185034c0c7986d9

Contents?: true

Size: 1.79 KB

Versions: 21

Compression:

Stored size: 1.79 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(['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 => ['abc', 'ghi', 'jkl'])
    @op.apply_table_filter(['abc', 'def', 'ghi', 'jkl', 'mno']).should == ['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 => ['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, :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, :accept_encoding => "" }
  end

end

Version data entries

21 entries across 21 versions & 5 rubygems

Version Path
taps2-0.5.5 spec/operation_spec.rb
taps2-0.5.4 spec/operation_spec.rb
taps2-0.5.3 spec/operation_spec.rb
taps2-0.5.2 spec/operation_spec.rb
taps2-0.5.1 spec/operation_spec.rb
tinroof-taps-0.3.24 spec/operation_spec.rb
tapsicle-0.4.1 spec/operation_spec.rb
taps-taps-0.3.24 spec/operation_spec.rb
taps-0.3.24 spec/operation_spec.rb
taps-0.3.23 spec/operation_spec.rb
taps-0.3.23.pre1 spec/operation_spec.rb
taps-0.3.22.pre2 spec/operation_spec.rb
taps-0.3.22.pre1 spec/operation_spec.rb
taps-0.3.21 spec/operation_spec.rb
taps-0.3.20 spec/operation_spec.rb
taps-0.3.20.pre2 spec/operation_spec.rb
taps-0.3.20.pre1 spec/operation_spec.rb
taps-0.3.19 spec/operation_spec.rb
taps-0.3.19.pre1 spec/operation_spec.rb
taps-0.3.18 spec/operation_spec.rb