Sha256: 42a442a7640969f04d905378912cb70a3359821cba6f49d315ecce910e09569c

Contents?: true

Size: 928 Bytes

Versions: 8

Compression:

Stored size: 928 Bytes

Contents

require 'spec_helper'

describe ThinkingSphinx::ActiveRecord::Field do
  let(:field)        { ThinkingSphinx::ActiveRecord::Field.new model, column }
  let(:column)       { double('column', :__name => :title, :__stack => [],
    :string? => false) }
  let(:model)        { double('model') }

  before :each do
    column.stub! :to_a => [column]
  end

  describe '#file?' do
    it "defaults to false" do
      field.should_not be_file
    end

    it "is true if file option is set" do
      field = ThinkingSphinx::ActiveRecord::Field.new model, column,
        :file => true
      field.should be_file
    end
  end

  describe '#with_attribute?' do
    it "defaults to false" do
      field.should_not be_with_attribute
    end

    it "is true if the field is sortable" do
      field = ThinkingSphinx::ActiveRecord::Field.new model, column,
        :sortable => true
      field.should be_with_attribute
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
thinking-sphinx-3.0.5 spec/thinking_sphinx/active_record/field_spec.rb
thinking-sphinx-3.0.4 spec/thinking_sphinx/active_record/field_spec.rb
thinking-sphinx-3.0.3 spec/thinking_sphinx/active_record/field_spec.rb
thinking-sphinx-3.0.2 spec/thinking_sphinx/active_record/field_spec.rb
thinking-sphinx-3.0.1 spec/thinking_sphinx/active_record/field_spec.rb
thinking-sphinx-3.0.0 spec/thinking_sphinx/active_record/field_spec.rb
thinking-sphinx-3.0.0.rc spec/thinking_sphinx/active_record/field_spec.rb
thinking-sphinx-3.0.0.pre spec/thinking_sphinx/active_record/field_spec.rb