Sha256: 1c3e31bccf13a47716bd36f044bdbeb06c25336fef5a2273b96a8659008a8185

Contents?: true

Size: 866 Bytes

Versions: 30

Compression:

Stored size: 866 Bytes

Contents

require File.join(File.dirname(__FILE__), 'spec_helper')

describe 'searchable with lifecycle' do
  describe 'on create' do
    before :each do
      @post = PostWithAuto.create
      Sunspot.commit
    end

    it 'should automatically index' do
      PostWithAuto.search.results.should == [@post]
    end
  end

  describe 'on update' do
    before :each do
      @post = PostWithAuto.create
      @post.update_attributes(:title => 'Test 1')
      Sunspot.commit
    end

    it 'should automatically update index' do
      PostWithAuto.search { with :title, 'Test 1' }.results.should == [@post]
    end
  end

  describe 'on destroy' do
    before :each do
      @post = PostWithAuto.create
      @post.destroy
      Sunspot.commit
    end

    it 'should automatically remove it from the index' do
      PostWithAuto.search_ids.should be_empty
    end
  end
end

Version data entries

30 entries across 30 versions & 10 rubygems

Version Path
adamsalter-sunspot_rails-0.10.4 spec/model_lifecycle_spec.rb
bsy-sunspot_rails-0.10.4 spec/model_lifecycle_spec.rb
collectiveidea-sunspot_rails-0.10.5 spec/model_lifecycle_spec.rb
collectiveidea-sunspot_rails-0.10.6 spec/model_lifecycle_spec.rb
kristopher-sunspot_rails-0.10.6 spec/model_lifecycle_spec.rb
kuahyeow-sunspot_rails-0.10.5 spec/model_lifecycle_spec.rb
outoftime-sunspot_rails-0.10.0 spec/model_lifecycle_spec.rb
outoftime-sunspot_rails-0.10.1 spec/model_lifecycle_spec.rb
outoftime-sunspot_rails-0.10.2 spec/model_lifecycle_spec.rb
outoftime-sunspot_rails-0.10.3 spec/model_lifecycle_spec.rb
outoftime-sunspot_rails-0.10.4 spec/model_lifecycle_spec.rb
outoftime-sunspot_rails-0.10.5 spec/model_lifecycle_spec.rb
outoftime-sunspot_rails-0.9.10 spec/model_lifecycle_spec.rb
outoftime-sunspot_rails-0.9.11 spec/model_lifecycle_spec.rb
outoftime-sunspot_rails-0.9.12 spec/model_lifecycle_spec.rb
outoftime-sunspot_rails-0.9.4 spec/model_lifecycle_spec.rb
outoftime-sunspot_rails-0.9.6 spec/model_lifecycle_spec.rb
outoftime-sunspot_rails-0.9.7 spec/model_lifecycle_spec.rb
outoftime-sunspot_rails-0.9.8 spec/model_lifecycle_spec.rb
outoftime-sunspot_rails-0.9.9 spec/model_lifecycle_spec.rb