2014-12-31 15:59:32 -05:00
|
|
|
require 'spec_helper'
|
2014-01-02 19:10:24 -05:00
|
|
|
|
2014-12-31 15:59:32 -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
|
|
|
|
2014-12-31 15:59:32 -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
|
|
|
|
2014-12-31 15:59:32 -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
|
|
|
}
|
2014-12-31 15:59:32 -05:00
|
|
|
EOS
|
2014-01-02 19:10:24 -05:00
|
|
|
end
|
2014-12-31 15:59:32 -05:00
|
|
|
end
|