Clean up frontend, DRY up templates

This commit is contained in:
maddiebaka
2023-10-22 14:05:01 -04:00
parent c5cbffb4e5
commit 66fc396504
5 changed files with 45 additions and 37 deletions

View File

@@ -6,6 +6,23 @@ RSpec.describe "Dictionary", type: :request do
get "/dictionary"
expect(response).to render_template(:index)
end
it "renders the parts_of_speech partial" do
get "/dictionary"
expect(response).to render_template(partial: "_partsofspeech")
end
it "shows the count of parts of speech in the database" do
5.times { FactoryBot.create(:part_of_speech) }
get "/dictionary"
expect(response.body).to include("#{PartOfSpeech.count} parts of speech entries in database")
end
it "shows the count of words in the database" do
5.times { FactoryBot.create(:word) }
get "/dictionary"
expect(response.body).to include("#{Word.count} word entries in database")
end
end
describe "GET /show" do
@@ -23,5 +40,11 @@ RSpec.describe "Dictionary", type: :request do
get "/dictionary/a"
expect(assigns(:words)).to be_a(ActiveRecord::Relation)
end
it "renders the definitions partial" do
FactoryBot.create(:definition)
get "/dictionary/t"
expect(response).to render_template(partial: "_definitions")
end
end
end