Sha256: cff128dbef576c92f6d1320a5d713ce0e8b5ce2b9dc713c799176900b8da91cf

Contents?: true

Size: 1.13 KB

Versions: 2

Compression:

Stored size: 1.13 KB

Contents

require_relative '../../../spec_helper'

module Mysql
  describe BinLogPosition do
    let(:pos1) { BinLogPosition.new('mysql-bin.000064	107') }
    let(:pos2) { BinLogPosition.new('mysql-bin.000064	978') }
    let(:pos3) { BinLogPosition.new('mysql-bin.000065	107') }
    let(:pos4) { BinLogPosition.new('mysql-bin.000064	1107') }
    let(:pos5) { BinLogPosition.new('mysql-bin.000064	1107') }

    it 'should respond to greater than or equal to operator' do
      pos1.respond_to?('>=').should be_true
    end

    context 'when testing greater than or equal to operator' do
      it 'should return true when it is compared with another object with smaller position value' do
        (pos2 >= pos1).should be_true
      end

      it 'should return false when it is compared with another object with bigger binlogfile value' do
        (pos2 >= pos3).should be_false
      end 

      it 'should compare the position as an integer (and not string)' do
        (pos2 >= pos4).should be_false
      end

      it 'should return true when it is compared with another object with equal value' do
        (pos4 >= pos5).should be_true
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
flydata-0.1.9 spec/flydata/fluent-plugins/mysql/binlog_position_spec.rb
flydata-0.1.8 spec/flydata/fluent-plugins/mysql/binlog_position_spec.rb