Rails アプリケーションでカピバラの機能テストを行うための基本的なテンプレートをセットアップしています。RSPEC の代わりに MiniTest も使用しています。
Rake Test を実行しても機能テストが反映されていないようです。ファイルに 1 つのテストがあり、rake テストを実行してもアサーションの数は変わりません。rake test を実行しても、テストをスキップしても表示されません。
リポジトリへのリンクは次のとおりです: https://github.com/rrgayhart/rails_template
これが私が従った手順です
これをGemfileに追加してバンドルを実行しました
group :development, :test do gem 'capybara' gem 'capybara_minitest_spec' gem 'launchy' end
これをtest_helperに追加しました
require 'capybara/rails'
フォルダー test/features を作成しました
drink_creation_test.rb というファイルを作成しました
その機能テストファイルのコードは次のとおりです
require 'test_helper' class DrinkCreationTest < MiniTest::Unit::TestCase def test_it_creates_an_drink_with_a_title_and_body visit drinks_path click_on 'new-drink' fill_in 'name', :with => "PBR" fill_in 'description', :with => "This is a great beer." fill_in 'price', :with => 7.99 fill_in 'category_id', :with => 1 click_on 'save-drink' within('#title') do assert page.has_content?("PBR") end within('#description') do assert page.has_content?("td", text: "This is a great beer") end end end
何かを正しく接続していないという問題があると思います。この問題の診断に役立つ情報が他にあればお知らせください。