我正在尝试为插件"foobar"开发测试,修改一些标准的Rails助手.在vendor/plugins/foobar/test/foobar_test.rb中,我有以下内容:
# create the test model
class Thing < ActiveRecord::Base
end
# create the test controller, which renders the included index template
class ThingsController < ActionController::Base
def index
@things = Thing.all
format.html { render(:file => 'index') }
end
def destroy
@thing = Thing.find(params[:id])
@thing.destroy
format.html { render(:file => 'index') }
end
end
# confirm that the test environment is working correctly
class ThingsTest < ActiveSupport::TestCase
test "model is loaded correctly" do
assert_kind_of Thing, Thing.new
end
end
# confirm that the …Run Code Online (Sandbox Code Playgroud)