Sha256: 84a8655eaa825c557091c48a242ede3aeabe1f547d104d0622bb100b10400ac0
Contents?: true
Size: 1.54 KB
Versions: 1
Compression:
Stored size: 1.54 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 context 'strict encode' do let(:hash) { { :content => "puts 'hello ruby'"} } it { expect(subject.strict_encode64('content')).to eql('cHV0cyAnaGVsbG8gcnVieSc=') } end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
github_api-0.10.2 | spec/github/params_hash_spec.rb |