Skip to content

Instantly share code, notes, and snippets.

@petrblaho
Created August 8, 2012 16:05
Show Gist options
  • Save petrblaho/3296229 to your computer and use it in GitHub Desktop.
Save petrblaho/3296229 to your computer and use it in GitHub Desktop.
saved in spec/requests/api/
require 'spec_helper'
describe "ProviderAccounts" do
let(:headers) { {
'HTTP_ACCEPT' => 'application/xml',
'CONTENT_TYPE' => 'application/xml'
} }
before(:each) do
user = FactoryGirl.create(:admin_permission).user
login_as(user)
end
describe "POST /api/providers/:provider_id/provider_accounts" do
before(:each) do
post "/api/providers/#{provider.id}/provider_accounts", xml, headers
end
context "with valid mock provider account XML" do
let(:xml) { "<provider_account><label>mockaccount</label><credentials><username>mockuser</username><password>mockpassword</password></credentials></provider_account>" }
let(:provider) { FactoryGirl.create(:mock_provider) }
it_behaves_like "http Created"
context "response" do
subject { response }
it { should have_content_type("application/xml") }
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment