spec/thinking_sphinx/source_spec.rb in warp-thinking-sphinx-1.3.11 vs spec/thinking_sphinx/source_spec.rb in warp-thinking-sphinx-1.3.13
- old
+ new
@@ -4,10 +4,17 @@
before :each do
@index = ThinkingSphinx::Index.new(Person)
@source = ThinkingSphinx::Source.new(@index, :sql_range_step => 1000)
end
+ describe '#initialize' do
+ it "should store the current connection details" do
+ config = Person.connection.instance_variable_get(:@config)
+ @source.database_configuration.should == config
+ end
+ end
+
it "should generate the name from the model" do
@source.name.should == "person"
end
it "should handle namespaced models for name generation" do
@@ -75,9 +82,10 @@
it "should use a default username of root if nothing else is provided" do
Person.connection.stub!(:instance_variable_get => {
:user => nil,
:username => nil
})
+ @source = ThinkingSphinx::Source.new(@index)
riddle = @source.to_riddle_for_core(1, 0)
riddle.sql_user.should == 'root'
end