オブジェクト「ライン」のすべての機能テストが失敗します。これのデバッグをどこから開始すればよいかさえわかりません。
21) エラー: test_should_update_line(LinesControllerTest): NoMethodError: 未定義のメソッド
name' for false:FalseClass c:/Ruby193/lib/ruby/gems/1.9.1/gems/factory_girl-4.0.0/lib/factory_girl/decl aration/static.rb:11:in
==' c:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.2.3/lib/active_record/att ribute_methods/write.rb: 57:inconvert_number_column_value' c:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.2.3/lib/active_record/att ribute_methods/write.rb:50:in
type_cast_attribute_for_write' c:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.2.3/lib/active_record/att ribute_methods/serialization.rb:88:intype_cast_attribute_for_write' c:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.2.3/lib/active_record/att ribute_methods/write.rb:38:in
write_attribute' c:/Ruby193/lib /ruby/gems/1.9.1/gems/activerecord-3.2.3/lib/active_record/att ribute_methods/dirty.rb:67:inwrite_attribute' c:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.2.3/lib/active_record/att ribute_methods/write.rb:14:in
port=' c:/Ruby193/lib/ruby/gems/1.9.1/gems /factory_girl-4.0.0/lib/factory_girl/attr ibute_assigner.rb:16:block (2 levels) in object' c:/Ruby193/lib/ruby/gems/1.9.1/gems/factory_girl-4.0.0/lib/factory_girl/attr ibute_assigner.rb:15:in
それぞれ'c:/Ruby193/lib/ruby/gems/1.9.1/gems/factory_girl-4.0.0/lib/factory_girl/attribute_assigner .rb:15:でblock in object' c:/Ruby193/lib/ruby/gems/1.9.1/gems/factory_girl-4.0.0/lib/factory_girl/attr ibute_assigner.rb:14:in
「c:/Ruby193/lib/ruby/gems/1.9.1/gems/factory_girl-4.0.0/lib/factory_girl/attr ibute_assigner.rb:14:object' c:in
オブジェクト内」をタップしてください' c:/Ruby193/lib/ruby/gems/ 1.9.1/gems/factory_girl-4.0.0/lib/factory_girl/strategy/create.rb:9:inresult' c:/Ruby193/lib/ruby/gems/1.9.1/gems/factory_girl-4.0.0/lib/factory_girl/fact ory.rb:42:in
run' c:/Ruby193/lib/ruby/gems/1.9.1/gems/factory_girl-4.0.0 /lib/factory_girl/fact ory_runner.rb:23:inblock in run' c:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.3/lib/active_support/n otifications.rb:125:in
楽器' c:/Ruby193/lib/ruby/gems/1.9.1/gems/factory_girl-4.0.0/lib/factory_girl/fact ory_runner.rb:22:inrun' c:/Ruby193/lib/ruby/gems/1.9.1/gems/factory_girl-4.0.0/lib/factory_girl/stra tegy_syntax_method_registrar.rb:19:in
define_singular_strategy_method のブロック'c:/code/vsdb/test/functional/lines_controller_test.rb:5:in `block in <class: LinesControllerTest>' c:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.3/lib/active_support/c
allbacks.rb :462: in
_run__987382823__setup__855471168__callbacks' c:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.3/lib/active_support/c allbacks.rb:405:in
__run_callback' c:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.3/lib/active_support/c allbacks.rb:385: in_run_setup_callbacks' c:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.3/lib/active_support/c allbacks.rb:81:in
run_callbacks ' c:/Ruby193 /lib/ruby/gems/1.9.1/gems/activesupport-3.2.3/lib/active_support/testing/setup_and_teardown.rb:34:in `run'
lines_controller_test.rb:
class LinesControllerTest < ActionController::TestCase
setup do @line = FactoryGirl.create(:line)
endtest "should update line" do put :update, id: @line, line: { description: @line.description } assert_redirected_to line_path(assigns(:line)) end
終わり
test_helper.rb:
ENV["RAILS_ENV"] = "test" require File.expand_path('../../config/environment', FILE ) require 'rails/test_help' require 'capybara/rails'
class ActiveSupport::TestCase # test/fixtures/*.(yml|csv) 内のすべてのフィクスチャをすべてのテストに対してアルファベット順にセットアップします。# # 注: 現在のところ、統合テストでフィクスチャを明示的に宣言する必要があります # -- まだこの設定を継承していません
def setup #あらゆる種類の所有者 @admin = FactoryGirl.create(:owner, iso:true, admin:true) @iso = FactoryGirl.create(:owner, iso:true) @isa = FactoryGirl.create(:owner) #デフォルトで管理者になる @controller.stubs(:current_owner).returns(@admin)
#fixtures for compliance rates verification @art = FactoryGirl.create(:unit, name: "art", unit_code: "1110000", parent_unit_id: 1100000) end
# すべてのテストで使用されるヘルパー メソッドをここに追加します... end
class ActionDispatch::IntegrationTest include Capybar::DSL
def ティアダウン Capybara.reset_sessions! Capybara.use_default_driver end end