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

Cover missing line on ActiveRecord

The type check of ActiveRecord::Relation on ActiveRecord extension was
never reached.

With this tests, we add a coverage against this.
This commit is contained in:
Mauro George 2015-02-11 19:52:11 -02:00
parent 5f86c90856
commit f67bb17e11

View file

@ -53,6 +53,38 @@ RSpec.describe "AwesomePrint/ActiveRecord", skip: ->{ !ExtVerifier.has_rails? }.
:name => "Laura",
:rank => 2
}
]
EOS
if RUBY_VERSION < '1.9'
str.sub!('??', 'Sat Oct 10 12:30:00 UTC 1992')
str.sub!('?!', 'Mon May 26 14:15:00 UTC 2003')
else
str.sub!('??', '1992-10-10 12:30:00 UTC')
str.sub!('?!', '2003-05-26 14:15:00 UTC')
end
expect(out.gsub(/0x([a-f\d]+)/, "0x01234567")).to eq(str)
end
it "display multiple records on a relation" do
@diana.save
@laura.save
out = @ap.send(:awesome, User.all)
str = <<-EOS.strip
[
[0] #<User:0x01234567> {
:admin => false,
:created_at => ??,
:id => 1,
:name => "Diana",
:rank => 1
},
[1] #<User:0x01234567> {
:admin => true,
:created_at => ?!,
:id => 2,
:name => "Laura",
:rank => 2
}
]
EOS
if RUBY_VERSION < '1.9'