Sha256: 31b99314875fe44c06f413b185e573ca08a0e445fce9795b39b2fa7afe024ab1

Contents?: true

Size: 1.07 KB

Versions: 3

Compression:

Stored size: 1.07 KB

Contents

require 'spec/spec_helper'

describe ThinkingSphinx::Index::FauxColumn do  
  describe "coerce class method" do
    before :each do
      @column = stub('column')
      ThinkingSphinx::Index::FauxColumn.stub!(:new => @column)
    end
    
    it "should return a single faux column if passed a string" do
      ThinkingSphinx::Index::FauxColumn.coerce("string").should == @column
    end
    
    it "should return a single faux column if passed a symbol" do
      ThinkingSphinx::Index::FauxColumn.coerce(:string).should == @column
    end
    
    it "should return an array of faux columns if passed an array of strings" do
      ThinkingSphinx::Index::FauxColumn.coerce(["one", "two"]).should == [
        @column, @column
      ]
    end
    
    it "should return an array of faux columns if passed an array of symbols" do
      ThinkingSphinx::Index::FauxColumn.coerce([:one, :two]).should == [
        @column, @column
      ]
    end
  end
  
  describe '#to_ary' do
    it "should return an array with the instance inside it" do
      subject.to_ary.should == [subject]
    end
  end
end

Version data entries

3 entries across 3 versions & 3 rubygems

Version Path
joshcutler-thinking-sphinx-1.3.18 spec/thinking_sphinx/index/faux_column_spec.rb
josh_cutler-thinking-sphinx-1.3.17 spec/thinking_sphinx/index/faux_column_spec.rb
thinking-sphinx-1.3.17 spec/thinking_sphinx/index/faux_column_spec.rb