mirror of
https://github.com/awesome-print/awesome_print
synced 2023-03-27 23:22:34 -04:00
23 lines
515 B
Ruby
23 lines
515 B
Ruby
require 'spec_helper'
|
|
require 'ostruct'
|
|
|
|
RSpec.describe 'AwesomePrint Ostruct extension' do
|
|
before do
|
|
@ap = AwesomePrint::Inspector.new(plain: true, sort_keys: true)
|
|
end
|
|
|
|
it 'empty hash' do
|
|
struct = OpenStruct.new
|
|
expect(@ap.send(:awesome, struct)).to eq('OpenStruct {}')
|
|
end
|
|
|
|
it 'plain multiline' do
|
|
struct = OpenStruct.new name: 'Foo', address: 'Bar'
|
|
expect(@ap.send(:awesome, struct)).to eq <<-EOS.strip
|
|
OpenStruct {
|
|
:address => "Bar",
|
|
:name => "Foo"
|
|
}
|
|
EOS
|
|
end
|
|
end
|