Sha256: 456669b8faf35dcfa9f79f96a6504fceccfe21dfa2fc92b996f600f5090d8067

Contents?: true

Size: 1.03 KB

Versions: 2

Compression:

Stored size: 1.03 KB

Contents

require 'spec_helper'

module Tim
  describe "/tim/provider_images/_provider_image" do
    before(:each) do
      Tim::TargetImage.any_instance
        .stub(:create_factory_target_image)
      Tim::TargetImage.any_instance.stub(:template)
        .and_return FactoryGirl.build(:template)
      Tim::TargetImage.any_instance.stub(:imported?).and_return(false)

      view.stub(:provider_image).and_return FactoryGirl.build(:provider_image)
      [:provider_image_url, :target_image_url].each do |method|
        view.stub(method)
      end
    end

    it "should render custom content partial when it is defined" do
      render
      view.should render_template(:partial => "_custom", :count => 1)
      Hash.from_xml(rendered)["provider_image"].keys.include?("custom_content")
        .should == true
    end

    it "should not fail to render when a content partial is not defined" do
      view.controller.stub(:template_exists?).and_return false
      render
      view.should render_template(:partial => "_custom", :count => 0)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tim-0.3.0 spec/views/provider_images_spec.rb
tim-0.2.0 spec/views/provider_images_spec.rb