Sha256: 91a783d5f10746b4ccf14b2f65e80dbf268ec55fbd0ce0f89740b787c35d0b76

Contents?: true

Size: 1.28 KB

Versions: 25

Compression:

Stored size: 1.28 KB

Contents

# frozen_string_literal: true

require 'spec_helper'
describe RubyRabbitmqJanus::Janus::Responses::Response, type: :responses,
                                                        name: :response do
  let(:response) { described_class.new(message) }

  context 'when ask json response' do
    let(:message) { { 'data' => { 'id' => (rand * 10_000).to_i } } }

    it { expect(response.to_json).to be_kind_of(String) }
  end

  context 'when ask nice json response' do
    let(:message) { { 'data' => { 'id' => (rand * 10_000).to_i } } }

    it { expect(response.to_nice_json).to be_kind_of(String) }
  end

  context 'when ask hash response' do
    let(:message) { { 'data' => { 'id' => (rand * 10_000).to_i } } }

    it { expect(response.to_hash).to be_kind_of(Hash) }
  end

  context 'when ask error code' do
    let(:message) { { 'error' => { 'code' => (rand * 600).to_i, 'reason' => '...' } } }

    it { expect(response.error_code).to be_kind_of(Integer) }
  end

  context 'when ask error reason' do
    let(:message) { { 'error' => { 'code' => (rand * 600).to_i, 'reason' => '...' } } }

    it { expect(response.error_reason).to be_kind_of(String) }
  end

  context 'when ask janus' do
    let(:message) { { 'janus' => 'super' } }

    it { expect(response.janus).to be_kind_of(String) }
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
ruby_rabbitmq_janus-4.0.1 spec/ruby_rabbitmq_janus/janus/responses/response_spec.rb
ruby_rabbitmq_janus-4.0.1.pre.1265973744 spec/ruby_rabbitmq_janus/janus/responses/response_spec.rb
ruby_rabbitmq_janus-4.0.1.pre.1265506307 spec/ruby_rabbitmq_janus/janus/responses/response_spec.rb
ruby_rabbitmq_janus-4.0.1.pre.1265140558 spec/ruby_rabbitmq_janus/janus/responses/response_spec.rb
ruby_rabbitmq_janus-4.0.0 spec/ruby_rabbitmq_janus/janus/responses/response_spec.rb
ruby_rabbitmq_janus-4.0.0.pre.1001345090 spec/ruby_rabbitmq_janus/janus/responses/response_spec.rb
ruby_rabbitmq_janus-4.0.0.pre.1001181479 spec/ruby_rabbitmq_janus/janus/responses/response_spec.rb
ruby_rabbitmq_janus-4.0.0.pre.1001132533 spec/ruby_rabbitmq_janus/janus/responses/response_spec.rb
ruby_rabbitmq_janus-4.0.0.pre.1001107243 spec/ruby_rabbitmq_janus/janus/responses/response_spec.rb
ruby_rabbitmq_janus-4.0.0.pre.1001043172 spec/ruby_rabbitmq_janus/janus/responses/response_spec.rb
ruby_rabbitmq_janus-4.0.0.pre.949167646 spec/ruby_rabbitmq_janus/janus/responses/response_spec.rb
ruby_rabbitmq_janus-4.0.0.pre.946892338 spec/ruby_rabbitmq_janus/janus/responses/response_spec.rb
ruby_rabbitmq_janus-4.0.0.pre.946565704 spec/ruby_rabbitmq_janus/janus/responses/response_spec.rb
ruby_rabbitmq_janus-4.0.0.pre.939149205 spec/ruby_rabbitmq_janus/janus/responses/response_spec.rb
ruby_rabbitmq_janus-4.0.0.pre.939137013 spec/ruby_rabbitmq_janus/janus/responses/response_spec.rb
ruby_rabbitmq_janus-4.0.0.pre.939133437 spec/ruby_rabbitmq_janus/janus/responses/response_spec.rb
ruby_rabbitmq_janus-4.0.0.pre.939119110 spec/ruby_rabbitmq_janus/janus/responses/response_spec.rb
ruby_rabbitmq_janus-4.0.0.pre.939113634 spec/ruby_rabbitmq_janus/janus/responses/response_spec.rb
ruby_rabbitmq_janus-4.0.0.pre.850041590 spec/ruby_rabbitmq_janus/janus/responses/response_spec.rb
ruby_rabbitmq_janus-3.0.1 spec/ruby_rabbitmq_janus/janus/responses/response_spec.rb