Sha256: 010a48644a8ace3c2e9afec2c584fa98cee9609e87c5a8517f75da129022ee94

Contents?: true

Size: 1021 Bytes

Versions: 13

Compression:

Stored size: 1021 Bytes

Contents

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

describe 'request lifecycle', :type => :controller do
  before(:each) do
    Sunspot::Rails.configuration = @configuration = Sunspot::Rails::Configuration.new
  end

  after(:each) do
    Sunspot::Rails.configuration = nil
  end
  controller_name :posts

  it 'should automatically commit after each action if specified' do
    @configuration.user_configuration = { 'auto_commit_after_request' => true }
    Sunspot.should_receive(:commit_if_dirty)
    post :create, :post => { :title => 'Test 1' }
  end
  
  it 'should not commit, if configuration is set to false' do
    @configuration.user_configuration = { 'auto_commit_after_request' => false }
    Sunspot.should_not_receive(:commit_if_dirty)
    post :create, :post => { :title => 'Test 1' }
  end

  it 'should commit if configuration is not specified' do
    @configuration.user_configuration = {}
    Sunspot.should_receive(:commit_if_dirty)
    post :create, :post => { :title => 'Test 1' }
  end
end

Version data entries

13 entries across 13 versions & 7 rubygems

Version Path
benjaminkrause-sunspot_rails-0.10.5 spec/request_lifecycle_spec.rb
collectiveidea-sunspot_rails-0.10.5 spec/request_lifecycle_spec.rb
collectiveidea-sunspot_rails-0.10.6 spec/request_lifecycle_spec.rb
kristopher-sunspot_rails-0.10.6 spec/request_lifecycle_spec.rb
outoftime-sunspot_rails-0.10.5 spec/request_lifecycle_spec.rb
ssoroka-sunspot_rails-0.10.5 spec/request_lifecycle_spec.rb
ssoroka-sunspot_rails-0.10.6 spec/request_lifecycle_spec.rb
goldstar-sunspot_rails-0.10.6.3 spec/request_lifecycle_spec.rb
goldstar-sunspot_rails-0.10.6.1 spec/request_lifecycle_spec.rb
sunspot_rails-0.10.9 spec/request_lifecycle_spec.rb
sunspot_rails-0.10.8 spec/request_lifecycle_spec.rb
sunspot_rails-0.10.7 spec/request_lifecycle_spec.rb
sunspot_rails-0.10.5 spec/request_lifecycle_spec.rb