Sha256: eea0758c1bd41861747e6f6a8567a4ec6fd054dbf3663911069d95936fbe09a3

Contents?: true

Size: 1.46 KB

Versions: 4

Compression:

Stored size: 1.46 KB

Contents

# require File.dirname(__FILE__) + '/../spec_helper'
require 'spec_helper'

describe "ConcurrentDraft::Tags" do
  dataset :pages
  describe '<r:content>' do
    before :each do
      @page = pages(:home)
      @page.part(:body).update_attribute('draft_content', 'Draft body.')
    end
  
    it "should render the published content on the live site" do
      @page.should render('<r:content />').as("Hello world!")
    end
  
    it "should render the draft content on the dev site" do
      @page.should render('<r:content />').as("Draft body.").on('dev.host')
    end
  end
  
  if defined?(SnippetsExtension)
    describe "<r:snippet>" do
      dataset :snippets
      before :each do
        @snippet = snippets(:first)
        @snippet.update_attribute(:draft_content, 'Draft content.')
        @page = pages(:home)
      end

      it "should render published snippet content on the live site" do
        @page.should render('<r:snippet name="first" />').as('test')
      end

      it "should render draft snippet content on the dev site" do
        @page.should render('<r:snippet name="first" />').as('Draft content.').on('dev.host')
      end
    
      it "should promote the draft body if it is scheduled" do
        @snippet.update_attribute(:draft_promotion_scheduled_at, 1.second.from_now)
        sleep 2
        @page.should render('<r:snippet name="first" />').as('Draft content.')
        @snippet.reload
        @snippet.should be_has_draft_promoted
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
radiant-concurrent_draft-extension-1.0.11 spec/models/tags_spec.rb
radiant-concurrent_draft-extension-1.0.10 spec/models/tags_spec.rb
radiant-concurrent_draft-extension-1.0.9 spec/models/tags_spec.rb
radiant-concurrent_draft-extension-1.0.8 spec/models/tags_spec.rb