Sha256: e8d0206752776b12ef557c0f6bf9d89701c896ec8022452a9561fa26ae37eaaa

Contents?: true

Size: 981 Bytes

Versions: 3

Compression:

Stored size: 981 Bytes

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)

      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

3 entries across 3 versions & 1 rubygems

Version Path
tim-0.1.2 spec/views/provider_images_spec.rb
tim-0.1.1 spec/views/provider_images_spec.rb
tim-0.0.1 spec/views/provider_images_spec.rb