Created
July 12, 2011 09:59
-
-
Save seivan/1077713 to your computer and use it in GitHub Desktop.
This file contains 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 characters
def respond_with_error(message = "Unauthorized User", error_code = :unauthorized) | |
Rails.logger.info "RESPONDING WITH ERROR #{message} and #{params}" | |
@data = {:error=> {:message => message, | |
:params => params}, | |
:status => error_code } | |
respond_with @data, :status => @data[:status], :location => nil | |
#render :json => @data, :status => @data[:status], :location => nil | |
end | |
context "with invalid user parameter for existing user" do | |
let(:user_params) { invalid_user_params } | |
it { assigns(:current_user).should be_nil } | |
it { assigns(:data)[:error].should_not be_empty} | |
it {puts subject.inspect } | |
it { subject["error"].should_not be_empty } | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment