./bin/rails importmap:install
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe "articles/edit", type: :view do
|
||||
before(:each) do
|
||||
@article = assign(:article, Article.create!(
|
||||
title: "MyString",
|
||||
text: "MyText"
|
||||
))
|
||||
end
|
||||
|
||||
it "renders the edit article form" do
|
||||
render
|
||||
|
||||
assert_select "form[action=?][method=?]", article_path(@article), "post" do
|
||||
|
||||
assert_select "input[name=?]", "article[title]"
|
||||
|
||||
assert_select "textarea[name=?]", "article[text]"
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,22 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe "articles/index", type: :view do
|
||||
before(:each) do
|
||||
assign(:articles, [
|
||||
Article.create!(
|
||||
title: "Title",
|
||||
text: "MyText"
|
||||
),
|
||||
Article.create!(
|
||||
title: "Title",
|
||||
text: "MyText"
|
||||
)
|
||||
])
|
||||
end
|
||||
|
||||
it "renders a list of articles" do
|
||||
render
|
||||
assert_select "tr>td", text: "Title".to_s, count: 2
|
||||
assert_select "tr>td", text: "MyText".to_s, count: 2
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,21 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe "articles/new", type: :view do
|
||||
before(:each) do
|
||||
assign(:article, Article.new(
|
||||
title: "MyString",
|
||||
text: "MyText"
|
||||
))
|
||||
end
|
||||
|
||||
it "renders new article form" do
|
||||
render
|
||||
|
||||
assert_select "form[action=?][method=?]", articles_path, "post" do
|
||||
|
||||
assert_select "input[name=?]", "article[title]"
|
||||
|
||||
assert_select "textarea[name=?]", "article[text]"
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,16 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe "articles/show", type: :view do
|
||||
before(:each) do
|
||||
@article = assign(:article, Article.create!(
|
||||
title: "Title",
|
||||
text: "MyText"
|
||||
))
|
||||
end
|
||||
|
||||
it "renders attributes in <p>" do
|
||||
render
|
||||
expect(rendered).to match(/Title/)
|
||||
expect(rendered).to match(/MyText/)
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user