spec/unit/thinking_sphinx/attribute_spec.rb in dpickett-thinking-sphinx-1.1.4 vs spec/unit/thinking_sphinx/attribute_spec.rb in dpickett-thinking-sphinx-1.1.12

- old
+ new

@@ -155,11 +155,11 @@ @attribute.stub_method(:is_many? => true) @attribute.send(:type).should == :multi end it "should return :string if there's more than one association" do - @attribute.associations = {:a => :assoc, :b => :assoc} + @attribute.associations = {:a => [:assoc], :b => [:assoc]} @attribute.send(:type).should == :string end it "should return the column type from the database if not :multi or more than one association" do @column.send(:instance_variable_set, :@name, "birthday") @@ -205,8 +205,23 @@ ) attribute.model = Person attribute.columns.each { |col| attribute.associations[col] = [] } attribute.send(:all_ints?).should be_false + end + end + + describe "with custom queries" do + before :each do + index = CricketTeam.sphinx_indexes.first + @statement = index.to_riddle_for_core(0, 0).sql_attr_multi.first + end + + it "should track the query type accordingly" do + @statement.should match(/uint tags from query/) + end + + it "should include the SQL statement" do + @statement.should match(/SELECT cricket_team_id, id FROM tags/) end end end \ No newline at end of file