1
0
Fork 0
mirror of https://github.com/awesome-print/awesome_print synced 2023-03-27 23:22:34 -04:00
awesome_print/spec/ext/ostruct_spec.rb

24 lines
527 B
Ruby
Raw Permalink Normal View History

require 'spec_helper'
2014-01-02 19:10:24 -05:00
RSpec.describe 'AwesomePrint Ostruct extension' do
before do
stub_dotfile!
@ap = AwesomePrint::Inspector.new(:plain => true, :sort_keys => true)
end
2014-01-02 19:10:24 -05:00
it "empty hash" do
struct = OpenStruct.new
expect(@ap.send(:awesome, struct)).to eq("OpenStruct {}")
end
2014-01-02 19:10:24 -05:00
it "plain multiline" do
struct = OpenStruct.new :name => "Foo", :address => "Bar"
expect(@ap.send(:awesome, struct)).to eq <<-EOS.strip
2014-01-02 19:10:24 -05:00
OpenStruct {
2014-01-08 17:42:50 -05:00
:address => "Bar",
:name => "Foo"
2014-01-02 19:10:24 -05:00
}
EOS
2014-01-02 19:10:24 -05:00
end
end