質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.50%
Ruby

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

Ruby on Rails

Ruby on Railsは、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

Q&A

2回答

739閲覧

railsチュートリアルエラー リスト 7.24

kwtkwt

総合スコア21

Ruby

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

Ruby on Rails

Ruby on Railsは、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

0グッド

0クリップ

投稿2018/10/14 02:02

前提・実現したいこと

railsチュートリアルエラー解決

リスト 7.24のテストが通らない

よろしくお願いします。

発生している問題・エラーメッセージ

Running via Spring preloader in process 5446
Started with run options --seed 55596

ERROR["test_should_get_about", StaticPagesControllerTest, 0.17055410199964172]
test_should_get_about#StaticPagesControllerTest (0.17s)
ActionView::Template::Error: ActionView::Template::Error: Missing partial layouts/_rails_default with {:locale=>[:en], :formats=>[:html], :variants=>[], :handlers=>[:raw, :erb, :html, :builder, :ruby, :coffee, :jbuilder]}. Searched in:
* "/home/ec2-user/environment/sample_app/app/views"

app/views/layouts/application.html.erb:5:in `_app_views_layouts_application_html_erb___3127769034408787206_45866140' test/controllers/static_pages_controller_test.rb:18:in `block in <class:StaticPagesControllerTest>'

ERROR["test_should_get_contact", StaticPagesControllerTest, 0.17817625499992573]
test_should_get_contact#StaticPagesControllerTest (0.18s)
ActionView::Template::Error: ActionView::Template::Error: Missing partial layouts/_rails_default with {:locale=>[:en], :formats=>[:html], :variants=>[], :handlers=>[:raw, :erb, :html, :builder, :ruby, :coffee, :jbuilder]}. Searched in:
* "/home/ec2-user/environment/sample_app/app/views"

app/views/layouts/application.html.erb:5:in `_app_views_layouts_application_html_erb___3127769034408787206_45866140' test/controllers/static_pages_controller_test.rb:24:in `block in <class:StaticPagesControllerTest>'

ERROR["test_should_get_home", StaticPagesControllerTest, 0.9626972069995645]
test_should_get_home#StaticPagesControllerTest (0.96s)
ActionView::Template::Error: ActionView::Template::Error: Invalid CSS after ".": expected class name, was "."
app/assets/stylesheets/custom.scss:167
app/views/static_pages/home.html.erb:13:in _app_views_static_pages_home_html_erb__4196967345426485036_45405380' test/controllers/static_pages_controller_test.rb:6:in block in class:StaticPagesControllerTest'

ERROR["test_should_get_help", StaticPagesControllerTest, 0.9709416809996583]
test_should_get_help#StaticPagesControllerTest (0.97s)
ActionView::Template::Error: ActionView::Template::Error: Missing partial layouts/_rails_default with {:locale=>[:en], :formats=>[:html], :variants=>[], :handlers=>[:raw, :erb, :html, :builder, :ruby, :coffee, :jbuilder]}. Searched in:
* "/home/ec2-user/environment/sample_app/app/views"

app/views/layouts/application.html.erb:5:in `_app_views_layouts_application_html_erb___3127769034408787206_45866140' test/controllers/static_pages_controller_test.rb:12:in `block in <class:StaticPagesControllerTest>'

ERROR["test_invalid_signup_information", UsersSignupTest, 0.986433458999727]
test_invalid_signup_information#UsersSignupTest (0.99s)
ActionView::Template::Error: ActionView::Template::Error: Missing partial layouts/_rails_default with {:locale=>[:en], :formats=>[:html], :variants=>[], :handlers=>[:raw, :erb, :html, :builder, :ruby, :coffee, :jbuilder]}. Searched in:
* "/home/ec2-user/environment/sample_app/app/views"

app/views/layouts/application.html.erb:5:in `_app_views_layouts_application_html_erb___3127769034408787206_45866140' test/integration/users_signup_test.rb:6:in `block in <class:UsersSignupTest>'

ERROR["test_layout_links", SiteLayoutTest, 1.5236786559999018]
test_layout_links#SiteLayoutTest (1.52s)
ActionView::Template::Error: ActionView::Template::Error: Invalid CSS after ".": expected class name, was "."
app/assets/stylesheets/custom.scss:167
app/views/static_pages/home.html.erb:13:in _app_views_static_pages_home_html_erb__4196967345426485036_45405380' test/integration/site_layout_test.rb:6:in block in class:SiteLayoutTest'

