Sha256: b9d9b284cf1e930e536aa61ec18f2d293fa3a43186dd1d360554fa381db93f55

Contents?: true

Size: 1.11 KB

Versions: 4

Compression:

Stored size: 1.11 KB

Contents

require File.dirname(__FILE__) + '/../spec_helper'
require 'site_controller'
SiteController.module_eval { def rescue_action(e); raise e; end }

describe SiteController, "(Extended) - concurrent draft changes" do
  dataset :users_and_pages
  
  before :each do
    @page = mock_model(Page, :published? => false, :draft_should_be_promoted? => true, :process => nil, :update_attribute => nil)
    Page.stub!(:find_by_url).and_return(@page)
  end

  it "should include the extension module" do
    SiteController.included_modules.should include(ConcurrentDraft::SiteControllerExtensions)
  end

  it "should add the before filter" do
    SiteController.before_filters.should be_any {|f| f == :publish_if_scheduled }
  end
  
  it "should run the before filter" do
    self.controller.should_receive(:publish_if_scheduled)
    get :show_page, :url => '/'
  end

  it "should set the status to published if the draft should be promoted" do
    Page.should_receive(:find_by_url).at_least(:once).and_return(@page)
    @page.should_receive(:update_attribute).with('status_id', Status[:published].id)
    get :show_page, :url => '/'
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
radiant-concurrent_draft-extension-1.0.3 spec/controllers/site_controller_extensions_spec.rb
radiant-concurrent_draft-extension-1.0.2 spec/controllers/site_controller_extensions_spec.rb
radiant-concurrent_draft-extension-1.0.1 spec/controllers/site_controller_extensions_spec.rb
radiant-concurrent_draft-extension-1.0.0 spec/controllers/site_controller_extensions_spec.rb