Sha256: d4d6f6e8fff747c3dd3a710dee4a5ab28fda9b55156ddfa40f2f5a84117e11d7

Contents?: true

Size: 987 Bytes

Versions: 9

Compression:

Stored size: 987 Bytes

Contents

require 'spec_helper'

describe BitBucket::Response::Mashify do
  # let(:mashify) { described_class.new }
  describe 'parse' do
    before do
      @mashify = BitBucket::Response::Mashify.new
      @string = "Fantastic week!"
      @array = ['Monday', 'Tuesday']
      @hash = {one: 'one', two: 'two', three: 'three'}
      @array_with_hash = ['banana', 'apple', {:third => 'mango'}]
    end
    it 'parses a hash an returns a hashie mash' do
      hashie_mash = @mashify.parse(@hash)
      expect(hashie_mash.one).to eq("one")
    end

    it 'parses a hash that is within an array' do
      array_hashie_mash = @mashify.parse(@array_with_hash)
      expect(array_hashie_mash[2].third).to eq("mango")
    end

    it 'returns same object if the object does not contain a hash' do
      string = @mashify.parse(@string)
      array = @mashify.parse(@array)

      expect(string).to eq(@string)
      expect(array.length).to eq(2)
      expect(array[0]).to eq("Monday")
    end
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
zz_bitbucket_rest_api-0.1.11 spec/bitbucket_rest_api/response/mashify_spec.rb
zz_bitbucket_rest_api-0.1.10 spec/bitbucket_rest_api/response/mashify_spec.rb
zz_bitbucket_rest_api-0.1.9 spec/bitbucket_rest_api/response/mashify_spec.rb
zz_bitbucket_rest_api-0.1.8 spec/bitbucket_rest_api/response/mashify_spec.rb
bitbucket_rest_api2-0.9.5 spec/bitbucket_rest_api/response/mashify_spec.rb
bitbucket_rest_api2-0.9.1 spec/bitbucket_rest_api/response/mashify_spec.rb
bitbucket_rest_api2-0.2.2 spec/bitbucket_rest_api/response/mashify_spec.rb
bitbucket_rest_api2-0.2.1 spec/bitbucket_rest_api/response/mashify_spec.rb
bitbucket_rest_api2-0.2.0 spec/bitbucket_rest_api/response/mashify_spec.rb