Sha256: ed7bd8d5791e4086819f742d54adcf2ac5e3b7278e4cc7d346fbefad2716188c

Contents?: true

Size: 1.12 KB

Versions: 2

Compression:

Stored size: 1.12 KB

Contents

require 'test_helper'

class ControllerIvarTest < ActionDispatch::IntegrationTest
  setup do
    @matz = Author.create! name: 'matz'
    @matz.books.create! title: 'the world of code'
    Author.create! name: 'takahashim'
  end

  test 'decorating a model object in ivar' do
    visit "/authors/#{@matz.id}"
    assert page.has_content? 'matz'
    assert page.has_content? 'matz'.capitalize
  end

  test 'decorating model scope in ivar' do
    visit '/authors'
    assert page.has_content? 'takahashim'
    assert page.has_content? 'takahashim'.reverse
  end

  test "decorating models' array in ivar" do
    visit '/authors?variable_type=array'
    assert page.has_content? 'takahashim'
    assert page.has_content? 'takahashim'.reverse
  end

  test "decorating models' proxy object in ivar" do
    visit '/authors?variable_type=proxy'
    assert page.has_content? 'takahashim'
    assert page.has_content? 'takahashim'.reverse
  end

  test 'decorating model association proxy in ivar' do
    visit "/authors/#{@matz.id}/books"
    assert page.has_content? 'the world of code'
    assert page.has_content? 'the world of code'.reverse
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
active_decorator-0.7.1 test/features/controller_ivar_test.rb
active_decorator-0.7.0 test/features/controller_ivar_test.rb