Sha256: fbb29e6e37253b2519f2a66321d52b6943defa1e7e7cf47bf2eb3241a4ff80d8

Contents?: true

Size: 1002 Bytes

Versions: 5

Compression:

Stored size: 1002 Bytes

Contents

require 'spec_helper'
require "action_controller"

describe RenderController do
  
  before(:each) do
    @object = Object.new
    @controller.stub!(:object).and_return(@object)
  end
  
  it "renders show action with application/atom+xml" do
    get :show, :id => 1
    @response.content_type.should == "application/atom+xml"
  end
  
  it "renders index action with application/atom+xml" do
    get :index
    @response.content_type.should == "application/atom+xml"
  end
  
  it "calls to_atom in show's object if object respond_to :to_atom" do
    @atom = Object.new
    @object.should_receive(:to_atom).once.and_return(@atom)
    @atom.should_receive(:to_xml).once
    get :show_with_mock, :id => 1
    @response.content_type.should == "application/atom+xml"
  end

  it "calls to_xml in show's object if object does not respond_to :to_atom" do
    @object.should_receive(:to_xml).once
    get :show_with_mock, :id => 1
    @response.content_type.should == "application/atom+xml"    
  end
  
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
restfulie-nosqlite-1.0.4 tests/spec/controllers/integration/controller_base_spec.rb
restfulie-1.1.1 tests/spec/controllers/integration/controller_base_spec.rb
restfulie-1.1.0 tests/spec/controllers/integration/controller_base_spec.rb
restfulie-nosqlite-1.0.3 tests/spec/controllers/integration/controller_base_spec.rb
restfulie-1.0.3 tests/spec/controllers/integration/controller_base_spec.rb