From d30429045b4375bcab667d164b7ee18733bc76c6 Mon Sep 17 00:00:00 2001 From: Ryan W Date: Thu, 16 Dec 2021 14:40:07 -0800 Subject: [PATCH] Update specs for attribute change and rich text --- spec/views/articles/edit.html.erb_spec.rb | 5 +++-- spec/views/articles/index.html.erb_spec.rb | 4 ++-- spec/views/articles/new.html.erb_spec.rb | 5 +++-- spec/views/articles/show.html.erb_spec.rb | 4 ++-- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/spec/views/articles/edit.html.erb_spec.rb b/spec/views/articles/edit.html.erb_spec.rb index 57d1cac..524958f 100644 --- a/spec/views/articles/edit.html.erb_spec.rb +++ b/spec/views/articles/edit.html.erb_spec.rb @@ -4,7 +4,7 @@ RSpec.describe "articles/edit", type: :view do before(:each) do @article = assign(:article, Article.create!( title: "MyString", - text: "MyText" + content: "MyContent" )) end @@ -15,7 +15,8 @@ RSpec.describe "articles/edit", type: :view do assert_select "input[name=?]", "article[title]" - assert_select "textarea[name=?]", "article[text]" + #TODO: with rich_text, this is not a textarea + # assert_select "textarea[name=?]", "article[content]" end end end diff --git a/spec/views/articles/index.html.erb_spec.rb b/spec/views/articles/index.html.erb_spec.rb index 6bf84b0..bea54e6 100644 --- a/spec/views/articles/index.html.erb_spec.rb +++ b/spec/views/articles/index.html.erb_spec.rb @@ -5,11 +5,11 @@ RSpec.describe "articles/index", type: :view do assign(:articles, [ Article.create!( title: "Title", - text: "MyText" + content: "MyText" ), Article.create!( title: "Title", - text: "MyText" + content: "MyText" ) ]) end diff --git a/spec/views/articles/new.html.erb_spec.rb b/spec/views/articles/new.html.erb_spec.rb index 50a809c..c149e2a 100644 --- a/spec/views/articles/new.html.erb_spec.rb +++ b/spec/views/articles/new.html.erb_spec.rb @@ -4,7 +4,7 @@ RSpec.describe "articles/new", type: :view do before(:each) do assign(:article, Article.new( title: "MyString", - text: "MyText" + content: "MyContent" )) end @@ -15,7 +15,8 @@ RSpec.describe "articles/new", type: :view do assert_select "input[name=?]", "article[title]" - assert_select "textarea[name=?]", "article[text]" + #TODO: with rich_text, this is not a textarea + # assert_select "textarea[name=?]", "article[content]" end end end diff --git a/spec/views/articles/show.html.erb_spec.rb b/spec/views/articles/show.html.erb_spec.rb index 090619c..fd62416 100644 --- a/spec/views/articles/show.html.erb_spec.rb +++ b/spec/views/articles/show.html.erb_spec.rb @@ -4,13 +4,13 @@ RSpec.describe "articles/show", type: :view do before(:each) do @article = assign(:article, Article.create!( title: "Title", - text: "MyText" + content: "MyContent" )) end it "renders attributes in

" do render expect(rendered).to match(/Title/) - expect(rendered).to match(/MyText/) + expect(rendered).to match(/MyContent/) end end