forked from ricardochimal/taps
-
Notifications
You must be signed in to change notification settings - Fork 1
/
operation_spec.rb
32 lines (25 loc) · 1.18 KB
/
operation_spec.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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 "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.compatible_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.compatible_version, :accept_encoding => "" }
end
end