Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jonathanclarke/260349 to your computer and use it in GitHub Desktop.
Save jonathanclarke/260349 to your computer and use it in GitHub Desktop.
describe UsersController do
describe "handling GET /users.xml" do
before(:each) do
@users = mock("Array of Users", :to_xml => "XML")
User.stub!(:find).and_return(@users)
end
def do_get
@request.env["HTTP_ACCEPT"] = "application/xml"
get :index
end
it "should render the found users as xml" do
@users.should_receive(:to_xml).and_return("XML")
do_get
response.body.should == "XML"
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment