File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed
spec/bitbucket_rest_api/response Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change 1+ require 'spec_helper'
2+
3+ describe BitBucket ::Response ::Mashify do
4+ # let(:mashify) { described_class.new }
5+ describe 'parse' do
6+ before do
7+ @mashify = BitBucket ::Response ::Mashify . new
8+ @string = "Fantastic week!"
9+ @array = [ 'Monday' , 'Tuesday' ]
10+ @hash = { one : 'one' , two : 'two' , three : 'three' }
11+ @array_with_hash = [ 'banana' , 'apple' , { :third => 'mango' } ]
12+ end
13+ it 'parses a hash an returns a hashie mash' do
14+ hashie_mash = @mashify . parse ( @hash )
15+ expect ( hashie_mash . one ) . to eq ( "one" )
16+ end
17+
18+ it 'parses a hash that is within an array' do
19+ array_hashie_mash = @mashify . parse ( @array_with_hash )
20+ expect ( array_hashie_mash [ 2 ] . third ) . to eq ( "mango" )
21+ end
22+
23+ it 'returns same object if the object does not contain a hash' do
24+ string = @mashify . parse ( @string )
25+ array = @mashify . parse ( @array )
26+
27+ expect ( string ) . to eq ( @string )
28+ expect ( array . length ) . to eq ( 2 )
29+ expect ( array [ 0 ] ) . to eq ( "Monday" )
30+ end
31+ end
32+ end
You can’t perform that action at this time.
0 commit comments