Sha256: a24fdb397ee7b305b920d134d5a1a26aaf86c0603aea6bb2268c84cb1e8bcba7
Contents?: true
Size: 1.5 KB
Versions: 14
Compression:
Stored size: 1.5 KB
Contents
# frozen_string_literal: true require 'spec_helper' RSpec.describe ThinkingSphinx::Commands::ClearRealTime do let(:command) { ThinkingSphinx::Commands::ClearRealTime.new( configuration, {:indices => [users_index, parts_index]}, stream ) } let(:configuration) { double 'configuration', :searchd => double(:binlog_path => '/path/to/binlog') } let(:stream) { double :puts => nil } let(:users_index) { double :path => '/path/to/my/index/users', :render => true } let(:parts_index) { double :path => '/path/to/my/index/parts', :render => true } before :each do allow(Dir).to receive(:[]).with('/path/to/my/index/users.*'). and_return(['users.a', 'users.b']) allow(Dir).to receive(:[]).with('/path/to/my/index/parts.*'). and_return(['parts.a', 'parts.b']) allow(FileUtils).to receive_messages :rm_r => true, :rm => true allow(File).to receive_messages :exists? => true end it 'finds each file for real-time indices' do expect(Dir).to receive(:[]).with('/path/to/my/index/users.*'). and_return([]) command.call end it "removes the directory for the binlog files" do expect(FileUtils).to receive(:rm_r).with('/path/to/binlog') command.call end it "removes each file for real-time indices" do expect(FileUtils).to receive(:rm).with('users.a') expect(FileUtils).to receive(:rm).with('users.b') expect(FileUtils).to receive(:rm).with('parts.a') expect(FileUtils).to receive(:rm).with('parts.b') command.call end end
Version data entries
14 entries across 14 versions & 1 rubygems