Sha256: 0f6473c01d1f50dff313ae8d24b3ff7b27194238887a102d5afae103e61ad414
Contents?: true
Size: 842 Bytes
Versions: 22
Compression:
Stored size: 842 Bytes
Contents
require 'test_helper' class ActiveRecordTest < MiniTest::Test def setup @record = ModelStub.new end def test_to_label # without anything defined, it'll use the to_s method (e.g. #<ModelStub:0xb7379300>) assert_match(/^#<[a-z]+:0x[0-9a-f]+>$/i, @record.to_label) class << @record def to_s 'to_s' end end RequestStore.clear! assert_equal 'to_s', @record.to_label class << @record def title 'title' end end RequestStore.clear! assert_equal 'title', @record.to_label class << @record def label 'label' end end RequestStore.clear! assert_equal 'label', @record.to_label class << @record def name 'name' end end RequestStore.clear! assert_equal 'name', @record.to_label end end
Version data entries
22 entries across 22 versions & 1 rubygems