Sha256: 643c046ac90ba495c46d6df133df682b2143f2bddbddae0b38efebdd22b16c93
Contents?: true
Size: 2 KB
Versions: 21
Compression:
Stored size: 2 KB
Contents
require 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 ### auto_commit_if_delete_dirty it 'should automatically commit after each delete if specified' do @configuration.user_configuration = { 'auto_commit_after_request' => false, 'auto_commit_after_delete_request' => true } Sunspot.should_receive(:commit_if_delete_dirty) post :create, :post => { :title => 'Test 1' } end it 'should not automatically commit on delete if configuration is set to false' do @configuration.user_configuration = { 'auto_commit_after_request' => false, 'auto_commit_after_delete_request' => false } Sunspot.should_not_receive(:commit_if_delete_dirty) post :create, :post => { :title => 'Test 1' } end it 'should not automatically commit on delete if configuration is not specified' do @configuration.user_configuration = { 'auto_commit_after_request' => false } Sunspot.should_not_receive(:commit_if_delete_dirty) post :create, :post => { :title => 'Test 1' } end end
Version data entries
21 entries across 21 versions & 5 rubygems