spec/moip2/client_spec.rb in moip2-1.0.0 vs spec/moip2/client_spec.rb in moip2-1.1.0

- old
+ new

@@ -15,107 +15,44 @@ it { expect(client.env).to eq :sandbox } end describe "initialize on sandbox with OAuth" do let(:client) do - described_class.new :sandbox, auth + described_class.new :sandbox, oauth end - let(:client) { described_class.new :sandbox, oauth } - it { expect(client.uri).to eq ENV["sandbox_url"] } + it { expect(client.uri).to eq "https://sandbox.moip.com.br" } it { expect(client.env).to eq :sandbox } - it { - expect(client.opts[:headers]["Authorization"]).to eq "OAuth 9fdc242631454d4c95d82e27b4127394_v2" - } + it do + expect(client.opts[:headers]["Authorization"]). + to eq "OAuth 9fdc242631454d4c95d82e27b4127394_v2" + end end - describe "initialize on production" do + describe "initialize on production with OAuth" do let(:client) do described_class.new :production, oauth end it { expect(client.uri).to eq "https://api.moip.com.br" } it { expect(client.env).to eq :production } - it { - expect(client.opts[:headers]["Authorization"]).to eq "OAuth 9fdc242631454d4c95d82e27b4127394_v2" - } - end - - describe "initialize on sandbox with base_uri and OAuth" do - before do - ENV["base_uri"] = "http://localhost:5000" + it do + expect(client.opts[:headers]["Authorization"]). + to eq "OAuth 9fdc242631454d4c95d82e27b4127394_v2" end - - let(:client) do - described_class.new :sandbox, oauth - end - - it { expect(client.uri).to eq "http://localhost:5000" } - it { expect(client.env).to eq :sandbox } - it { - expect(client.opts[:headers]["Authorization"]).to eq "OAuth 9fdc242631454d4c95d82e27b4127394_v2" - } end - describe "initialize on production with base_uri and OAuth" do - before do - ENV["base_uri"] = "http://localhost:5000" - end - + describe "initialize on sandbox with Basic authentication" do let(:client) do - described_class.new :production, oauth - end - - it { expect(client.uri).to eq "http://localhost:5000" } - it { expect(client.env).to eq :production } - it { - expect(client.opts[:headers]["Authorization"]).to eq "OAuth 9fdc242631454d4c95d82e27b4127394_v2" - } - end - - describe "initialize on sandbox with base_uri" do - before do - ENV["base_uri"] = "http://localhost:5000" - end - - let(:client) do described_class.new :sandbox, auth end - it { expect(client.uri).to eq "http://localhost:5000" } + it { expect(client.uri).to eq "https://sandbox.moip.com.br" } it { expect(client.env).to eq :sandbox } it { expect(client.opts[:headers]["Authorization"]).to eq "Basic VE9LRU46U0VDUkVU" } end - describe "initialize on production with base_uri" do - before do - ENV["base_uri"] = "http://localhost:5000" - end - - let(:client) do - described_class.new :production, auth - end - - it { expect(client.uri).to eq "http://localhost:5000" } - it { expect(client.env).to eq :production } - it { expect(client.opts[:headers]["Authorization"]).to eq "Basic VE9LRU46U0VDUkVU" } - end - - describe "initialize on sandbox" do - before do - ENV["base_uri"] = nil - end - - let(:client) do - described_class.new :sandbox, auth - end - - it { expect(client.uri).to eq ENV["sandbox_url"] } - it { expect(client.env).to eq :sandbox } - it { expect(client.opts[:headers]["Authorization"]).to eq "Basic VE9LRU46U0VDUkVU" } - end - - describe "initialize on production" do + describe "initialize on production with Basic authentication" do let(:client) do described_class.new :production, auth end it { expect(client.uri).to eq "https://api.moip.com.br" }