[#50180] [質問] Win32OLE Excel ネットワーク上のファイルOpen失敗 — <yamataka@...08.itscom.net>

山口と申します。

11 messages 2015/06/25
[#50190] Re: [質問] Win32OLE Excel ネットワーク上のファイルOpen失敗 — Tomiaki Ishiduka <tomiacannondale@...> 2015/07/01

55+z5aGa44Go44KC44GG44GX44G+44GZ44CCDQoNCuOBn+OBl+OBi+OAgeS4i+iomOOBrmN5Z3dp

[ruby-list:50169] helperのテスト(ActionView::TestCase)

From: dezawa <dezawa@...>
Date: 2015-06-12 10:22:29 UTC
List: ruby-list #50169
出沢です

rails(4)の話なのですが。。。。。
View用に作ったHelperのリファクタリングをすることになり、
作られていなかったHelper用のtestを書こうとして嵌っています。
Controlleのテストの説明は至る所で見つかるのですが、
ActionView::TestCase や ActionView::Base を使ってのテストの
情報がhitしてくれません。
  http://qiita.com/t_oginogin/items/7654190749dc6fcce732 や
  http://ruby.studio-kingdom.com/rails/guides/testing#10 を
参考に下の様なコードを書いてみたのですがいずれも
 NoMethodError: undefined method `host' for nil:NilClass
controller の指定が無いからだろうと思うのですが、form_tag の
引数に     :controller => FooController.new を追加しても同じエラーと
なります。
どのようにすれば ViewのHelperのtestが書けるのかご指導ください。

<<<<< 1
# -*- coding: utf-8 -*-
require 'test_helper'

class ActionButtomHelperTest < ActionView::TestCase
  include ActionButtonHelper

  must "form_buttom option なし" do
    assert_equal "",  form_tag(:action => :index)
  end
end
>>>>
<<<<< 2
class ActionButtomHelperTest < ActionView::TestCase
  include ActionButtonHelper

  class TestHelper < ActionView::Base
    include ActionButtonHelper
  end
  def setup
    @helper = TestHelper.new
  end

  must "form_buttom option なし" do
    assert_equal "",  @helper.form_tag(:action => :index)
  end
end

In This Thread

Prev Next