ERROR["test_full_title_helper", ApplicationHelperTest, 1.5305922419997842]
test_full_title_helper#ApplicationHelperTest (1.53s)
NameError: NameError: uninitialized constant ApplicationHelperTest::FILL_IN
test/helpers/application_helper_test.rb:5:in `block in class:ApplicationHelperTest'

ERROR["test_should_get_new", UsersControllerTest, 1.5381249709998883]
test_should_get_new#UsersControllerTest (1.54s)
ActionView::Template::Error: ActionView::Template::Error: Missing partial layouts/_rails_default with {:locale=>[:en], :formats=>[:html], :variants=>[], :handlers=>[:raw, :erb, :html, :builder, :ruby, :coffee, :jbuilder]}. Searched in:
* "/home/ec2-user/environment/sample_app/app/views"

app/views/layouts/application.html.erb:5:in `_app_views_layouts_application_html_erb___3127769034408787206_45866140' test/controllers/users_controller_test.rb:6:in `block in <class:UsersControllerTest>'

19/19: [===================================] 100% Time: 00:00:01, Time: 00:00:01

Finished in 1.54207s
19 tests, 19 assertions, 0 failures, 8 errors, 0 skips

該当のソースコード

ruby rails

試したこと

コードの見直し、訂正

補足情報(FW/ツールのバージョンなど)

cloud9

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答2

0

すみません、古いやつを見ていたようなので書き直しました。

ERROR["test_full_title_helper", ApplicationHelperTest, 1.5305922419997842] test_full_title_helper#ApplicationHelperTest (1.53s) NameError: NameError: uninitialized constant ApplicationHelperTest::FILL_IN test/helpers/application_helper_test.rb:5:in `block in <class:ApplicationHelperTest>'

このエラーは、エラー内容をみると

test/helpers/application_helper_test.rb:5 行目でエラーが出ているよ
うです。

そして、エラー内容を更にみると

ERROR["test_full_title_helper",  とあるので、

test full title helper do
end

のところでエラーが出ているようなので、

test/helpers/application_helper_test.rb

test full title helper do
end
でエラーが出ているようです。

そして、 full title helper を作成したのが演習のどこなのか調べると、
リスト5.37のようです。

リスト5.37の内容は

リスト 5.37: full_titleヘルパーの単体テスト
test/helpers/application_helper_test.rb

require 'test_helper' class ApplicationHelperTest < ActionView::TestCase test "full title helper" do assert_equal full_title, FILL_IN assert_equal full_title("Help"), FILL_IN end end

このようになっています。

そして、5.3.4 リンクのテスト 演習 2 の内容を抜粋すると、

”FILL_INの部分を適切なコードに置き換えてみてください。”

とあるので、適切なコードに書き換えれば、テストは GREEN になると思います。

投稿2018/10/14 22:04

編集2018/10/14 22:54
kazukkinakamura

総合スコア26

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

kwtkwt

2018/10/15 00:58

ご丁寧に回答ありがとうございます。 5.3.4 リンクのテスト 演習 2の部分でFILL_INのエラーに気づいたのですが、適切なコードへの書き換えがわかりませんでした。どのように書き換えればよろしいでしょうか。 よろしくお願いします。
guest

0

ERROR["test_should_get_home", StaticPagesControllerTest, 0.9626972069995645] test_should_get_home#StaticPagesControllerTest (0.96s) ActionView::Template::Error: ActionView::Template::Error: Invalid CSS after ".": expected class name, was "." app/assets/stylesheets/custom.scss:167 app/views/static_pages/home.html.erb:13:in _app_views_static_pages_home_html_erb__4196967345426485036_45405380' test/controllers/static_pages_controller_test.rb:6:in block in <class:StaticPagesControllerTest>'

このエラーは、app/assets/stylesheets/custom.scss:167 行目でエラーが出ているようです。

なので、app/assets/stylesheets/custom.scss を開き、167行目をみてください。

167行目がどうなっているか分かりませんが、エラー内容

ActionView::Template::Error: Invalid CSS after ".": expected class name, was "."

を見るに、class名のところの "." の記述でミスがあると思います。

投稿2018/10/14 21:36

kazukkinakamura

総合スコア26

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだベストアンサーが選ばれていません

会員登録して回答してみよう

アカウントをお持ちの方は

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.50%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問