lib/submodules/ably-ruby/spec/acceptance/rest/presence_spec.rb in ably-rest-0.8.15 vs lib/submodules/ably-ruby/spec/acceptance/rest/presence_spec.rb in ably-rest-0.9.0

- old
+ new

@@ -67,16 +67,18 @@ { limit: 100 } end let(:endpoint) do - client.endpoint + client.endpoint.tap do |client_end_point| + client_end_point.user = key_name + client_end_point.password = key_secret + end end let!(:get_stub) { query_params = query_options.map { |k, v| "#{k}=#{v}" }.join('&') stub_request(:get, "#{endpoint}/channels/#{Addressable::URI.encode(channel_name)}/presence?#{query_params}"). - with(basic_auth: [key_name, key_secret]). to_return(:body => '{}', :headers => { 'Content-Type' => 'application/json' }) } let(:channel_name) { random_str } let(:channel) { client.channels.get(channel_name) } @@ -178,11 +180,14 @@ let(:channel_name) { "persisted:#{random_str(4)}" } let(:presence) { client.channel(channel_name).presence } let(:user) { 'appid.keyuid' } let(:secret) { random_str(8) } let(:endpoint) do - client.endpoint + client.endpoint.tap do |client_end_point| + client_end_point.user = user + client_end_point.password = secret + end end let(:client) do Ably::Rest::Client.new(key: "#{user}:#{secret}") end let(:history_options) do @@ -194,11 +199,10 @@ context 'limit options', :webmock do let!(:history_stub) { query_params = history_options.map { |k, v| "#{k}=#{v}" }.join('&') stub_request(:get, "#{endpoint}/channels/#{Addressable::URI.encode(channel_name)}/presence/history?#{query_params}"). - with(basic_auth: [user, secret]). to_return(:body => '{}', :headers => { 'Content-Type' => 'application/json' }) } before do presence.history(history_options) @@ -235,11 +239,10 @@ } } let!(:history_stub) { query_params = history_options.map { |k, v| "#{k}=#{v}" }.join('&') stub_request(:get, "#{endpoint}/channels/#{Addressable::URI.encode(channel_name)}/presence/history?#{query_params}"). - with(basic_auth: [user, secret]). to_return(:body => '{}', :headers => { 'Content-Type' => 'application/json' }) } before do presence.history(history_options) @@ -305,11 +308,14 @@ describe 'decoding permutations using mocked #history', :webmock do let(:user) { 'appid.keyuid' } let(:secret) { random_str(8) } let(:endpoint) do - client.endpoint + client.endpoint.tap do |client_end_point| + client_end_point.user = user + client_end_point.password = secret + end end let(:client) do Ably::Rest::Client.new(client_options.merge(key: "#{user}:#{secret}")) end @@ -340,11 +346,10 @@ end context '#get' do let!(:get_stub) { stub_request(:get, "#{endpoint}/channels/#{Addressable::URI.encode(channel_name)}/presence?limit=100"). - with(basic_auth: [user, secret]). to_return(:body => serialized_encoded_message, :headers => { 'Content-Type' => content_type }) } after do expect(get_stub).to have_been_requested @@ -358,11 +363,10 @@ end context '#history' do let!(:history_stub) { stub_request(:get, "#{endpoint}/channels/#{Addressable::URI.encode(channel_name)}/presence/history?direction=backwards&limit=100"). - with(basic_auth: [user, secret]). to_return(:body => serialized_encoded_message, :headers => { 'Content-Type' => content_type }) } after do expect(history_stub).to have_been_requested @@ -389,11 +393,10 @@ context '#get' do let(:client_options) { default_options.merge(log_level: :fatal) } let!(:get_stub) { stub_request(:get, "#{endpoint}/channels/#{Addressable::URI.encode(channel_name)}/presence?limit=100"). - with(basic_auth: [user, secret]). to_return(:body => serialized_encoded_message_with_invalid_encoding, :headers => { 'Content-Type' => content_type }) } let(:presence_message) { presence.get.items.first } after do @@ -414,10 +417,9 @@ context '#history' do let(:client_options) { default_options.merge(log_level: :fatal) } let!(:history_stub) { stub_request(:get, "#{endpoint}/channels/#{Addressable::URI.encode(channel_name)}/presence/history?direction=backwards&limit=100"). - with(basic_auth: [user, secret]). to_return(:body => serialized_encoded_message_with_invalid_encoding, :headers => { 'Content-Type' => content_type }) } let(:presence_message) { presence.history.items.first } after do