Skip to content

Instantly share code, notes, and snippets.

@nando
Last active November 6, 2016 20:24
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 nando/a019804d328a4b6e3fae20e83672f0e4 to your computer and use it in GitHub Desktop.
Save nando/a019804d328a4b6e3fae20e83672f0e4 to your computer and use it in GitHub Desktop.
require "rails_helper"
RSpec.describe Api::ExternalServicesController, type: :controller do
fixtures :wilson_cms_admin_users,
:wilson_cms_roles,
:wilson_cms_admin_user_roles
let(:metadmin) { wilson_cms_admin_users(:metadmin) }
context "GET /api/validate_bin" do
it "requires authentication" do
get :validate_bin, format: :json
expect(response).to be_unauthorized
end
it "requires the *card_code* param" do
authenticate_request(metadmin.email, metadmin.api_pass)
get :validate_bin, format: :json
expect(response).to be_bad_request
end
end
context "GET /api/check_service_step" do
it "requires authentication" do
get :check_service_step, format: :json
expect(response).to be_unauthorized
end
it "requires the *message_id* param" do
authenticate_request(metadmin.email, metadmin.api_pass)
get :check_service_step, format: :json
expect(response).to be_bad_request
end
end
context "POST /api/send_offer_mail" do
it "requires authentication" do
post :send_offer_mail, format: :json
expect(response).to be_unauthorized
end
it "requires the *send_offer_mail* params" do
authenticate_request(metadmin.email, metadmin.api_pass)
get :send_offer_mail, format: :json
expect(response).to be_bad_request
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment