1
我試圖與MINITEST 2種控制器方法來測試:會議散列名稱錯誤
class CurrenciesController < InheritedResources::Base
def mark_refresh
session[:refreshable] = true
redirect_to currencies_url
end
def unmark_refresh
session[:refreshable] = false
redirect_to currencies_url
end
end
我的測試:
require "minitest_helper"
describe "Currencies integration" do
it "should auto refresh" do
visit currencies_path
click_on "Auto refresh"
session[:refreshable].must_equal true
end
it "should turn off auto refresh" do
session[:refreshable] = true
visit currencies_path
click_on "Auto refresh"
session[:refreshable].must_equal false
end
,但我發現未定義的局部變量或方法`會話'。會話哈希必須在測試中以某種方式進行初始化?我正在使用rails 3.2.12。