Skip to content

Commit

Permalink
Fix index registration test
Browse files Browse the repository at this point in the history
  • Loading branch information
eddloschi committed Dec 7, 2013
1 parent 8278fc9 commit 8424e29
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions spec/mongoid/giza/configuration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@

let(:length) { double("length") }

let(:static) { double("static") }

let(:generated) { double("generated") }

before do
allow(@config).to receive(:indices) { indices }
allow(@config).to receive(:create_index) { riddle_index }
Expand All @@ -90,13 +94,15 @@
end

it "should register a static index on the static indexes hash" do
expect(@config).to receive(:register_index).with(riddle_index, @config.instance_variable_get("@static_indexes"))
@config.instance_variable_set("@static_indexes", static)
expect(@config).to receive(:register_index).with(riddle_index, static)
@config.add_index(index)
end

it "should register a generated index on the generated indexes hash" do
expect(@config).to receive(:register_index).with(riddle_index, @config.instance_variable_get("@generated_indexes"))
@config.add_index(index)
@config.instance_variable_set("@generated_indexes", generated)
expect(@config).to receive(:register_index).with(riddle_index, generated)
@config.add_index(index, true)
end
end

Expand Down

0 comments on commit 8424e29

Please sign in to comment.