From 69451b26c11a39578d527485c483b13113128dae Mon Sep 17 00:00:00 2001 From: Renata Marques Date: Sat, 7 Dec 2019 14:05:51 -0300 Subject: [PATCH] specs for home page --- spec/features/pages/pages_spec.rb | 30 ++++++++++++++++++++++++++++++ spec/requests/entries_spec.rb | 2 +- spec/requests/pages_spec.rb | 10 ++++++++++ spec/requests/users_spec.rb | 2 +- spec/routing/pages_routing_spec.rb | 9 +++++++++ 5 files changed, 51 insertions(+), 2 deletions(-) create mode 100644 spec/features/pages/pages_spec.rb create mode 100644 spec/requests/pages_spec.rb create mode 100644 spec/routing/pages_routing_spec.rb diff --git a/spec/features/pages/pages_spec.rb b/spec/features/pages/pages_spec.rb new file mode 100644 index 0000000..17c03e6 --- /dev/null +++ b/spec/features/pages/pages_spec.rb @@ -0,0 +1,30 @@ +require "rails_helper" + +RSpec.describe 'home page', type: :feature do + describe 'texts in home page' do + + before { visit root_path } + + context 'match texts in home page' do + it 'expect correct title' do + expect(page).to have_content('Projeto Carambolo!') + end + + it 'expect correct description' do + expect(page).to have_content('Um projeto pela vida') + end + + it 'expect correct section about' do + expect(page).to have_content('Sobre') + end + + it 'expect correct section projects' do + expect(page).to have_content('Projetos') + end + + it 'expect correct article' do + expect(page).to have_content('Artigo sobre a técnica das três colunas') + end + end + end +end diff --git a/spec/requests/entries_spec.rb b/spec/requests/entries_spec.rb index d002ee5..dc3cb45 100644 --- a/spec/requests/entries_spec.rb +++ b/spec/requests/entries_spec.rb @@ -2,7 +2,7 @@ RSpec.describe "Entries", type: :request do describe "GET /entries" do - it "works! (now write some real specs)" do + it "works!" do get entries_path expect(response).to have_http_status(200) end diff --git a/spec/requests/pages_spec.rb b/spec/requests/pages_spec.rb new file mode 100644 index 0000000..de2b75f --- /dev/null +++ b/spec/requests/pages_spec.rb @@ -0,0 +1,10 @@ +require 'rails_helper' + +RSpec.describe 'home page', type: :request do + describe "GET /root" do + it "works!" do + get root_path + expect(response).to have_http_status(200) + end + end +end diff --git a/spec/requests/users_spec.rb b/spec/requests/users_spec.rb index 8d6a01c..0e0184d 100644 --- a/spec/requests/users_spec.rb +++ b/spec/requests/users_spec.rb @@ -2,7 +2,7 @@ RSpec.describe "Users", type: :request do describe "GET /users" do - it "works! (now write some real specs)" do + it "works!" do get users_path expect(response).to have_http_status(200) end diff --git a/spec/routing/pages_routing_spec.rb b/spec/routing/pages_routing_spec.rb new file mode 100644 index 0000000..17931ed --- /dev/null +++ b/spec/routing/pages_routing_spec.rb @@ -0,0 +1,9 @@ +require "rails_helper" + +RSpec.describe PagesController, type: :routing do + describe "routing" do + it "routes to #home" do + expect(:get => "/").to route_to("pages#home") + end + end +end