Sha256: 44fd58ad98c8d17ca270d51d71f12a83d0d6448e10d1cbe089a28a58dce660e5
Contents?: true
Size: 908 Bytes
Versions: 13
Compression:
Stored size: 908 Bytes
Contents
require 'spec_helper' describe Docker::Util do subject { described_class } describe '.parse_json' do subject { described_class.parse_json(arg) } context 'when the argument is nil' do let(:arg) { nil } it { should be_nil } end context 'when the argument is empty' do let(:arg) { '' } it { should be_nil } end context 'when the argument is \'null\'' do let(:arg) { 'null' } it { should be_nil } end context 'when the argument is not valid JSON' do let(:arg) { '~~lol not valid json~~' } it 'raises an error' do expect { subject }.to raise_error Docker::Error::UnexpectedResponseError end end context 'when the argument is valid JSON' do let(:arg) { '{"yolo":"swag"}' } it 'parses the JSON into a Hash' do subject.should == { 'yolo' => 'swag' } end end end end
Version data entries
13 entries across 13 versions & 1 rubygems