Sha256: ea178f0cd22f57e3d9819d440839294f25c2d74363f0b953cca9bd810feb62c1
Contents?: true
Size: 1.37 KB
Versions: 2
Compression:
Stored size: 1.37 KB
Contents
# encoding: utf-8 require 'spec_helper' describe Github::ParamsHash do let(:object) { described_class } subject { object.new(hash) } context 'converts key to string' do let(:hash) { {:foo => 123 }} it { expect(subject).to be_a(Github::ParamsHash)} it { expect(subject['foo']).to eql(123) } it { expect(subject.data).to eql({"foo" => 123}) } end context 'media' do let(:hash) { {:media => "raw"} } it 'parses media key' do expect(subject.media).to eql('application/vnd.github.v3.raw+json') end end context 'with accept' do let(:hash) { {:accept => "application/json"} } it 'overwrites media key' do expect(subject.accept).to eql('application/json') end end context 'without accept' do let(:hash) { {} } it 'overwrites media key' do expect(subject.accept).to be_nil end end context 'extract data' do let(:hash) { {:data => 'foobar'} } it { expect(subject.data).to eql('foobar') } end context 'merges defaults' do let(:hash) { { :homepage => "https://tty.github.io" }} let(:defaults) { { "homepage" => "https://github.com", "private" => false} } it 'correctly updates values' do subject.merge_default(defaults) expect(subject['homepage']).to eql("https://tty.github.io") expect(subject['private']).to be_false end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
github_api-0.10.1 | spec/github/params_hash_spec.rb |
github_api-0.10.0 | spec/github/params_hash_spec.rb |