Sha256: 3c5abc56d5ff1ed6a0a97ed759e973a565d60c147ff685029a136295d089aa50

Contents?: true

Size: 754 Bytes

Versions: 5

Compression:

Stored size: 754 Bytes

Contents

require 'spec_helper'

class ResponderWithCreated < ::ActionController::Responder
  include Restfulie::Server::ActionController::Trait::Created
end

class CreationController < ApplicationController
  self.responder = ResponderWithCreated
  respond_to :atom

  def create
    @resource = Object.new
    respond_with @resource, :status => :created
  end

end

describe CreationController do
  
  context "creating a resource" do
    
    it "should return 201 with location" do
      request.accept = "application/atom+xml"
      
      uri = "http://newlocation.com/uri"
      
      controller.stub(:url_for).and_return uri

      post :create
      response.code.should == "201"
      response.headers["Location"].should == uri
    end

  end      
end

Version data entries

5 entries across 5 versions & 2 rubygems

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