Sha256: d81f5237756e59fead5a439d0cffca84dfe5656953bc4982bcb02b6b78abbad8

Contents?: true

Size: 1.15 KB

Versions: 4

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

4 entries across 4 versions & 2 rubygems

Version Path
lulalala_presenter-0.1.0 test/features/controller_ivar_test.rb
active_decorator-1.0.0 test/features/controller_ivar_test.rb
active_decorator-0.9.0 test/features/controller_ivar_test.rb
active_decorator-0.8.0 test/features/controller_ivar_test.rb