Created
March 5, 2012 23:37
Revisions
-
gaahrdner created this gist
Mar 5, 2012 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,35 @@ describe ApplicationsController do render_views disconnect_sunspot let(:application) { Factory.create(:application) } subject { application } context "JSON" do describe "creating a new application" do context "when not authorized" do before do # how do i set the content type here to JSON or XML ? post :create, :format => :json, { :application => { :name => "balls", :description => "balls" } } end it "should not allow creation of an application" do Application.count.should == 0 end it "should respond with a 401" do response.status.should eq(401) end it "should have a status and message key in the hash" do JSON.parse(response.body)["status"] == "errors" JSON.parse(response.body)["message"] =~ /authorized/ end end context "authorized" do end end