Skip to content

Instantly share code, notes, and snippets.

@gaahrdner
Created March 5, 2012 23:37
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 gaahrdner/1982093 to your computer and use it in GitHub Desktop.
Save gaahrdner/1982093 to your computer and use it in GitHub Desktop.
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment