Sha256: e6d1ee7080a5f29711c2be22a481823e84f7d03c718a42bf7a432e92ef646d99
Contents?: true
Size: 1.4 KB
Versions: 5
Compression:
Stored size: 1.4 KB
Contents
require 'spec_helper' describe Restfulie::Server::ActionController::Trait::Created do context "using a Trait::Created responder" do module ToFormatReceiver attr_accessor :received def to_format @received = true end end it "should superize if its not a created result" do responder = Object.new responder.extend ToFormatReceiver responder.extend Restfulie::Server::ActionController::Trait::Created responder.stub(:options).and_return({:status => 300}) responder.to_format responder.received.should be_true end it "should head if the response is created" do should_head_with(:created) end it "should head if the response is created" do should_head_with(201) end class MySong end def should_head_with(what) uri = "custom_uri" resource = MySong.new controller = Object.new controller.should_receive(:url_for).with(resource).and_return(uri) responder = Object.new responder.extend Restfulie::Server::ActionController::Trait::Created responder.stub(:resource).and_return(resource) responder.stub(:options).and_return({:status => what}) responder.should_receive(:controller).and_return(controller) responder.should_receive(:render).with(:status => 201, :location => uri, :text => "") responder.to_format end end end
Version data entries
5 entries across 5 versions & 2 rubygems