Sha256: 2051ff1952eb706183a6af76c66da5d8617bd1001a70e122c38cf643c87ee456
Contents?: true
Size: 1.04 KB
Versions: 2
Compression:
Stored size: 1.04 KB
Contents
# frozen_string_literal: true require 'test_helper' class DecoratorTest < Test::Unit::TestCase test 'it returns the object on decoration' do book = Book.new title: 'Boek' assert_equal book, ActiveDecorator::Decorator.instance.decorate(book) end test 'it returns the object when it already is decorated on decorate' do book = Book.new title: 'Boek' assert_equal book, ActiveDecorator::Decorator.instance.decorate(ActiveDecorator::Decorator.instance.decorate(book)) end test 'it returns the object of ActiveRecord::Relation on decorate' do 3.times do |index| Book.create title: "ve#{index}" end books = Book.all assert_equal books, ActiveDecorator::Decorator.instance.decorate(books) end test 'it returns the object of ActiveRecord::Relation when it already is decorated on decorate' do 3.times do |index| Book.create title: "ve#{index}" end books = Book.all assert_equal books, ActiveDecorator::Decorator.instance.decorate(ActiveDecorator::Decorator.instance.decorate(books)) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
active_decorator-1.1.1 | test/decorator_test.rb |
active_decorator-1.1.0 | test/decorator_test.rb |