Sha256: d2c777099b89bd8cf4f6072e8ddff9fe008df58e8f26e215dae3ef8e00454481

Contents?: true

Size: 1.15 KB

Versions: 7

Compression:

Stored size: 1.15 KB

Contents

# frozen_string_literal: true

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

7 entries across 7 versions & 1 rubygems

Version Path
active_decorator-1.3.3 test/features/controller_ivar_test.rb
active_decorator-1.3.2 test/features/controller_ivar_test.rb
active_decorator-1.3.1 test/features/controller_ivar_test.rb
active_decorator-1.3.0 test/features/controller_ivar_test.rb
active_decorator-1.2.0 test/features/controller_ivar_test.rb
active_decorator-1.1.1 test/features/controller_ivar_test.rb
active_decorator-1.1.0 test/features/controller_ivar_test.rb