Sha256: 06cf396cbc8ab2af0db7013ab687320bbf9ac86ff75e908fbe2cde35acd960f3

Contents?: true

Size: 1.15 KB

Versions: 25

Compression:

Stored size: 1.15 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
      expect(pos1.respond_to?('>=')).to be_truthy
    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
        expect(pos2 >= pos1).to be_truthy
      end

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

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

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

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
flydata-0.1.15 spec/flydata/fluent-plugins/mysql/binlog_position_spec.rb
flydata-0.1.13 spec/flydata/fluent-plugins/mysql/binlog_position_spec.rb
flydata-0.1.12 spec/flydata/fluent-plugins/mysql/binlog_position_spec.rb
flydata-0.1.11 spec/flydata/fluent-plugins/mysql/binlog_position_spec.rb
flydata-0.1.10 spec/flydata/fluent-plugins/mysql/binlog_position_spec.rb