From ea5cee1d887fe18e55a06431f0f229c28b2220c7 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Thu, 27 Feb 2020 11:32:56 +0000
Subject: [PATCH 01/51] Bump nokogiri from 1.10.5 to 1.10.8
Bumps [nokogiri](https://github.com/sparklemotion/nokogiri) from 1.10.5 to 1.10.8.
- [Release notes](https://github.com/sparklemotion/nokogiri/releases)
- [Changelog](https://github.com/sparklemotion/nokogiri/blob/master/CHANGELOG.md)
- [Commits](https://github.com/sparklemotion/nokogiri/compare/v1.10.5...v1.10.8)
Signed-off-by: dependabot[bot]
---
Gemfile.lock | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Gemfile.lock b/Gemfile.lock
index 1c0f8f1e..8a72efd2 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -133,7 +133,7 @@ GEM
multi_json (1.14.1)
multi_test (0.1.2)
nio4r (2.5.2)
- nokogiri (1.10.5)
+ nokogiri (1.10.8)
mini_portile2 (~> 2.4.0)
orm_adapter (0.5.0)
pg (1.1.4)
From 19ead50285f3c657c4a9b7cf174341537eb26c20 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Sat, 6 Jun 2020 04:42:08 +0000
Subject: [PATCH 02/51] Bump websocket-extensions from 0.1.4 to 0.1.5
Bumps [websocket-extensions](https://github.com/faye/websocket-extensions-ruby) from 0.1.4 to 0.1.5.
- [Release notes](https://github.com/faye/websocket-extensions-ruby/releases)
- [Changelog](https://github.com/faye/websocket-extensions-ruby/blob/master/CHANGELOG.md)
- [Commits](https://github.com/faye/websocket-extensions-ruby/compare/0.1.4...0.1.5)
Signed-off-by: dependabot[bot]
---
Gemfile.lock | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Gemfile.lock b/Gemfile.lock
index 1c0f8f1e..81ec2551 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -243,7 +243,7 @@ GEM
selenium-webdriver (>= 3.0, < 4.0)
websocket-driver (0.7.1)
websocket-extensions (>= 0.1.0)
- websocket-extensions (0.1.4)
+ websocket-extensions (0.1.5)
xpath (3.2.0)
nokogiri (~> 1.8)
From cd08b95a52a82784738a5fc9b2e0fab5f365fb00 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Thu, 25 Jun 2020 08:18:53 +0000
Subject: [PATCH 03/51] Bump rack from 2.0.7 to 2.2.3
Bumps [rack](https://github.com/rack/rack) from 2.0.7 to 2.2.3.
- [Release notes](https://github.com/rack/rack/releases)
- [Changelog](https://github.com/rack/rack/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rack/rack/compare/2.0.7...2.2.3)
Signed-off-by: dependabot[bot]
---
Gemfile.lock | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Gemfile.lock b/Gemfile.lock
index 1c0f8f1e..a40c3067 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -139,7 +139,7 @@ GEM
pg (1.1.4)
public_suffix (4.0.1)
puma (3.12.1)
- rack (2.0.7)
+ rack (2.2.3)
rack-test (1.1.0)
rack (>= 1.0, < 3)
rails (5.2.3)
From 8d75616c5d7c45032a2a95c1cdf5ea17318f46f7 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Thu, 24 Sep 2020 17:04:51 +0000
Subject: [PATCH 04/51] Bump puma from 3.12.1 to 3.12.6
Bumps [puma](https://github.com/puma/puma) from 3.12.1 to 3.12.6.
- [Release notes](https://github.com/puma/puma/releases)
- [Changelog](https://github.com/puma/puma/blob/master/History.md)
- [Commits](https://github.com/puma/puma/compare/v3.12.1...v3.12.6)
Signed-off-by: dependabot[bot]
---
Gemfile | 2 +-
Gemfile.lock | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/Gemfile b/Gemfile
index d034287e..54be0f4e 100644
--- a/Gemfile
+++ b/Gemfile
@@ -8,7 +8,7 @@ gem 'rails', '~> 5.2.3'
# Use postgresql as the database for Active Record
gem 'pg', '>= 0.18', '< 2.0'
# Use Puma as the app server
-gem 'puma', '~> 3.11'
+gem 'puma', '~> 3.12'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
diff --git a/Gemfile.lock b/Gemfile.lock
index a40c3067..48b22748 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -138,7 +138,7 @@ GEM
orm_adapter (0.5.0)
pg (1.1.4)
public_suffix (4.0.1)
- puma (3.12.1)
+ puma (3.12.6)
rack (2.2.3)
rack-test (1.1.0)
rack (>= 1.0, < 3)
@@ -261,7 +261,7 @@ DEPENDENCIES
jbuilder (~> 2.5)
listen (>= 3.0.5, < 3.2)
pg (>= 0.18, < 2.0)
- puma (~> 3.11)
+ puma (~> 3.12)
rails (~> 5.2.3)
rspec-rails
sass-rails (~> 5.0)
From 14bfca1c8a33f7416fd27c1c7fb319af70ef9810 Mon Sep 17 00:00:00 2001
From: kdusousa
Date: Wed, 28 Oct 2020 13:35:55 -0300
Subject: [PATCH 05/51] Create sprint_1-Grupo_1.md
---
sprint_1-Grupo_1.md | 38 ++++++++++++++++++++++++++++++++++++++
1 file changed, 38 insertions(+)
create mode 100644 sprint_1-Grupo_1.md
diff --git a/sprint_1-Grupo_1.md b/sprint_1-Grupo_1.md
new file mode 100644
index 00000000..1aca4c44
--- /dev/null
+++ b/sprint_1-Grupo_1.md
@@ -0,0 +1,38 @@
+# GRUPO 1
+
+* Carlos Eduardo de Sousa - 160057701
+* Edilton Costa Alves - 170002365
+* Eduardo Vaz Fagundes Rech - 180075161
+* Estevam Galvão Albuquerque - 160005663
+* Kalley Wilkerson Rodrigues Alexandre - 170038050
+
+
+## NOME DO PROJETO
+#### TEXTO
+
+## ESCOPO DO PROJETO
+* Teste para cadastro de atividade e seu prazo de execução;
+* Teste para inclusão de pessoas interessadas em cada atividade;
+* Teste para notificação de pessoas interessadas;
+* Teste para visualização de atividades cadastradas;
+* Teste para visualização de atividades de interesse.
+
+
+## ATRIBUIÇÕES
+### Scrum Master
+#### Kalley Wilkerson Rodrigues Alexandre - 170038050
+
+### Product Owner
+#### Edilton Costa Alves - 170002365
+
+### Arquivo Markdown
+#### Carlos Eduardo de Sousa - 160057701
+
+### Funcionalidades desenvolvidas, regras de negócio e responsáveis para cada funcionalidade.
+####texto
+
+### Pontuação das histórias de usuários.
+
+
+
+
From 395e30cb62f824a93dcbc72ee9d04e77a6319d30 Mon Sep 17 00:00:00 2001
From: Kalley Wilkerson
Date: Wed, 28 Oct 2020 15:07:23 -0300
Subject: [PATCH 06/51] Adicionados primeiros testes com cucumber de capybara
---
features/addAtividade.feature | 16 ++++++++++++++++
features/step_definitions/atividade_steps.rb | 19 +++++++++++++++++++
2 files changed, 35 insertions(+)
create mode 100644 features/addAtividade.feature
create mode 100644 features/step_definitions/atividade_steps.rb
diff --git a/features/addAtividade.feature b/features/addAtividade.feature
new file mode 100644
index 00000000..383f63e9
--- /dev/null
+++ b/features/addAtividade.feature
@@ -0,0 +1,16 @@
+#language: pt
+
+Funcionalidade: Usuário pode adicionar uma atividade
+
+ Como um administrador, para que eu tenha controle das atividades,
+ eu gostaria de cadastrar uma nova atividade e seu prazo de execução
+
+Cenário: Adicionar atividade de teste
+ Dado que eu estou na página "Atividades"
+ Quando eu clico em "Nova atividade"
+ Então eu devo ser redirecionado para "Cadastrar nova atividade"
+ Quando eu preencho o campo "Nome" com "Teste"
+ E eu preencho o campo "Prazo de execução" com "Apr 30 1999"
+ E eu clico em "Salvar"
+ Então eu devo ser redirecionado para "Atividades"
+ E eu devo ver "Atividade cadastrada com sucesso"
diff --git a/features/step_definitions/atividade_steps.rb b/features/step_definitions/atividade_steps.rb
new file mode 100644
index 00000000..3ee77581
--- /dev/null
+++ b/features/step_definitions/atividade_steps.rb
@@ -0,0 +1,19 @@
+Dado("que eu estou na página {string}") do |string|
+ visit "localhost:3000/#{string.downcase}"
+ end
+
+ Quando("eu clico em {string}") do |string|
+ click_on string
+ end
+
+ Então("eu devo ser redirecionado para {string}") do |string|
+ visit "localhost:3000/#{string.downcase}"
+ end
+
+ Quando("eu preencho o campo {string} com {string}") do |string, string2|
+ fill_in string, with: string2
+ end
+
+ Então("eu devo ver {string}") do |string|
+ expect(page).to have_content string
+ end
\ No newline at end of file
From 355a0fa630d857c23a9e96c039a330dfdf285abf Mon Sep 17 00:00:00 2001
From: MrJamesX37 <47198738+MrJamesX37@users.noreply.github.com>
Date: Wed, 28 Oct 2020 17:54:30 -0300
Subject: [PATCH 07/51] Adicionado primeiros testes da issue #37
---
features/add_person_on_a_activite.feature | 11 +++++++++++
.../add_person_on_activite_steps.rb | 15 +++++++++++++++
2 files changed, 26 insertions(+)
create mode 100644 features/add_person_on_a_activite.feature
create mode 100644 features/step_definitions/add_person_on_activite_steps.rb
diff --git a/features/add_person_on_a_activite.feature b/features/add_person_on_a_activite.feature
new file mode 100644
index 00000000..20a65812
--- /dev/null
+++ b/features/add_person_on_a_activite.feature
@@ -0,0 +1,11 @@
+#language: pt
+
+Funcionalidade: Usuário pode adicionar pessoa interessada em uma atividade
+
+ Como um administrador, para que eu possa informar a comunidade, eu gostaria de adicionar pessoas interessadas em cada atividade
+
+Cenário: Adicionar pessoa em atividade
+ Dado que estou na página "Atividades"
+ Quando eu clico em "Adicionar pessoa interessada"
+ Então eu devo ser redirecionado para "Atividades"
+ E eu devo ver "Pessoa adicionada à atividade com sucesso"
\ No newline at end of file
diff --git a/features/step_definitions/add_person_on_activite_steps.rb b/features/step_definitions/add_person_on_activite_steps.rb
new file mode 100644
index 00000000..1db6195d
--- /dev/null
+++ b/features/step_definitions/add_person_on_activite_steps.rb
@@ -0,0 +1,15 @@
+Dado("que estou na página {string}") do |string|
+ visit "localhost:3000/#{string.downcase}"
+end
+
+Quando("eu clico em {string}") do |string|
+ click_on string
+end
+
+Então("eu devo ser redirecionado para {string}") do |string|
+ visit "localhost:3000/#{string.downcase}"
+end
+
+E("eu devo ver {string}") do |string|
+ expect(page).to have_content string
+end
\ No newline at end of file
From 0886ecfa9f47a8698b4df0fa42479e03d8297d52 Mon Sep 17 00:00:00 2001
From: MrJamesX37 <47198738+MrJamesX37@users.noreply.github.com>
Date: Wed, 28 Oct 2020 18:59:29 -0300
Subject: [PATCH 08/51] Update nos testes
---
features/addPersonOnActivite.feature | 11 +++++++++++
.../step_definitions/addPersonOnActivite_steps.rb | 15 +++++++++++++++
2 files changed, 26 insertions(+)
create mode 100644 features/addPersonOnActivite.feature
create mode 100644 features/step_definitions/addPersonOnActivite_steps.rb
diff --git a/features/addPersonOnActivite.feature b/features/addPersonOnActivite.feature
new file mode 100644
index 00000000..20a65812
--- /dev/null
+++ b/features/addPersonOnActivite.feature
@@ -0,0 +1,11 @@
+#language: pt
+
+Funcionalidade: Usuário pode adicionar pessoa interessada em uma atividade
+
+ Como um administrador, para que eu possa informar a comunidade, eu gostaria de adicionar pessoas interessadas em cada atividade
+
+Cenário: Adicionar pessoa em atividade
+ Dado que estou na página "Atividades"
+ Quando eu clico em "Adicionar pessoa interessada"
+ Então eu devo ser redirecionado para "Atividades"
+ E eu devo ver "Pessoa adicionada à atividade com sucesso"
\ No newline at end of file
diff --git a/features/step_definitions/addPersonOnActivite_steps.rb b/features/step_definitions/addPersonOnActivite_steps.rb
new file mode 100644
index 00000000..1db6195d
--- /dev/null
+++ b/features/step_definitions/addPersonOnActivite_steps.rb
@@ -0,0 +1,15 @@
+Dado("que estou na página {string}") do |string|
+ visit "localhost:3000/#{string.downcase}"
+end
+
+Quando("eu clico em {string}") do |string|
+ click_on string
+end
+
+Então("eu devo ser redirecionado para {string}") do |string|
+ visit "localhost:3000/#{string.downcase}"
+end
+
+E("eu devo ver {string}") do |string|
+ expect(page).to have_content string
+end
\ No newline at end of file
From 9a1e9cf26eea97453a81216f4c5738d6b3115468 Mon Sep 17 00:00:00 2001
From: MrJamesX37 <47198738+MrJamesX37@users.noreply.github.com>
Date: Wed, 28 Oct 2020 19:00:05 -0300
Subject: [PATCH 09/51] Delete add_person_on_activite_steps.rb
---
.../add_person_on_activite_steps.rb | 15 ---------------
1 file changed, 15 deletions(-)
delete mode 100644 features/step_definitions/add_person_on_activite_steps.rb
diff --git a/features/step_definitions/add_person_on_activite_steps.rb b/features/step_definitions/add_person_on_activite_steps.rb
deleted file mode 100644
index 1db6195d..00000000
--- a/features/step_definitions/add_person_on_activite_steps.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-Dado("que estou na página {string}") do |string|
- visit "localhost:3000/#{string.downcase}"
-end
-
-Quando("eu clico em {string}") do |string|
- click_on string
-end
-
-Então("eu devo ser redirecionado para {string}") do |string|
- visit "localhost:3000/#{string.downcase}"
-end
-
-E("eu devo ver {string}") do |string|
- expect(page).to have_content string
-end
\ No newline at end of file
From edce627cd638c6469a7d357621d8c54e2f2f8f8e Mon Sep 17 00:00:00 2001
From: MrJamesX37 <47198738+MrJamesX37@users.noreply.github.com>
Date: Wed, 28 Oct 2020 19:00:18 -0300
Subject: [PATCH 10/51] Delete add_person_on_a_activite.feature
---
features/add_person_on_a_activite.feature | 11 -----------
1 file changed, 11 deletions(-)
delete mode 100644 features/add_person_on_a_activite.feature
diff --git a/features/add_person_on_a_activite.feature b/features/add_person_on_a_activite.feature
deleted file mode 100644
index 20a65812..00000000
--- a/features/add_person_on_a_activite.feature
+++ /dev/null
@@ -1,11 +0,0 @@
-#language: pt
-
-Funcionalidade: Usuário pode adicionar pessoa interessada em uma atividade
-
- Como um administrador, para que eu possa informar a comunidade, eu gostaria de adicionar pessoas interessadas em cada atividade
-
-Cenário: Adicionar pessoa em atividade
- Dado que estou na página "Atividades"
- Quando eu clico em "Adicionar pessoa interessada"
- Então eu devo ser redirecionado para "Atividades"
- E eu devo ver "Pessoa adicionada à atividade com sucesso"
\ No newline at end of file
From be323ed5710b87ff74d4dc79370f296ee9d2c11b Mon Sep 17 00:00:00 2001
From: MrJamesX37 <47198738+MrJamesX37@users.noreply.github.com>
Date: Wed, 28 Oct 2020 19:02:58 -0300
Subject: [PATCH 11/51] Update nos testes da issue #37
---
features/step_definitions/addPersonOnActivite_steps.rb | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/features/step_definitions/addPersonOnActivite_steps.rb b/features/step_definitions/addPersonOnActivite_steps.rb
index 1db6195d..83f2e68e 100644
--- a/features/step_definitions/addPersonOnActivite_steps.rb
+++ b/features/step_definitions/addPersonOnActivite_steps.rb
@@ -1,5 +1,5 @@
Dado("que estou na página {string}") do |string|
- visit "localhost:3000/#{string.downcase}"
+ redirect_to "localhost:3000/#{string.downcase}"
end
Quando("eu clico em {string}") do |string|
@@ -7,7 +7,7 @@
end
Então("eu devo ser redirecionado para {string}") do |string|
- visit "localhost:3000/#{string.downcase}"
+ redirect_to "localhost:3000/#{string.downcase}"
end
E("eu devo ver {string}") do |string|
From bf5f0bc109705a89da0a3366669d8165ed8a6b3a Mon Sep 17 00:00:00 2001
From: MrJamesX37 <47198738+MrJamesX37@users.noreply.github.com>
Date: Thu, 29 Oct 2020 09:36:32 -0300
Subject: [PATCH 12/51] =?UTF-8?q?Criado=20cen=C3=A1rio=20feliz=20e=20trist?=
=?UTF-8?q?e?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
features/addPersonOnActivite.feature | 19 ++++++++++++++-----
.../addPersonOnActivite_steps.rb | 3 +++
2 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/features/addPersonOnActivite.feature b/features/addPersonOnActivite.feature
index 20a65812..6a968175 100644
--- a/features/addPersonOnActivite.feature
+++ b/features/addPersonOnActivite.feature
@@ -4,8 +4,17 @@ Funcionalidade: Usuário pode adicionar pessoa interessada em uma atividade
Como um administrador, para que eu possa informar a comunidade, eu gostaria de adicionar pessoas interessadas em cada atividade
-Cenário: Adicionar pessoa em atividade
- Dado que estou na página "Atividades"
- Quando eu clico em "Adicionar pessoa interessada"
- Então eu devo ser redirecionado para "Atividades"
- E eu devo ver "Pessoa adicionada à atividade com sucesso"
\ No newline at end of file
+ # Cenário Feliz
+ Cenário: Adicionar pessoa em atividade
+ Dado que estou na página "Atividades"
+ Quando eu clico em "Adicionar pessoa interessada"
+ Então eu devo ser redirecionado para "Atividades"
+ E eu devo ver "Pessoa adicionada à atividade com sucesso"
+
+ # Cenário Triste
+ Cenário: Adicionar pessoa já cadastrada em atividade
+ Dado que estou na página "Atividades"
+ Quando eu clico em "Adicionar pessoa interessada"
+ E essa pessoa já está cadastrada nessa atividade
+ Então eu devo ser redirecionado para "Atividades"
+ E eu devo ver "Pessoa já está nessa atividade"
\ No newline at end of file
diff --git a/features/step_definitions/addPersonOnActivite_steps.rb b/features/step_definitions/addPersonOnActivite_steps.rb
index 83f2e68e..8b72da80 100644
--- a/features/step_definitions/addPersonOnActivite_steps.rb
+++ b/features/step_definitions/addPersonOnActivite_steps.rb
@@ -12,4 +12,7 @@
E("eu devo ver {string}") do |string|
expect(page).to have_content string
+end
+
+E("essa pessoa já está cadastrada nessa atividade") do |string|
end
\ No newline at end of file
From 884583975ba1736c92917bd50fe4dbefbbcf7124 Mon Sep 17 00:00:00 2001
From: MrJamesX37 <47198738+MrJamesX37@users.noreply.github.com>
Date: Thu, 29 Oct 2020 12:21:45 -0300
Subject: [PATCH 13/51] =?UTF-8?q?Adicionado=20testes=20unit=C3=A1rios=20da?=
=?UTF-8?q?=20issue=20#37?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
features/addPersonOnActivite.feature | 14 +-
.../addPersonOnActivite_steps.rb | 11 +-
spec/addPersonOnActivite_spec.rb | 19 ++
spec/spec_helper.rb | 196 +++++++++---------
4 files changed, 133 insertions(+), 107 deletions(-)
create mode 100644 spec/addPersonOnActivite_spec.rb
diff --git a/features/addPersonOnActivite.feature b/features/addPersonOnActivite.feature
index 6a968175..d9233035 100644
--- a/features/addPersonOnActivite.feature
+++ b/features/addPersonOnActivite.feature
@@ -7,14 +7,16 @@ Funcionalidade: Usuário pode adicionar pessoa interessada em uma atividade
# Cenário Feliz
Cenário: Adicionar pessoa em atividade
Dado que estou na página "Atividades"
- Quando eu clico em "Adicionar pessoa interessada"
+ Quando eu clico em "Adicionar integrante"
+ Então eu devo ser redirecionado para "Cadastrar_novo_integrante"
+ Quando preencho o campo "Nome" com "Teste"
+ E preencho o campo "Email" com "teste@teste"
Então eu devo ser redirecionado para "Atividades"
E eu devo ver "Pessoa adicionada à atividade com sucesso"
- # Cenário Triste
- Cenário: Adicionar pessoa já cadastrada em atividade
+ #Cenário Triste
+ Cenário: Página não encontrada
Dado que estou na página "Atividades"
Quando eu clico em "Adicionar pessoa interessada"
- E essa pessoa já está cadastrada nessa atividade
- Então eu devo ser redirecionado para "Atividades"
- E eu devo ver "Pessoa já está nessa atividade"
\ No newline at end of file
+ Então eu devo ser redirecionado para "404"
+ E eu devo ver "Página não encontrada"
\ No newline at end of file
diff --git a/features/step_definitions/addPersonOnActivite_steps.rb b/features/step_definitions/addPersonOnActivite_steps.rb
index 8b72da80..90ca5e27 100644
--- a/features/step_definitions/addPersonOnActivite_steps.rb
+++ b/features/step_definitions/addPersonOnActivite_steps.rb
@@ -1,5 +1,5 @@
Dado("que estou na página {string}") do |string|
- redirect_to "localhost:3000/#{string.downcase}"
+ visit "localhost:3000/#{string.downcase}"
end
Quando("eu clico em {string}") do |string|
@@ -7,12 +7,13 @@
end
Então("eu devo ser redirecionado para {string}") do |string|
- redirect_to "localhost:3000/#{string.downcase}"
+ visit "localhost:3000/#{string.downcase}"
end
+Quando("preencho o campo {string} com {string}") do |string1, string2|
+ fill_in string1, with: string2
+end
+
E("eu devo ver {string}") do |string|
expect(page).to have_content string
-end
-
-E("essa pessoa já está cadastrada nessa atividade") do |string|
end
\ No newline at end of file
diff --git a/spec/addPersonOnActivite_spec.rb b/spec/addPersonOnActivite_spec.rb
new file mode 100644
index 00000000..221a23a4
--- /dev/null
+++ b/spec/addPersonOnActivite_spec.rb
@@ -0,0 +1,19 @@
+require 'rails_helper'
+
+RSpec.describe ".addPersonOnActivite" do
+ let(:uri) {'/Atividades'}
+
+ context "Adicionar pessoa em atividade" do
+ let(:person) {Activite.addPerson("Teste", "teste@teste")}
+
+ it "Mostra menssagem" do
+ page.driver.get uri
+ except(page.status_code).to be 200
+ is_expected.to have "Pessoa adicionada com sucesso"
+ end
+ end
+
+ context "Quando não encontrado" do
+ it {is_expected.to equal 404}
+ end
+end
\ No newline at end of file
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index ce33d66d..2ad573e7 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -1,96 +1,100 @@
-# This file was generated by the `rails generate rspec:install` command. Conventionally, all
-# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
-# The generated `.rspec` file contains `--require spec_helper` which will cause
-# this file to always be loaded, without a need to explicitly require it in any
-# files.
-#
-# Given that it is always loaded, you are encouraged to keep this file as
-# light-weight as possible. Requiring heavyweight dependencies from this file
-# will add to the boot time of your test suite on EVERY test run, even for an
-# individual file that may not need all of that loaded. Instead, consider making
-# a separate helper file that requires the additional dependencies and performs
-# the additional setup, and require it from the spec files that actually need
-# it.
-#
-# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
-RSpec.configure do |config|
- # rspec-expectations config goes here. You can use an alternate
- # assertion/expectation library such as wrong or the stdlib/minitest
- # assertions if you prefer.
- config.expect_with :rspec do |expectations|
- # This option will default to `true` in RSpec 4. It makes the `description`
- # and `failure_message` of custom matchers include text for helper methods
- # defined using `chain`, e.g.:
- # be_bigger_than(2).and_smaller_than(4).description
- # # => "be bigger than 2 and smaller than 4"
- # ...rather than:
- # # => "be bigger than 2"
- expectations.include_chain_clauses_in_custom_matcher_descriptions = true
- end
-
- # rspec-mocks config goes here. You can use an alternate test double
- # library (such as bogus or mocha) by changing the `mock_with` option here.
- config.mock_with :rspec do |mocks|
- # Prevents you from mocking or stubbing a method that does not exist on
- # a real object. This is generally recommended, and will default to
- # `true` in RSpec 4.
- mocks.verify_partial_doubles = true
- end
-
- # This option will default to `:apply_to_host_groups` in RSpec 4 (and will
- # have no way to turn it off -- the option exists only for backwards
- # compatibility in RSpec 3). It causes shared context metadata to be
- # inherited by the metadata hash of host groups and examples, rather than
- # triggering implicit auto-inclusion in groups with matching metadata.
- config.shared_context_metadata_behavior = :apply_to_host_groups
-
-# The settings below are suggested to provide a good initial experience
-# with RSpec, but feel free to customize to your heart's content.
-=begin
- # This allows you to limit a spec run to individual examples or groups
- # you care about by tagging them with `:focus` metadata. When nothing
- # is tagged with `:focus`, all examples get run. RSpec also provides
- # aliases for `it`, `describe`, and `context` that include `:focus`
- # metadata: `fit`, `fdescribe` and `fcontext`, respectively.
- config.filter_run_when_matching :focus
-
- # Allows RSpec to persist some state between runs in order to support
- # the `--only-failures` and `--next-failure` CLI options. We recommend
- # you configure your source control system to ignore this file.
- config.example_status_persistence_file_path = "spec/examples.txt"
-
- # Limits the available syntax to the non-monkey patched syntax that is
- # recommended. For more details, see:
- # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
- # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
- # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
- config.disable_monkey_patching!
-
- # Many RSpec users commonly either run the entire suite or an individual
- # file, and it's useful to allow more verbose output when running an
- # individual spec file.
- if config.files_to_run.one?
- # Use the documentation formatter for detailed output,
- # unless a formatter has already been configured
- # (e.g. via a command-line flag).
- config.default_formatter = "doc"
- end
-
- # Print the 10 slowest examples and example groups at the
- # end of the spec run, to help surface which specs are running
- # particularly slow.
- config.profile_examples = 10
-
- # Run specs in random order to surface order dependencies. If you find an
- # order dependency and want to debug it, you can fix the order by providing
- # the seed, which is printed after each run.
- # --seed 1234
- config.order = :random
-
- # Seed global randomization in this process using the `--seed` CLI option.
- # Setting this allows you to use `--seed` to deterministically reproduce
- # test failures related to randomization by passing the same `--seed` value
- # as the one that triggered the failure.
- Kernel.srand config.seed
-=end
-end
+# This file was generated by the `rails generate rspec:install` command. Conventionally, all
+# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
+# The generated `.rspec` file contains `--require spec_helper` which will cause
+# this file to always be loaded, without a need to explicitly require it in any
+# files.
+#
+# Given that it is always loaded, you are encouraged to keep this file as
+# light-weight as possible. Requiring heavyweight dependencies from this file
+# will add to the boot time of your test suite on EVERY test run, even for an
+# individual file that may not need all of that loaded. Instead, consider making
+# a separate helper file that requires the additional dependencies and performs
+# the additional setup, and require it from the spec files that actually need
+# it.
+#
+# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
+RSpec.configure do |config|
+ # rspec-expectations config goes here. You can use an alternate
+ # assertion/expectation library such as wrong or the stdlib/minitest
+ # assertions if you prefer.
+ config.expect_with :rspec do |expectations|
+ # This option will default to `true` in RSpec 4. It makes the `description`
+ # and `failure_message` of custom matchers include text for helper methods
+ # defined using `chain`, e.g.:
+ # be_bigger_than(2).and_smaller_than(4).description
+ # # => "be bigger than 2 and smaller than 4"
+ # ...rather than:
+ # # => "be bigger than 2"
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
+ end
+
+ # rspec-mocks config goes here. You can use an alternate test double
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
+ config.mock_with :rspec do |mocks|
+ # Prevents you from mocking or stubbing a method that does not exist on
+ # a real object. This is generally recommended, and will default to
+ # `true` in RSpec 4.
+ mocks.verify_partial_doubles = true
+ end
+
+ # This option will default to `:apply_to_host_groups` in RSpec 4 (and will
+ # have no way to turn it off -- the option exists only for backwards
+ # compatibility in RSpec 3). It causes shared context metadata to be
+ # inherited by the metadata hash of host groups and examples, rather than
+ # triggering implicit auto-inclusion in groups with matching metadata.
+ config.shared_context_metadata_behavior = :apply_to_host_groups
+
+# The settings below are suggested to provide a good initial experience
+# with RSpec, but feel free to customize to your heart's content.
+=begin
+ # This allows you to limit a spec run to individual examples or groups
+ # you care about by tagging them with `:focus` metadata. When nothing
+ # is tagged with `:focus`, all examples get run. RSpec also provides
+ # aliases for `it`, `describe`, and `context` that include `:focus`
+ # metadata: `fit`, `fdescribe` and `fcontext`, respectively.
+ config.filter_run_when_matching :focus
+
+ # Allows RSpec to persist some state between runs in order to support
+ # the `--only-failures` and `--next-failure` CLI options. We recommend
+ # you configure your source control system to ignore this file.
+ config.example_status_persistence_file_path = "spec/examples.txt"
+
+ # Limits the available syntax to the non-monkey patched syntax that is
+ # recommended. For more details, see:
+ # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
+ # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
+ # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
+ config.disable_monkey_patching!
+
+ # This setting enables warnings. It's recommended, but in some cases may
+ # be too noisy due to issues in dependencies.
+ config.warnings = true
+
+ # Many RSpec users commonly either run the entire suite or an individual
+ # file, and it's useful to allow more verbose output when running an
+ # individual spec file.
+ if config.files_to_run.one?
+ # Use the documentation formatter for detailed output,
+ # unless a formatter has already been configured
+ # (e.g. via a command-line flag).
+ config.default_formatter = "doc"
+ end
+
+ # Print the 10 slowest examples and example groups at the
+ # end of the spec run, to help surface which specs are running
+ # particularly slow.
+ config.profile_examples = 10
+
+ # Run specs in random order to surface order dependencies. If you find an
+ # order dependency and want to debug it, you can fix the order by providing
+ # the seed, which is printed after each run.
+ # --seed 1234
+ config.order = :random
+
+ # Seed global randomization in this process using the `--seed` CLI option.
+ # Setting this allows you to use `--seed` to deterministically reproduce
+ # test failures related to randomization by passing the same `--seed` value
+ # as the one that triggered the failure.
+ Kernel.srand config.seed
+=end
+end
From 68db7508ac4fb301cdbf773c11959f3e10e3d950 Mon Sep 17 00:00:00 2001
From: Kalley Wilkerson
Date: Fri, 30 Oct 2020 08:58:55 -0300
Subject: [PATCH 14/51] =?UTF-8?q?Adicionados=20alguns=20testes=20e=20espec?=
=?UTF-8?q?ifica=C3=A7=C3=B5es=20de=20testes=20simples=20N=C3=A3o=20criei?=
=?UTF-8?q?=20com=20mais=20detalhes=20quanto=20ao=20controlador=20pois=20e?=
=?UTF-8?q?le=20ainda=20n=C3=A3o=20existe=20e=20essa=20sprint=20era=20apen?=
=?UTF-8?q?as=20para=20especificar=20os=20testes?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
...dAtividade.feature => addActivity.feature} | 12 ++++++++++--
...tividade_steps.rb => addActivity_steps.rb} | 0
.../controllers/activities_controller_spec.rb | 19 +++++++++++++++++++
3 files changed, 29 insertions(+), 2 deletions(-)
rename features/{addAtividade.feature => addActivity.feature} (54%)
rename features/step_definitions/{atividade_steps.rb => addActivity_steps.rb} (100%)
create mode 100644 spec/controllers/activities_controller_spec.rb
diff --git a/features/addAtividade.feature b/features/addActivity.feature
similarity index 54%
rename from features/addAtividade.feature
rename to features/addActivity.feature
index 383f63e9..fedd6cdd 100644
--- a/features/addAtividade.feature
+++ b/features/addActivity.feature
@@ -5,12 +5,20 @@ Funcionalidade: Usuário pode adicionar uma atividade
Como um administrador, para que eu tenha controle das atividades,
eu gostaria de cadastrar uma nova atividade e seu prazo de execução
-Cenário: Adicionar atividade de teste
+Cenário: Adicionar atividade de teste com sucesso
Dado que eu estou na página "Atividades"
Quando eu clico em "Nova atividade"
Então eu devo ser redirecionado para "Cadastrar nova atividade"
- Quando eu preencho o campo "Nome" com "Teste"
+ Quando eu preencho o campo "Título'" com "Teste"
E eu preencho o campo "Prazo de execução" com "Apr 30 1999"
E eu clico em "Salvar"
Então eu devo ser redirecionado para "Atividades"
E eu devo ver "Atividade cadastrada com sucesso"
+
+Cenário: Adicionar atividade de teste sem sucesso
+ Dado que eu estou na página "Atividades"
+ Quando eu clico em "Nova atividade"
+ Então eu devo ser redirecionado para "Cadastrar nova atividade"
+ Quando eu preencho o campo "Título" com "Teste 2"
+ E eu clico em "Salvar"
+ Então eu devo ver "O prazo de execução da atividade deve ser informado"
\ No newline at end of file
diff --git a/features/step_definitions/atividade_steps.rb b/features/step_definitions/addActivity_steps.rb
similarity index 100%
rename from features/step_definitions/atividade_steps.rb
rename to features/step_definitions/addActivity_steps.rb
diff --git a/spec/controllers/activities_controller_spec.rb b/spec/controllers/activities_controller_spec.rb
new file mode 100644
index 00000000..35049308
--- /dev/null
+++ b/spec/controllers/activities_controller_spec.rb
@@ -0,0 +1,19 @@
+require 'rails_helper'
+
+describe 'ActivitiesController' do
+ describe 'add a new Activity' do
+ it 'should call the model method that add a new Activity to the database' do
+ post :create, {}
+ end
+
+ it 'should give a success message after an activity is successfuly added' do
+ post :create, {}
+ expect(response).to have_http_status(:success)
+ end
+
+ it 'should give an error message if create is called without params' do
+ post :create
+ expect(response).to have_http_status(:error)
+ end
+ end
+end
\ No newline at end of file
From 957daa94f72b0b39ce23449b58f00d84fbcdec77 Mon Sep 17 00:00:00 2001
From: kdusousa
Date: Fri, 30 Oct 2020 10:05:18 -0300
Subject: [PATCH 15/51] Create showInterestActivity
---
features/showInterestActivity | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)
create mode 100644 features/showInterestActivity
diff --git a/features/showInterestActivity b/features/showInterestActivity
new file mode 100644
index 00000000..604fbff7
--- /dev/null
+++ b/features/showInterestActivity
@@ -0,0 +1,32 @@
+#language: en
+
+#Como um usuário, para que eu possa me informar,
+#eu gostaria de ver as atividades que eu demonstrei interesse #40
+
+Feature: User actions
+ To use calendar
+ As a system user
+ I would like to see interests activities
+
+ Background: User logged in
+ Given I am on the sign up page
+ And I fill in 'email' with 'student@student.com'
+ And I fill in 'full_name' with 'alunao'
+ Then 'student' should be an option for 'role'
+ And I fill in 'password' with 'admin123'
+ And I fill in 'password_confirmation' with 'admin123'
+ When I press 'Sign up'
+ Then I should be on 'root_path' page
+
+
+ Scenario: See Calendar page
+ When I press 'Calendar'
+ Then I should be on 'calendar' page
+ When I check 'Mostrar apenas minhas atividades de interesse'
+ Then I should see on 'calendar' page only 'interests activities'
+
+ Scenario: See Activities page
+ When I press 'Atividades'
+ Then I should be on 'activities' page
+ When I press 'Filtrar por Interesse'
+ Then I should be on 'activities' page
From b05191e872513726f9c1e2a0484308512cff702d Mon Sep 17 00:00:00 2001
From: kdusousa
Date: Fri, 30 Oct 2020 10:05:39 -0300
Subject: [PATCH 16/51] Rename showInterestActivity to
showInterestActivity.feature
---
features/{showInterestActivity => showInterestActivity.feature} | 0
1 file changed, 0 insertions(+), 0 deletions(-)
rename features/{showInterestActivity => showInterestActivity.feature} (100%)
diff --git a/features/showInterestActivity b/features/showInterestActivity.feature
similarity index 100%
rename from features/showInterestActivity
rename to features/showInterestActivity.feature
From b8555746dce5f23216c693446a1e6a700633c2fa Mon Sep 17 00:00:00 2001
From: kdusousa
Date: Fri, 30 Oct 2020 10:34:08 -0300
Subject: [PATCH 17/51] Create showInterestActivity_steps.rb
---
.../showInterestActivity_steps.rb | 52 +++++++++++++++++++
1 file changed, 52 insertions(+)
create mode 100644 features/step_definitions/showInterestActivity_steps.rb
diff --git a/features/step_definitions/showInterestActivity_steps.rb b/features/step_definitions/showInterestActivity_steps.rb
new file mode 100644
index 00000000..cf1b192a
--- /dev/null
+++ b/features/step_definitions/showInterestActivity_steps.rb
@@ -0,0 +1,52 @@
+Given("I am on the {string} page") do |string|
+ visit "localhost:3000/#{string.downcase}"
+ end
+
+ And("I fill in 'email' with {string}") do |string|
+ fill_in string
+ end
+
+ And("I fill in 'password' with {string}") do |string|
+ fill_in string
+ end
+
+ When("I press {button}") do |button|
+ click_on(button)
+ end
+
+ Then("I should be on {string}") do |string|
+ visit "localhost:3000"
+ end
+
+
+ When("I press {button}") do |button|
+ click_on(button)
+ end
+
+ Then("I should be on {string}") do |string|
+ visit "localhost:3000/#{string.downcase}"
+ end
+
+ When("I check {box}") do |box|
+ check(box)
+ end
+
+ Then("I should see on 'calendar' page only {string}") do |string|
+ visit "localhost:3000/calendar//#{string.downcase}"
+ end
+
+ When("I press {button}") do |button|
+ click_on(button)
+ end
+
+ Then("I should be on {string}") do |string|
+ visit "localhost:3000/#{string.downcase}"
+ end
+
+ When("I press {button}") do |button|
+ click_on(button)
+ end
+
+ Then("I should be on {string}") do |string|
+ visit "localhost:3000/activities"
+ end
From 2236e52e129fb3eddacb6f66d54a4bb1c222f7d2 Mon Sep 17 00:00:00 2001
From: kdusousa
Date: Fri, 30 Oct 2020 10:34:49 -0300
Subject: [PATCH 18/51] Update showInterestActivity.feature
---
features/showInterestActivity.feature | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/features/showInterestActivity.feature b/features/showInterestActivity.feature
index 604fbff7..3ffd0f55 100644
--- a/features/showInterestActivity.feature
+++ b/features/showInterestActivity.feature
@@ -9,13 +9,10 @@ Feature: User actions
I would like to see interests activities
Background: User logged in
- Given I am on the sign up page
+ Given I am on the 'users/sign_in' page
And I fill in 'email' with 'student@student.com'
- And I fill in 'full_name' with 'alunao'
- Then 'student' should be an option for 'role'
And I fill in 'password' with 'admin123'
- And I fill in 'password_confirmation' with 'admin123'
- When I press 'Sign up'
+ When I press 'Log in'
Then I should be on 'root_path' page
From 3c9e22ef7436133b340545dff6ae947d69113d39 Mon Sep 17 00:00:00 2001
From: kdusousa
Date: Fri, 30 Oct 2020 10:45:39 -0300
Subject: [PATCH 19/51] Create showInterestActivities_spec.rb
---
spec/showInterestActivities_spec.rb | 15 +++++++++++++++
1 file changed, 15 insertions(+)
create mode 100644 spec/showInterestActivities_spec.rb
diff --git a/spec/showInterestActivities_spec.rb b/spec/showInterestActivities_spec.rb
new file mode 100644
index 00000000..e5c300fd
--- /dev/null
+++ b/spec/showInterestActivities_spec.rb
@@ -0,0 +1,15 @@
+require 'rails_helper'
+
+RSpec.describe ".showInterestActivities" do
+ let(:uri) {'/Calendar'}
+
+ context "Mostrar atividades de interesse" do
+ let(:activities) {showInterestActivities}
+
+ it "Mostra menssagem" do
+ page.driver.get uri
+ except(page.status_code).to be 200
+ is_expected.to have "localhost:3000/Calendar"
+ end
+ end
+end
From a7a64210a4193b7088f6a8e6eecd35d7a2ccee1a Mon Sep 17 00:00:00 2001
From: kdusousa
Date: Fri, 30 Oct 2020 10:55:06 -0300
Subject: [PATCH 20/51] Update sprint_1-Grupo_1.md
---
sprint_1-Grupo_1.md | 23 +++++++++++++++++++----
1 file changed, 19 insertions(+), 4 deletions(-)
diff --git a/sprint_1-Grupo_1.md b/sprint_1-Grupo_1.md
index 1aca4c44..40e8779b 100644
--- a/sprint_1-Grupo_1.md
+++ b/sprint_1-Grupo_1.md
@@ -8,7 +8,7 @@
## NOME DO PROJETO
-#### TEXTO
+#### Calendário de atividades - secretaria-ppgi
## ESCOPO DO PROJETO
* Teste para cadastro de atividade e seu prazo de execução;
@@ -28,10 +28,25 @@
### Arquivo Markdown
#### Carlos Eduardo de Sousa - 160057701
-### Funcionalidades desenvolvidas, regras de negócio e responsáveis para cada funcionalidade.
-####texto
+### Funcionalidades desenvolvidas, regras de negócio e responsáveis para cada funcionalidade e Pontuação das histórias de usuários.
+.
+#### 36 (Pontuação: 1) - Como um administrador, para que eu tenha controle das atividades, eu gostaria de cadastrar uma nova atividade e seu prazo de execução
+#### Responsável - Kalley Wilkerson Rodrigues Alexandre - 170038050
+
+#### 37 (Pontuação: 2) - Como um administrador, para que eu possa informar a comunidade, eu gostaria de adicionar pessoas interessadas em cada atividade
+#### Responsável - Eduardo Vaz Fagundes Rech - 180075161
+
+#### 38 (Pontuação: 2) - Como um administrador, para que eu possa notificar as pessoas interessadas em alguma atividade, eu gostaria de notificar as pessoas interessadas
+#### Responsável - Estevam Galvão Albuquerque - 160005663
+
+#### 39 (Pontuação: 1) - Como um usuário, para que eu possa me informar, eu gostaria de ver as atividades cadastradas
+#### Responsável - Edilton Costa Alves - 170002365
+
+#### 40 (Pontuação: 2) - Como um usuário, para que eu possa me informar, eu gostaria de ver as atividades que eu demonstrei interesse
+#### Responsável - Carlos Eduardo de Sousa - 160057701
+
+
-### Pontuação das histórias de usuários.
From 4bc4927c822957fdb83177f541a8f0ea3d69fa05 Mon Sep 17 00:00:00 2001
From: Estevam Albuquerque
Date: Sat, 31 Oct 2020 05:16:37 -0300
Subject: [PATCH 21/51] features and step_definitions issue 38
---
features/notifyInterestedPeople.feature | 26 +++++++++++
.../notifyInterestedPeople_step.rb | 45 +++++++++++++++++++
2 files changed, 71 insertions(+)
create mode 100644 features/notifyInterestedPeople.feature
create mode 100644 features/step_definitions/notifyInterestedPeople_step.rb
diff --git a/features/notifyInterestedPeople.feature b/features/notifyInterestedPeople.feature
new file mode 100644
index 00000000..4a1273c1
--- /dev/null
+++ b/features/notifyInterestedPeople.feature
@@ -0,0 +1,26 @@
+#language: pt
+
+Funcionalidade: Administrador notificar as pessoas interessadas
+
+ Como um administrador,
+ Para que eu possa notificar as pessoas interessadas em alguma atividade,
+ Eu gostaria de notificar as pessoas interessadas
+
+ Background: Administrador está logado
+ Dado que estou na página "users/sign_in"
+ E preencho o campo "Email" com "admin@admin.com"
+ E preencho o campo "Password" com "admin123"
+ Quando pressiono "Log in"
+ Então eu devo ser redirecionado para "root_path"
+
+ Cenário: Notificar pessoas interessadas
+ Dado que estou na página "Atividades"
+ Quando pressiono "Notificar integrantes"
+ Então eu devo ser redirecionado para "Notificar_integrantes_selecionados"
+ Quando preencho o campo "Integrantes interessados" com os "Estudantes"
+ E pressiono "Enviar notificação"
+ Então eu devo ver "Notificação enviada aos interessados com sucesso"
+
+#estou contando que "Atividades" seja a página home de administração
+
+
diff --git a/features/step_definitions/notifyInterestedPeople_step.rb b/features/step_definitions/notifyInterestedPeople_step.rb
new file mode 100644
index 00000000..f337e2ec
--- /dev/null
+++ b/features/step_definitions/notifyInterestedPeople_step.rb
@@ -0,0 +1,45 @@
+#Background
+Dado("que eu estou na página {string}") do |string|
+ visit "localhost:3000/#{string.downcase}"
+end
+
+E("preencho o campo {string} com {string}") do |string1, string2|
+ fill_in string1, with: string2
+end
+
+E("preencho o campo {string} com {string}") do |string1, string2|
+ fill_in string1, with: string2
+end
+
+Quando("pressiono {button}") do |button|
+ click_on(button)
+end
+
+Então("eu devo ser redirecionado para {string}") do |string|
+ visit "localhost:3000/#{string.downcase}"
+end
+
+#Cenário
+Dado("que eu estou na página {string}") do |string|
+ visit "localhost:3000/#{string.downcase}"
+end
+
+Quando("pressiono {button}") do |button|
+ click_on(button)
+end
+
+Então("eu devo ser redirecionado para {string}") do |string|
+ visit "localhost:3000/#{string.downcase}"
+end
+
+Quando("preencho o campo {string} com {string}") do |string1, string2|
+ fill_in string1, with: string2
+end
+
+E("pressiono {button}") do |button|
+ click_on(button)
+end
+
+Então("eu devo ver {string}") do |string|
+ expect(page).to have_content string
+end
\ No newline at end of file
From 7ee14fd025a7736b9d05e40b84bd6d2371963713 Mon Sep 17 00:00:00 2001
From: Estevam Albuquerque
Date: Sun, 1 Nov 2020 20:49:40 -0300
Subject: [PATCH 22/51] adjustments and rspec file
---
features/notifyInterestedPeople.feature | 9 +++++++++
.../notifyInterestedPeople_step.rb | 19 ++++++++++++++++++-
spec/notifyInterestedPeople_spec.rb | 19 +++++++++++++++++++
3 files changed, 46 insertions(+), 1 deletion(-)
create mode 100644 spec/notifyInterestedPeople_spec.rb
diff --git a/features/notifyInterestedPeople.feature b/features/notifyInterestedPeople.feature
index 4a1273c1..4dc84a40 100644
--- a/features/notifyInterestedPeople.feature
+++ b/features/notifyInterestedPeople.feature
@@ -6,6 +6,7 @@ Funcionalidade: Administrador notificar as pessoas interessadas
Para que eu possa notificar as pessoas interessadas em alguma atividade,
Eu gostaria de notificar as pessoas interessadas
+ #Pré-requisito
Background: Administrador está logado
Dado que estou na página "users/sign_in"
E preencho o campo "Email" com "admin@admin.com"
@@ -13,6 +14,7 @@ Funcionalidade: Administrador notificar as pessoas interessadas
Quando pressiono "Log in"
Então eu devo ser redirecionado para "root_path"
+ #Cenário feliz
Cenário: Notificar pessoas interessadas
Dado que estou na página "Atividades"
Quando pressiono "Notificar integrantes"
@@ -21,6 +23,13 @@ Funcionalidade: Administrador notificar as pessoas interessadas
E pressiono "Enviar notificação"
Então eu devo ver "Notificação enviada aos interessados com sucesso"
+ #Cenário triste
+ Cenário: Página não encontrada
+ Dado que estou na página "Atividades"
+ Quando pressiono "Notificar integrantes"
+ Então eu devo ser redirecionado para "404"
+ E eu devo ver "Página não encontrada"
+
#estou contando que "Atividades" seja a página home de administração
diff --git a/features/step_definitions/notifyInterestedPeople_step.rb b/features/step_definitions/notifyInterestedPeople_step.rb
index f337e2ec..8ae2ebb1 100644
--- a/features/step_definitions/notifyInterestedPeople_step.rb
+++ b/features/step_definitions/notifyInterestedPeople_step.rb
@@ -19,7 +19,7 @@
visit "localhost:3000/#{string.downcase}"
end
-#Cenário
+#Cenário feliz
Dado("que eu estou na página {string}") do |string|
visit "localhost:3000/#{string.downcase}"
end
@@ -40,6 +40,23 @@
click_on(button)
end
+Então("eu devo ver {string}") do |string|
+ expect(page).to have_content string
+end
+
+#Cenário triste
+Dado("que eu estou na página {string}") do |string|
+ visit "localhost:3000/#{string.downcase}"
+end
+
+Quando("pressiono {button}") do |button|
+ click_on(button)
+end
+
+Então("eu devo ser redirecionado para {string}") do |string|
+ visit "localhost:3000/#{string.downcase}"
+end
+
Então("eu devo ver {string}") do |string|
expect(page).to have_content string
end
\ No newline at end of file
diff --git a/spec/notifyInterestedPeople_spec.rb b/spec/notifyInterestedPeople_spec.rb
new file mode 100644
index 00000000..a64ab365
--- /dev/null
+++ b/spec/notifyInterestedPeople_spec.rb
@@ -0,0 +1,19 @@
+require 'rails_helper'
+
+RSpec.describe ".notifyInterestedPeople" do
+ let(:uri) {'/Atividades'}
+
+ context "Notificar pessoas interessadas" do
+ let(:admin) {Activite.selectInterestedPeople("Estudantes")}
+
+ it "Mostrar mensagem" do
+ page.driver.get uri
+ except(page.status_code).to be 200
+ is_expected.to have "Notificação enviada aos interessados com sucesso"
+ end
+ end
+
+ context "Página não encontrada" do
+ it {is_expected.to equal 404}
+ end
+end
From 1fa1d66a53f8c7641e4cf53e61c40ebef32c63a6 Mon Sep 17 00:00:00 2001
From: Kalley Wilkerson
Date: Tue, 10 Nov 2020 14:55:15 -0300
Subject: [PATCH 23/51] =?UTF-8?q?Concertando=20erros=20que=20estavam=20dan?=
=?UTF-8?q?do=20no=20Cucumber=20Os=20steps=20do=20Cucubmer=20n=C3=A3o=20re?=
=?UTF-8?q?conhecem=20tipos=20de=20par=C3=A2metro=20'button'=20ou=20'box',?=
=?UTF-8?q?=20por=20isso=20tava=20dando=20erro=20aqui?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../notifyInterestedPeople_step.rb | 16 +++++++--------
.../showInterestActivity_steps.rb | 20 +++++++++----------
2 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/features/step_definitions/notifyInterestedPeople_step.rb b/features/step_definitions/notifyInterestedPeople_step.rb
index 8ae2ebb1..63ab3be3 100644
--- a/features/step_definitions/notifyInterestedPeople_step.rb
+++ b/features/step_definitions/notifyInterestedPeople_step.rb
@@ -11,8 +11,8 @@
fill_in string1, with: string2
end
-Quando("pressiono {button}") do |button|
- click_on(button)
+Quando("pressiono {string}") do |string|
+ click_on(string)
end
Então("eu devo ser redirecionado para {string}") do |string|
@@ -24,8 +24,8 @@
visit "localhost:3000/#{string.downcase}"
end
-Quando("pressiono {button}") do |button|
- click_on(button)
+Quando("pressiono {string}") do |string|
+ click_on(string)
end
Então("eu devo ser redirecionado para {string}") do |string|
@@ -36,8 +36,8 @@
fill_in string1, with: string2
end
-E("pressiono {button}") do |button|
- click_on(button)
+E("pressiono {string}") do |string|
+ click_on(string)
end
Então("eu devo ver {string}") do |string|
@@ -49,8 +49,8 @@
visit "localhost:3000/#{string.downcase}"
end
-Quando("pressiono {button}") do |button|
- click_on(button)
+Quando("pressiono {string}") do |string|
+ click_on(string)
end
Então("eu devo ser redirecionado para {string}") do |string|
diff --git a/features/step_definitions/showInterestActivity_steps.rb b/features/step_definitions/showInterestActivity_steps.rb
index cf1b192a..04636119 100644
--- a/features/step_definitions/showInterestActivity_steps.rb
+++ b/features/step_definitions/showInterestActivity_steps.rb
@@ -10,8 +10,8 @@
fill_in string
end
- When("I press {button}") do |button|
- click_on(button)
+ When("I press {string}") do |string|
+ click_on(string)
end
Then("I should be on {string}") do |string|
@@ -19,32 +19,32 @@
end
- When("I press {button}") do |button|
- click_on(button)
+ When("I press {string}") do |string|
+ click_on(string)
end
Then("I should be on {string}") do |string|
visit "localhost:3000/#{string.downcase}"
end
- When("I check {box}") do |box|
- check(box)
+ When("I check {string}") do |string|
+ check(string)
end
Then("I should see on 'calendar' page only {string}") do |string|
visit "localhost:3000/calendar//#{string.downcase}"
end
- When("I press {button}") do |button|
- click_on(button)
+ When("I press {string}") do |string|
+ click_on(string)
end
Then("I should be on {string}") do |string|
visit "localhost:3000/#{string.downcase}"
end
- When("I press {button}") do |button|
- click_on(button)
+ When("I press {string}") do |string|
+ click_on(string)
end
Then("I should be on {string}") do |string|
From f0a25eaec1e0ce23fa9e582d83ebc6542a9d3132 Mon Sep 17 00:00:00 2001
From: Kalley Wilkerson
Date: Tue, 10 Nov 2020 15:56:46 -0300
Subject: [PATCH 24/51] Adicionar nova atividade - passando nos primeiros
testes
---
app/controllers/activities_controller.rb | 5 +++
app/models/activity.rb | 2 ++
app/views/activities/index.html.erb | 16 ++++++++++
config/routes.rb | 3 ++
.../20201110171424_create_activities.rb | 12 +++++++
db/schema.rb | 11 ++++++-
features/addActivity.feature | 30 +++++++++--------
.../step_definitions/addActivity_steps.rb | 32 ++++++++++++-------
spec/models/activity_spec.rb | 5 +++
9 files changed, 89 insertions(+), 27 deletions(-)
create mode 100644 app/controllers/activities_controller.rb
create mode 100644 app/models/activity.rb
create mode 100644 app/views/activities/index.html.erb
create mode 100644 db/migrate/20201110171424_create_activities.rb
create mode 100644 spec/models/activity_spec.rb
diff --git a/app/controllers/activities_controller.rb b/app/controllers/activities_controller.rb
new file mode 100644
index 00000000..aa1434aa
--- /dev/null
+++ b/app/controllers/activities_controller.rb
@@ -0,0 +1,5 @@
+class ActivitiesController < ApplicationController
+ def index
+ @activities = Activity.all
+ end
+end
\ No newline at end of file
diff --git a/app/models/activity.rb b/app/models/activity.rb
new file mode 100644
index 00000000..a99f990d
--- /dev/null
+++ b/app/models/activity.rb
@@ -0,0 +1,2 @@
+class Activity < ApplicationRecord
+end
diff --git a/app/views/activities/index.html.erb b/app/views/activities/index.html.erb
new file mode 100644
index 00000000..85bcbd45
--- /dev/null
+++ b/app/views/activities/index.html.erb
@@ -0,0 +1,16 @@
+Atividades
+
+
+
+ | Título |
+ Descrição |
+ |
+
+
+ <% @activities.each do |activity| %>
+
+ | <%= activity.title %> |
+ <%= activity.description %> |
+
+ <% end %>
+
\ No newline at end of file
diff --git a/config/routes.rb b/config/routes.rb
index f33f7f68..9cbad12b 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -3,6 +3,9 @@
Rails.application.routes.draw do
get 'home/index'
devise_for :users
+
+ resources :activities
+
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
root to: 'home#index'
end
diff --git a/db/migrate/20201110171424_create_activities.rb b/db/migrate/20201110171424_create_activities.rb
new file mode 100644
index 00000000..ec0c09ad
--- /dev/null
+++ b/db/migrate/20201110171424_create_activities.rb
@@ -0,0 +1,12 @@
+class CreateActivities < ActiveRecord::Migration[5.2]
+ def change
+ create_table :activities do |t|
+ t.string :title
+ t.string :description
+ t.date :due_date
+ t.binary :documents
+
+ t.timestamps
+ end
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 96d61d72..eeb561ed 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -10,11 +10,20 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema.define(version: 2019_11_14_163205) do
+ActiveRecord::Schema.define(version: 2020_11_10_171424) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
+ create_table "activities", force: :cascade do |t|
+ t.string "title"
+ t.string "description"
+ t.date "due_date"
+ t.binary "documents"
+ t.datetime "created_at", null: false
+ t.datetime "updated_at", null: false
+ end
+
create_table "users", force: :cascade do |t|
t.string "email", default: "", null: false
t.string "encrypted_password", default: "", null: false
diff --git a/features/addActivity.feature b/features/addActivity.feature
index fedd6cdd..ed0191c1 100644
--- a/features/addActivity.feature
+++ b/features/addActivity.feature
@@ -6,19 +6,21 @@ Funcionalidade: Usuário pode adicionar uma atividade
eu gostaria de cadastrar uma nova atividade e seu prazo de execução
Cenário: Adicionar atividade de teste com sucesso
- Dado que eu estou na página "Atividades"
- Quando eu clico em "Nova atividade"
- Então eu devo ser redirecionado para "Cadastrar nova atividade"
- Quando eu preencho o campo "Título'" com "Teste"
- E eu preencho o campo "Prazo de execução" com "Apr 30 1999"
- E eu clico em "Salvar"
- Então eu devo ser redirecionado para "Atividades"
- E eu devo ver "Atividade cadastrada com sucesso"
+ Dado que estou logado com usuário "admin@admin.com" e senha "admin123"
+ Dado que estou em "activities"
+ Quando clico em "Nova atividade"
+ Então devo ser redirecionado para "Cadastrar nova atividade"
+ Quando preencho o campo "Título'" com "Teste"
+ E preencho o campo "Prazo de execução" com "Apr 30 1999"
+ E clico em "Salvar"
+ Então devo ser redirecionado para "Atividades"
+ E devo ver "Atividade cadastrada com sucesso"
Cenário: Adicionar atividade de teste sem sucesso
- Dado que eu estou na página "Atividades"
- Quando eu clico em "Nova atividade"
- Então eu devo ser redirecionado para "Cadastrar nova atividade"
- Quando eu preencho o campo "Título" com "Teste 2"
- E eu clico em "Salvar"
- Então eu devo ver "O prazo de execução da atividade deve ser informado"
\ No newline at end of file
+ Dado que estou logado com usuário "admin@admin.com" e senha "admin123"
+ Dado que estou em "activities"
+ Quando clico em "Nova atividade"
+ Então devo ser redirecionado para "Cadastrar nova atividade"
+ Quando preencho o campo "Título" com "Teste 2"
+ E clico em "Salvar"
+ Então devo ver "O prazo de execução da atividade deve ser informado"
\ No newline at end of file
diff --git a/features/step_definitions/addActivity_steps.rb b/features/step_definitions/addActivity_steps.rb
index 3ee77581..c80bd4c0 100644
--- a/features/step_definitions/addActivity_steps.rb
+++ b/features/step_definitions/addActivity_steps.rb
@@ -1,19 +1,27 @@
-Dado("que eu estou na página {string}") do |string|
- visit "localhost:3000/#{string.downcase}"
- end
+Dado("que estou logado com usuário {string} e senha {string}") do |string, string2|
+ visit '/'
+ click_on 'Entrar'
+ fill_in 'Email', with: string
+ fill_in 'Password', with: string2
+ click_on 'Log in'
+end
+
+Dado("que estou em {string}") do |string|
+ visit "/#{string.downcase}"
+end
- Quando("eu clico em {string}") do |string|
+ Quando("clico em {string}") do |string|
click_on string
- end
+end
- Então("eu devo ser redirecionado para {string}") do |string|
- visit "localhost:3000/#{string.downcase}"
- end
+ Então("devo ser redirecionado para {string}") do |string|
+ visit "/#{string.downcase}"
+end
- Quando("eu preencho o campo {string} com {string}") do |string, string2|
+ Quando("preencho o campo {string} com {string}") do |string, string2|
fill_in string, with: string2
- end
+end
- Então("eu devo ver {string}") do |string|
+ Então("devo ver {string}") do |string|
expect(page).to have_content string
- end
\ No newline at end of file
+end
\ No newline at end of file
diff --git a/spec/models/activity_spec.rb b/spec/models/activity_spec.rb
new file mode 100644
index 00000000..b80b07e7
--- /dev/null
+++ b/spec/models/activity_spec.rb
@@ -0,0 +1,5 @@
+require 'rails_helper'
+
+RSpec.describe Activity, type: :model do
+ pending "add some examples to (or delete) #{__FILE__}"
+end
From c8d32637f0738921e4d39413c518659c925745b8 Mon Sep 17 00:00:00 2001
From: Kalley Wilkerson
Date: Tue, 10 Nov 2020 21:34:20 -0300
Subject: [PATCH 25/51] Fazendo todos os testes passar
---
app/controllers/activities_controller.rb | 22 +++++++++++++++++++
app/models/activity.rb | 2 ++
app/views/activities/index.html.erb | 4 ++++
app/views/activities/new.html.erb | 17 ++++++++++++++
.../20201110171424_create_activities.rb | 2 +-
db/schema.rb | 2 +-
features/addActivity.feature | 20 ++++++++---------
.../step_definitions/addActivity_steps.rb | 14 +++++++-----
8 files changed, 66 insertions(+), 17 deletions(-)
create mode 100644 app/views/activities/new.html.erb
diff --git a/app/controllers/activities_controller.rb b/app/controllers/activities_controller.rb
index aa1434aa..62456b82 100644
--- a/app/controllers/activities_controller.rb
+++ b/app/controllers/activities_controller.rb
@@ -2,4 +2,26 @@ class ActivitiesController < ApplicationController
def index
@activities = Activity.all
end
+
+ def new
+ end
+
+ def create
+ @activity = Activity.new(activity_params)
+ if @activity.save
+ flash[:notice] = "Atividade cadastrada com sucesso."
+ redirect_to activities_path
+ elsif @activity.errors.any?
+ flash[:notice] = ["Atividade não cadastrada."]
+ @activity.errors.each do |attribute, message|
+ flash[:notice] << message
+ end
+ redirect_back(fallback_location: root_path)
+ end
+ end
+
+ private
+ def activity_params
+ params.require(:activity).permit(:title, :due_date)
+ end
end
\ No newline at end of file
diff --git a/app/models/activity.rb b/app/models/activity.rb
index a99f990d..0944d131 100644
--- a/app/models/activity.rb
+++ b/app/models/activity.rb
@@ -1,2 +1,4 @@
class Activity < ApplicationRecord
+ validates :title, presence: { message: "O Nome da atividade deve ser informado." }
+ validates :due_date, presence: { message: "O Prazo de execução da atividade deve ser informado." }
end
diff --git a/app/views/activities/index.html.erb b/app/views/activities/index.html.erb
index 85bcbd45..c45001d5 100644
--- a/app/views/activities/index.html.erb
+++ b/app/views/activities/index.html.erb
@@ -1,8 +1,11 @@
Atividades
+
+<%= link_to 'Adicionar atividade', new_activity_path %>
| Título |
+ Prazo de execução |
Descrição |
|
@@ -10,6 +13,7 @@
<% @activities.each do |activity| %>
| <%= activity.title %> |
+ <%= activity.due_date %> |
<%= activity.description %> |
<% end %>
diff --git a/app/views/activities/new.html.erb b/app/views/activities/new.html.erb
new file mode 100644
index 00000000..b306de82
--- /dev/null
+++ b/app/views/activities/new.html.erb
@@ -0,0 +1,17 @@
+Cadastrar nova atividade
+
+<%= form_with scope: :activity, url: activities_path,local: true do |form| %>
+
+ <%= form.label :title, "Nome da atividade" %>
+ <%= form.text_field :title %>
+
+
+
+ <%= form.label :due_date, "Prazo de execução" %>
+ <%= form.date_field :due_date %>
+
+
+
+ <%= form.submit "Salvar" %>
+
+<% end %>
\ No newline at end of file
diff --git a/db/migrate/20201110171424_create_activities.rb b/db/migrate/20201110171424_create_activities.rb
index ec0c09ad..087a6c9e 100644
--- a/db/migrate/20201110171424_create_activities.rb
+++ b/db/migrate/20201110171424_create_activities.rb
@@ -1,7 +1,7 @@
class CreateActivities < ActiveRecord::Migration[5.2]
def change
create_table :activities do |t|
- t.string :title
+ t.string :title, null: false
t.string :description
t.date :due_date
t.binary :documents
diff --git a/db/schema.rb b/db/schema.rb
index eeb561ed..daeefa2a 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -16,7 +16,7 @@
enable_extension "plpgsql"
create_table "activities", force: :cascade do |t|
- t.string "title"
+ t.string "title", null: false
t.string "description"
t.date "due_date"
t.binary "documents"
diff --git a/features/addActivity.feature b/features/addActivity.feature
index ed0191c1..106f032d 100644
--- a/features/addActivity.feature
+++ b/features/addActivity.feature
@@ -8,19 +8,19 @@ Funcionalidade: Usuário pode adicionar uma atividade
Cenário: Adicionar atividade de teste com sucesso
Dado que estou logado com usuário "admin@admin.com" e senha "admin123"
Dado que estou em "activities"
- Quando clico em "Nova atividade"
- Então devo ser redirecionado para "Cadastrar nova atividade"
- Quando preencho o campo "Título'" com "Teste"
- E preencho o campo "Prazo de execução" com "Apr 30 1999"
+ Quando clico em "Adicionar atividade"
+ Então devo ser redirecionado para "activities/new"
+ E devo ver "Cadastrar nova atividade"
+ Quando preencho "Nome da atividade" com o valor "Teste"
+ E preencho "Prazo de execução" com a data "30/04/1999"
E clico em "Salvar"
- Então devo ser redirecionado para "Atividades"
- E devo ver "Atividade cadastrada com sucesso"
+ E devo ver "Atividade cadastrada com sucesso."
Cenário: Adicionar atividade de teste sem sucesso
Dado que estou logado com usuário "admin@admin.com" e senha "admin123"
Dado que estou em "activities"
- Quando clico em "Nova atividade"
- Então devo ser redirecionado para "Cadastrar nova atividade"
- Quando preencho o campo "Título" com "Teste 2"
+ Quando clico em "Adicionar atividade"
+ Então devo ser redirecionado para "activities/new"
+ Quando preencho "Nome da atividade" com o valor "Teste 2"
E clico em "Salvar"
- Então devo ver "O prazo de execução da atividade deve ser informado"
\ No newline at end of file
+ Então devo ver "O Prazo de execução da atividade deve ser informado."
\ No newline at end of file
diff --git a/features/step_definitions/addActivity_steps.rb b/features/step_definitions/addActivity_steps.rb
index c80bd4c0..8c1cf564 100644
--- a/features/step_definitions/addActivity_steps.rb
+++ b/features/step_definitions/addActivity_steps.rb
@@ -9,19 +9,23 @@
Dado("que estou em {string}") do |string|
visit "/#{string.downcase}"
end
-
- Quando("clico em {string}") do |string|
+
+Quando("clico em {string}") do |string|
click_on string
end
- Então("devo ser redirecionado para {string}") do |string|
+Então("devo ser redirecionado para {string}") do |string|
visit "/#{string.downcase}"
end
- Quando("preencho o campo {string} com {string}") do |string, string2|
+Quando("preencho {string} com o valor {string}") do |string, string2|
+ fill_in string, with: string2
+end
+
+Quando("preencho {string} com a data {string}") do |string, string2|
fill_in string, with: string2
end
- Então("devo ver {string}") do |string|
+Então("devo ver {string}") do |string|
expect(page).to have_content string
end
\ No newline at end of file
From 53e4d61e2525ed6b3345c59d7198f4d5a515d468 Mon Sep 17 00:00:00 2001
From: kdusousa
Date: Fri, 13 Nov 2020 11:24:34 -0300
Subject: [PATCH 26/51] Update showInterestActivity.feature
---
features/showInterestActivity.feature | 21 ++++++++++-----------
1 file changed, 10 insertions(+), 11 deletions(-)
diff --git a/features/showInterestActivity.feature b/features/showInterestActivity.feature
index 3ffd0f55..6d98a45e 100644
--- a/features/showInterestActivity.feature
+++ b/features/showInterestActivity.feature
@@ -9,21 +9,20 @@ Feature: User actions
I would like to see interests activities
Background: User logged in
- Given I am on the 'users/sign_in' page
+ Given I am on the '/' page and clik on 'Entrar'
And I fill in 'email' with 'student@student.com'
And I fill in 'password' with 'admin123'
When I press 'Log in'
- Then I should be on 'root_path' page
+ Then I should be on '/'
+
+ Scenario: See Activities page
+ Given I am on the 'activities' page
+ When I check 'teste aluno'
+ And I press 'Marcar interesse'
+ Then I should be on 'activities' page
-
Scenario: See Calendar page
- When I press 'Calendar'
- Then I should be on 'calendar' page
+ Given I am on the 'activities' page
When I check 'Mostrar apenas minhas atividades de interesse'
- Then I should see on 'calendar' page only 'interests activities'
+ Then I should see on 'activities' page only 'interests activities'
- Scenario: See Activities page
- When I press 'Atividades'
- Then I should be on 'activities' page
- When I press 'Filtrar por Interesse'
- Then I should be on 'activities' page
From ed355038510114a6dfccbe46acdd96721d078de8 Mon Sep 17 00:00:00 2001
From: kdusousa
Date: Fri, 13 Nov 2020 11:25:29 -0300
Subject: [PATCH 27/51] Update showInterestActivity_steps.rb
---
.../showInterestActivity_steps.rb | 78 ++++++++-----------
1 file changed, 31 insertions(+), 47 deletions(-)
diff --git a/features/step_definitions/showInterestActivity_steps.rb b/features/step_definitions/showInterestActivity_steps.rb
index 04636119..8e67c675 100644
--- a/features/step_definitions/showInterestActivity_steps.rb
+++ b/features/step_definitions/showInterestActivity_steps.rb
@@ -1,52 +1,36 @@
-Given("I am on the {string} page") do |string|
- visit "localhost:3000/#{string.downcase}"
- end
-
- And("I fill in 'email' with {string}") do |string|
- fill_in string
- end
-
- And("I fill in 'password' with {string}") do |string|
- fill_in string
- end
-
- When("I press {string}") do |string|
- click_on(string)
- end
+Given("I am on the {string} page and clik on {string}") do |string1, string2|
+ visit string1
+ click_on string2
+ end
+
+And("I fill in 'email' with {string}") do |string|
+ fill_in 'Email', with: string
+end
+
+And("I fill in 'password' with {string}") do |string|
+ fill_in 'Password', with: string
+end
+
+And("I press {string}") do |string|
+ click_on string
+end
- Then("I should be on {string}") do |string|
- visit "localhost:3000"
- end
-
-
- When("I press {string}") do |string|
- click_on(string)
- end
-
- Then("I should be on {string}") do |string|
+Then("I should be on {string}") do |string|
+ visit "/"
+end
+
+Given("I am on the {string} page") do |string|
+ visit string
+end
+
+Then("I should be on {string} page") do |string|
visit "localhost:3000/#{string.downcase}"
- end
+end
- When("I check {string}") do |string|
- check(string)
- end
+When("I check {string}") do |string|
+ check string
+end
- Then("I should see on 'calendar' page only {string}") do |string|
- visit "localhost:3000/calendar//#{string.downcase}"
- end
-
- When("I press {string}") do |string|
- click_on(string)
- end
-
- Then("I should be on {string}") do |string|
+Then("I should see on 'calendar' page only {string}") do |string|
visit "localhost:3000/#{string.downcase}"
- end
-
- When("I press {string}") do |string|
- click_on(string)
- end
-
- Then("I should be on {string}") do |string|
- visit "localhost:3000/activities"
- end
+end
From 6f43467d2cf28c888b013c6e21d43362ef17465d Mon Sep 17 00:00:00 2001
From: Kalley Wilkerson
Date: Fri, 13 Nov 2020 13:07:43 -0300
Subject: [PATCH 28/51] =?UTF-8?q?Fazendo=20os=20testes=20no=20rspec=20pass?=
=?UTF-8?q?arem=20Algumas=20gemas=20foram=20adicionadas=20pois=20forma=20n?=
=?UTF-8?q?ecess=C3=A1rias=20para=20fazer=20factory=20ou=20para=20que=20o?=
=?UTF-8?q?=20rspec=20funcionasse=20direito?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Gemfile | 4 ++++
app/controllers/activities_controller.rb | 4 ++--
.../controllers/activities_controller_spec.rb | 23 +++++++++++--------
spec/factories.rb | 6 +++++
spec/spec_helper.rb | 2 ++
spec/support/factory_bot.rb | 5 ++++
6 files changed, 32 insertions(+), 12 deletions(-)
create mode 100644 spec/factories.rb
create mode 100644 spec/support/factory_bot.rb
diff --git a/Gemfile b/Gemfile
index 54be0f4e..8cada8c0 100644
--- a/Gemfile
+++ b/Gemfile
@@ -52,6 +52,7 @@ group :development do
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
+ gem 'factory_bot_rails'
end
group :test do
@@ -64,6 +65,9 @@ group :test do
# database_cleaner is not required, but highly recommended
gem 'database_cleaner'
gem 'shoulda-matchers'
+ # Factory
+ gem 'factory_bot_rails'
+ gem 'rails-controller-testing'
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
diff --git a/app/controllers/activities_controller.rb b/app/controllers/activities_controller.rb
index 62456b82..45222232 100644
--- a/app/controllers/activities_controller.rb
+++ b/app/controllers/activities_controller.rb
@@ -16,12 +16,12 @@ def create
@activity.errors.each do |attribute, message|
flash[:notice] << message
end
- redirect_back(fallback_location: root_path)
+ redirect_back(fallback_location: new_activity_path)
end
end
private
def activity_params
- params.require(:activity).permit(:title, :due_date)
+ params.fetch(:activity, {}).permit(:title, :due_date)
end
end
\ No newline at end of file
diff --git a/spec/controllers/activities_controller_spec.rb b/spec/controllers/activities_controller_spec.rb
index 35049308..5b0349d2 100644
--- a/spec/controllers/activities_controller_spec.rb
+++ b/spec/controllers/activities_controller_spec.rb
@@ -1,19 +1,22 @@
require 'rails_helper'
-describe 'ActivitiesController' do
- describe 'add a new Activity' do
- it 'should call the model method that add a new Activity to the database' do
- post :create, {}
+describe ActivitiesController, type: :controller do
+ describe 'create a new Activity' do
+ it 'should call the model method that creates a new Activity' do
+ activity_attrs = attributes_for(:activity)
+ expect {post :create, params: {activity: activity_attrs}}.to change(Activity, :count).by(1)
end
- it 'should give a success message after an activity is successfuly added' do
- post :create, {}
- expect(response).to have_http_status(:success)
+ it 'should go back to the activities page after a successfully addition' do
+ activity_attrs = attributes_for(:activity)
+ post :create, params: {activity: activity_attrs}
+ expect(response).to redirect_to(activities_path)
end
- it 'should give an error message if create is called without params' do
- post :create
- expect(response).to have_http_status(:error)
+ it 'should redirect to the same page when there was an error after adding an activity ' do
+ activity_attrs = attributes_for(:activity, title: "Testing the wrong way", due_date: nil)
+ post :create, params: {activity: activity_attrs}
+ expect(response).to redirect_to(new_activity_path)
end
end
end
\ No newline at end of file
diff --git a/spec/factories.rb b/spec/factories.rb
new file mode 100644
index 00000000..8b8458c0
--- /dev/null
+++ b/spec/factories.rb
@@ -0,0 +1,6 @@
+FactoryBot.define do
+ factory :activity do
+ title {"Testar"}
+ due_date {"30/04/1999"}
+ end
+end
\ No newline at end of file
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 2ad573e7..97f940d7 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -1,3 +1,5 @@
+require 'support/factory_bot'
+
# This file was generated by the `rails generate rspec:install` command. Conventionally, all
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
# The generated `.rspec` file contains `--require spec_helper` which will cause
diff --git a/spec/support/factory_bot.rb b/spec/support/factory_bot.rb
new file mode 100644
index 00000000..72ba14df
--- /dev/null
+++ b/spec/support/factory_bot.rb
@@ -0,0 +1,5 @@
+require 'factory_bot'
+
+RSpec.configure do |config|
+ config.include FactoryBot::Syntax::Methods
+end
\ No newline at end of file
From 7f03f53b1960e969ad7e873b95d365a7be6ff28d Mon Sep 17 00:00:00 2001
From: MrJamesX37 <47198738+MrJamesX37@users.noreply.github.com>
Date: Fri, 13 Nov 2020 22:50:03 -0300
Subject: [PATCH 29/51] =?UTF-8?q?Implementa=C3=A7=C3=A3o=20feita?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/assets/javascripts/user_activities.coffee | 3 +
app/assets/stylesheets/user_activities.scss | 3 +
app/controllers/activities_controller.rb | 21 ++++-
app/controllers/user_activities_controller.rb | 87 +++++++++++++++++++
app/helpers/user_activities_helper.rb | 2 +
app/models/user_activity.rb | 12 +++
app/views/activities/index.html.erb | 13 ++-
app/views/user_activities/edit.html.erb | 35 ++++++++
app/views/user_activities/index.html.erb | 26 ++++++
features/addPersonOnActivite.feature | 2 +
spec/addPersonOnActivite_spec.rb | 2 +-
.../user_activities_controller_spec.rb | 5 ++
spec/helpers/user_activities_helper_spec.rb | 15 ++++
spec/models/user_activity_spec.rb | 5 ++
.../user_activity/index.html.erb_spec.rb | 5 ++
15 files changed, 230 insertions(+), 6 deletions(-)
create mode 100644 app/assets/javascripts/user_activities.coffee
create mode 100644 app/assets/stylesheets/user_activities.scss
create mode 100644 app/controllers/user_activities_controller.rb
create mode 100644 app/helpers/user_activities_helper.rb
create mode 100644 app/models/user_activity.rb
create mode 100644 app/views/user_activities/edit.html.erb
create mode 100644 app/views/user_activities/index.html.erb
create mode 100644 spec/controllers/user_activities_controller_spec.rb
create mode 100644 spec/helpers/user_activities_helper_spec.rb
create mode 100644 spec/models/user_activity_spec.rb
create mode 100644 spec/views/user_activity/index.html.erb_spec.rb
diff --git a/app/assets/javascripts/user_activities.coffee b/app/assets/javascripts/user_activities.coffee
new file mode 100644
index 00000000..24f83d18
--- /dev/null
+++ b/app/assets/javascripts/user_activities.coffee
@@ -0,0 +1,3 @@
+# Place all the behaviors and hooks related to the matching controller here.
+# All this logic will automatically be available in application.js.
+# You can use CoffeeScript in this file: http://coffeescript.org/
diff --git a/app/assets/stylesheets/user_activities.scss b/app/assets/stylesheets/user_activities.scss
new file mode 100644
index 00000000..5d2fe634
--- /dev/null
+++ b/app/assets/stylesheets/user_activities.scss
@@ -0,0 +1,3 @@
+// Place all the styles related to the UserActivities controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
diff --git a/app/controllers/activities_controller.rb b/app/controllers/activities_controller.rb
index 62456b82..4b856d0d 100644
--- a/app/controllers/activities_controller.rb
+++ b/app/controllers/activities_controller.rb
@@ -16,10 +16,29 @@ def create
@activity.errors.each do |attribute, message|
flash[:notice] << message
end
- redirect_back(fallback_location: root_path)
+ redirect_back(fallback_location: root_path)
+ end
+ end
+
+ def destroy
+ @activity = Activity.find(params[:id])
+ if @activity.destroy
+ flash[:notice] = "Atividade deleteda com sucesso."
+ redirect_to activities_path
+ elsif @activity.errors.any?
+ flash[:notice] = ["Não foi possível deletar a Atividade."]
+ @activity.errors.each do |attribute, message|
+ flash[:notice] << message
+ end
+ redirect_back(fallback_location: root_path)
end
end
+ def user_admin?
+ current_user.administrator?
+ end
+ helper_method :user_admin?
+
private
def activity_params
params.require(:activity).permit(:title, :due_date)
diff --git a/app/controllers/user_activities_controller.rb b/app/controllers/user_activities_controller.rb
new file mode 100644
index 00000000..60af0610
--- /dev/null
+++ b/app/controllers/user_activities_controller.rb
@@ -0,0 +1,87 @@
+class UserActivitiesController < ApplicationController
+ def index
+ if user_admin?
+ @user_activities = UserActivity.all
+ else
+ @user_activities = UserActivity.where(user_id: current_user.id)
+ end
+ end
+
+ def new
+ end
+
+ def create
+ @user_activity = UserActivity.new(user_activity_params)
+ if @user_activity.save
+ notify(@user_activity.user_id, @user_activity.activity_id, "cadastrado")
+ redirect_to user_activities_path
+ elsif @user_activity.errors.any?
+ error(@user_activity.user_id, @user_activity.activity_id, "cadastrar")
+ end
+ end
+
+ def self.create(user_id, activity_id)
+ if UserActivity.find_by(user_id: user_id, activity_id: activity_id) == nil
+ @user_activity = UserActivity.new
+ @user_activity.user_id = user_id
+ @user_activity.activity_id = activity_id
+ @user_activity.interested = true
+ @user_activity.active = false
+ @user_activity.save!
+ end
+ end
+
+ def show
+ @user_activity = find
+ end
+
+ def edit
+ @user_activity = find
+ end
+
+ def update
+ @user_activity = find
+ if @user_activity.update(update_user_activity_params)
+ notify(UserActivity.getUser(@user_activity.user_id), UserActivity.getActivity(@user_activity.activity_id), "atualizado")
+ redirect_to user_activities_path
+ elsif @user_activity.errors.any?
+ error(UserActivity.getUser(@user_activity.user_id), UserActivity.getActivity(@user_activity.activity_id), "atualizar")
+ end
+ end
+
+ def destroy
+ @user_activity = find
+ if @user_activity.destroy
+ notify(UserActivity.getUser(@user_activity.user_id), UserActivity.getActivity(@user_activity.activity_id), "deletado")
+ redirect_to user_activities_path
+ elsif @user_activity.errors.any?
+ error(UserActivity.getUser(@user_activity.user_id), UserActivity.getActivity(@user_activity.activity_id), "deletar")
+ end
+ end
+
+ def user_admin?
+ current_user.administrator?
+ end
+ helper_method :user_admin?
+
+ private
+ def user_activity_params
+ params.require(:user_activity).permit(:user_id, :activity_id)
+ end
+
+ def update_user_activity_params
+ params.require(:user_activity).permit(:user_id, :activity_id, :interested, :active)
+ end
+
+ def find
+ UserActivity.find(params[:id])
+ end
+
+ def notify(name, title, msg)
+ flash[:notice] = "#{title} #{msg} de #{name} com sucesso"
+ end
+
+ def error(name, title, msg)
+ flash[:notice] = "Não foi possível #{msg} #{name} de #{title}"
+ end
+end
diff --git a/app/helpers/user_activities_helper.rb b/app/helpers/user_activities_helper.rb
new file mode 100644
index 00000000..e948cfad
--- /dev/null
+++ b/app/helpers/user_activities_helper.rb
@@ -0,0 +1,2 @@
+module UserActivitiesHelper
+end
diff --git a/app/models/user_activity.rb b/app/models/user_activity.rb
new file mode 100644
index 00000000..419a1c6c
--- /dev/null
+++ b/app/models/user_activity.rb
@@ -0,0 +1,12 @@
+class UserActivity < ApplicationRecord
+ validates :user_id, presence: { message: "Usuário deve ser informado." }
+ validates :activity_id, presence: { message: "Atividade deve ser informada." }
+
+ def self.getUser(user_id)
+ User.find_by(id: user_id).full_name
+ end
+
+ def self.getActivity(activity_id)
+ Activity.find_by(id: activity_id).title
+ end
+end
diff --git a/app/views/activities/index.html.erb b/app/views/activities/index.html.erb
index c45001d5..69b3ea61 100644
--- a/app/views/activities/index.html.erb
+++ b/app/views/activities/index.html.erb
@@ -1,7 +1,7 @@
Atividades
-<%= link_to 'Adicionar atividade', new_activity_path %>
-
+<%= link_to 'Adicionar atividade', new_activity_path, style: "#{'display: none' if !user_admin? }" %>
+
| Título |
@@ -13,8 +13,13 @@
<% @activities.each do |activity| %>
| <%= activity.title %> |
- <%= activity.due_date %> |
+ <%= activity.due_date.to_formatted_s(:rfc822) %> |
<%= activity.description %> |
+ <%= check_box_tag(:interest, false, false, :onclick => "UserActivitiesController.create(current_user.id, activity.id);") %> |
+ Demonstrar Interesse |
+ <%= link_to 'Remover Atividade', activity_path(activity), :method => :delete, :confirm => 'Tem certeza ?', style: "#{'display: none' if !user_admin? }" %> |
<% end %>
-
\ No newline at end of file
+
+
+<%= link_to 'Minhas Atividades de interesse', user_activities_path %>
\ No newline at end of file
diff --git a/app/views/user_activities/edit.html.erb b/app/views/user_activities/edit.html.erb
new file mode 100644
index 00000000..4a2261dd
--- /dev/null
+++ b/app/views/user_activities/edit.html.erb
@@ -0,0 +1,35 @@
+ Cadastrar Usúario na Atividade
+
+<%= form_with(model: @user_activity, local: true) do |form| %>
+
+ <%= form.label :user_id, "Id do usupario" %>
+ <%= form.text_field :user_id, value: @user_activity.user_id %>
+
+
+
+ <%= form.label :activity_id, " Id da Atividade" %>
+ <%= form.text_field :activity_id, value: @user_activity.activity_id %>
+
+
+
+ <%= form.label :interested, "Interessado" %>
+ <%= form.radio_button :interested, "True", :checked => true %>
+ <%= form.label :active, "True" %>
+ <%= form.radio_button :interested, "False" %>
+ <%= form.label :active, "False" %>
+
+
+
+ <%= form.label :active, "Cadastrado" %>
+ <%= form.radio_button :active, "True" %>
+ <%= form.label :active, "True" %>
+ <%= form.radio_button :active, "False" %>
+ <%= form.label :active, value: "False" %>
+
+
+
+ <%= form.submit "Salvar" %>
+
+<% end %>
+
+<%= link_to 'Back', user_activities_path %>
\ No newline at end of file
diff --git a/app/views/user_activities/index.html.erb b/app/views/user_activities/index.html.erb
new file mode 100644
index 00000000..9f3898d1
--- /dev/null
+++ b/app/views/user_activities/index.html.erb
@@ -0,0 +1,26 @@
+Minhas Atividades de Interesse
+
+
+
+ | Usuário |
+ Atividade |
+ Interesado |
+ Cadastrado |
+ |
+
+
+ <% @user_activities.each do |user_activity| %>
+
+ | <%= UserActivity.getUser(user_activity.user_id) %> |
+ <%= UserActivity.getActivity(user_activity.activity_id) %> |
+ <%= user_activity.interested %> |
+ <%= user_activity.active %> |
+
+ <%= link_to 'Cadastrar Usuário', edit_user_activity_path(user_activity), style: "#{'display: none' if !user_admin? }" %> |
+
+ <%= link_to 'Remover Interesse', user_activity_path(user_activity), :method => :delete, :confirm => 'Tem certeza ?' %>
+ |
+ <% end %>
+
+
+<%= link_to 'Voltar a Atividades', activities_path %>
\ No newline at end of file
diff --git a/features/addPersonOnActivite.feature b/features/addPersonOnActivite.feature
index d9233035..5c7f1f38 100644
--- a/features/addPersonOnActivite.feature
+++ b/features/addPersonOnActivite.feature
@@ -6,6 +6,7 @@ Funcionalidade: Usuário pode adicionar pessoa interessada em uma atividade
# Cenário Feliz
Cenário: Adicionar pessoa em atividade
+ Dado que estou logado com usuário "admin@admin.com" e senha "admin123"
Dado que estou na página "Atividades"
Quando eu clico em "Adicionar integrante"
Então eu devo ser redirecionado para "Cadastrar_novo_integrante"
@@ -16,6 +17,7 @@ Funcionalidade: Usuário pode adicionar pessoa interessada em uma atividade
#Cenário Triste
Cenário: Página não encontrada
+ Dado que estou logado com usuário "admin@admin.com" e senha "admin123"
Dado que estou na página "Atividades"
Quando eu clico em "Adicionar pessoa interessada"
Então eu devo ser redirecionado para "404"
diff --git a/spec/addPersonOnActivite_spec.rb b/spec/addPersonOnActivite_spec.rb
index 221a23a4..39b4232c 100644
--- a/spec/addPersonOnActivite_spec.rb
+++ b/spec/addPersonOnActivite_spec.rb
@@ -4,7 +4,7 @@
let(:uri) {'/Atividades'}
context "Adicionar pessoa em atividade" do
- let(:person) {Activite.addPerson("Teste", "teste@teste")}
+ let(:person) {Activity.addPerson("admin@admin.com", "admin123")}
it "Mostra menssagem" do
page.driver.get uri
diff --git a/spec/controllers/user_activities_controller_spec.rb b/spec/controllers/user_activities_controller_spec.rb
new file mode 100644
index 00000000..7bb969b1
--- /dev/null
+++ b/spec/controllers/user_activities_controller_spec.rb
@@ -0,0 +1,5 @@
+require 'rails_helper'
+
+RSpec.describe UserActivitiesController, type: :controller do
+
+end
diff --git a/spec/helpers/user_activities_helper_spec.rb b/spec/helpers/user_activities_helper_spec.rb
new file mode 100644
index 00000000..c1993ae3
--- /dev/null
+++ b/spec/helpers/user_activities_helper_spec.rb
@@ -0,0 +1,15 @@
+require 'rails_helper'
+
+# Specs in this file have access to a helper object that includes
+# the UserActivitiesHelper. For example:
+#
+# describe UserActivitiesHelper do
+# describe "string concat" do
+# it "concats two strings with spaces" do
+# expect(helper.concat_strings("this","that")).to eq("this that")
+# end
+# end
+# end
+RSpec.describe UserActivitiesHelper, type: :helper do
+ pending "add some examples to (or delete) #{__FILE__}"
+end
diff --git a/spec/models/user_activity_spec.rb b/spec/models/user_activity_spec.rb
new file mode 100644
index 00000000..417dfa25
--- /dev/null
+++ b/spec/models/user_activity_spec.rb
@@ -0,0 +1,5 @@
+require 'rails_helper'
+
+RSpec.describe UserActivity, type: :model do
+ pending "add some examples to (or delete) #{__FILE__}"
+end
diff --git a/spec/views/user_activity/index.html.erb_spec.rb b/spec/views/user_activity/index.html.erb_spec.rb
new file mode 100644
index 00000000..7b288226
--- /dev/null
+++ b/spec/views/user_activity/index.html.erb_spec.rb
@@ -0,0 +1,5 @@
+require 'rails_helper'
+
+RSpec.describe "user_activity/index.html.erb", type: :view do
+ pending "add some examples to (or delete) #{__FILE__}"
+end
From 4e8c68ffa7f4d934c27068b1b52972e6db926656 Mon Sep 17 00:00:00 2001
From: MrJamesX37 <47198738+MrJamesX37@users.noreply.github.com>
Date: Fri, 13 Nov 2020 23:29:51 -0300
Subject: [PATCH 30/51] Alguns ajustes feitos
---
activities/index.html.erb | 25 ++++++++
activities/new.html.erb | 17 +++++
controllers/activities_controller.rb | 41 ++++++++++++
controllers/application_controller.rb | 11 ++++
controllers/home_controller.rb | 4 ++
controllers/user_activities_controller.rb | 78 +++++++++++++++++++++++
user_activities/edit.html.erb | 35 ++++++++++
user_activities/index.html.erb | 26 ++++++++
8 files changed, 237 insertions(+)
create mode 100644 activities/index.html.erb
create mode 100644 activities/new.html.erb
create mode 100644 controllers/activities_controller.rb
create mode 100644 controllers/application_controller.rb
create mode 100644 controllers/home_controller.rb
create mode 100644 controllers/user_activities_controller.rb
create mode 100644 user_activities/edit.html.erb
create mode 100644 user_activities/index.html.erb
diff --git a/activities/index.html.erb b/activities/index.html.erb
new file mode 100644
index 00000000..60e8aeac
--- /dev/null
+++ b/activities/index.html.erb
@@ -0,0 +1,25 @@
+Atividades
+
+<%= link_to 'Adicionar atividade', new_activity_path, style: "#{'display: none' if !user_admin? }" %>
+
+
+
+ | Título |
+ Prazo de execução |
+ Descrição |
+ |
+
+
+ <% @activities.each do |activity| %>
+
+ | <%= activity.title %> |
+ <%= activity.due_date.to_formatted_s(:rfc822) %> |
+ <%= activity.description %> |
+ <%= check_box_tag(:interest, false, false, :onclick => "UserActivitiesController.create(current_user.id, activity.id);") %> |
+ Demonstrar Interesse |
+ <%= link_to 'Remover Atividade', activity_path(activity), :method => :delete, :confirm => 'Tem certeza ?' %> |
+
+ <% end %>
+
+
+<%= link_to 'Minhas Atividades de interesse', user_activities_path %>
\ No newline at end of file
diff --git a/activities/new.html.erb b/activities/new.html.erb
new file mode 100644
index 00000000..b306de82
--- /dev/null
+++ b/activities/new.html.erb
@@ -0,0 +1,17 @@
+Cadastrar nova atividade
+
+<%= form_with scope: :activity, url: activities_path,local: true do |form| %>
+
+ <%= form.label :title, "Nome da atividade" %>
+ <%= form.text_field :title %>
+
+
+
+ <%= form.label :due_date, "Prazo de execução" %>
+ <%= form.date_field :due_date %>
+
+
+
+ <%= form.submit "Salvar" %>
+
+<% end %>
\ No newline at end of file
diff --git a/controllers/activities_controller.rb b/controllers/activities_controller.rb
new file mode 100644
index 00000000..b69c73a8
--- /dev/null
+++ b/controllers/activities_controller.rb
@@ -0,0 +1,41 @@
+class ActivitiesController < ApplicationController
+ def index
+ @activities = Activity.all
+ end
+
+ def new
+ end
+
+ def create
+ @activity = Activity.new(activity_params)
+ if @activity.save
+ flash[:notice] = "Atividade cadastrada com sucesso."
+ redirect_to activities_path
+ elsif @activity.errors.any?
+ flash[:notice] = ["Atividade não cadastrada."]
+ @activity.errors.each do |attribute, message|
+ flash[:notice] << message
+ end
+ redirect_back(fallback_location: root_path)
+ end
+ end
+
+ def destroy
+ @activity = Activity.find(params[:id])
+ if @activity.destroy
+ flash[:notice] = "Atividade deleteda com sucesso."
+ redirect_to activities_path
+ elsif @activity.errors.any?
+ flash[:notice] = ["Não foi possível deletar a Atividade."]
+ @activity.errors.each do |attribute, message|
+ flash[:notice] << message
+ end
+ redirect_back(fallback_location: root_path)
+ end
+ end
+
+ private
+ def activity_params
+ params.require(:activity).permit(:title, :due_date)
+ end
+end
\ No newline at end of file
diff --git a/controllers/application_controller.rb b/controllers/application_controller.rb
new file mode 100644
index 00000000..457cc5f9
--- /dev/null
+++ b/controllers/application_controller.rb
@@ -0,0 +1,11 @@
+# frozen_string_literal: true
+
+class ApplicationController < ActionController::Base
+ before_action :configure_permitted_parameters, if: :devise_controller?
+
+ protected
+
+ def configure_permitted_parameters
+ devise_parameter_sanitizer.permit(:sign_up, keys: %i[full_name role])
+ end
+end
diff --git a/controllers/home_controller.rb b/controllers/home_controller.rb
new file mode 100644
index 00000000..95f29929
--- /dev/null
+++ b/controllers/home_controller.rb
@@ -0,0 +1,4 @@
+class HomeController < ApplicationController
+ def index
+ end
+end
diff --git a/controllers/user_activities_controller.rb b/controllers/user_activities_controller.rb
new file mode 100644
index 00000000..02d2ab7e
--- /dev/null
+++ b/controllers/user_activities_controller.rb
@@ -0,0 +1,78 @@
+class UserActivitiesController < ApplicationController
+ def index
+ @user_activities = UserActivity.where(user_id: current_user.id)
+ end
+
+ def new
+ end
+
+ def create
+ @user_activity = UserActivity.new(user_activity_params)
+ if @user_activity.save
+ notify(@user_activity.user_id, @user_activity.activity_id, "cadastrado")
+ redirect_to user_activities_path
+ elsif @user_activity.errors.any?
+ error(@user_activity.user_id, @user_activity.activity_id, "cadastrar")
+ end
+ end
+
+ def self.create(user_id, activity_id)
+ if UserActivity.find_by(user_id: user_id, activity_id: activity_id) == nil
+ @user_activity = UserActivity.new
+ @user_activity.user_id = user_id
+ @user_activity.activity_id = activity_id
+ @user_activity.interested = true
+ @user_activity.active = false
+ @user_activity.save!
+ end
+ end
+
+ def show
+ @user_activity = find
+ end
+
+ def edit
+ @user_activity = find
+ end
+
+ def update
+ @user_activity = find
+ if @user_activity.update(update_user_activity_params)
+ notify(UserActivity.getUser(@user_activity.user_id), UserActivity.getActivity(@user_activity.activity_id), "atualizado")
+ redirect_to user_activities_path
+ elsif @user_activity.errors.any?
+ error(UserActivity.getUser(@user_activity.user_id), UserActivity.getActivity(@user_activity.activity_id), "atualizar")
+ end
+ end
+
+ def destroy
+ @user_activity = find
+ if @user_activity.destroy
+ notify(UserActivity.getUser(@user_activity.user_id), UserActivity.getActivity(@user_activity.activity_id), "deletado")
+ redirect_to user_activities_path
+ elsif @user_activity.errors.any?
+ error(UserActivity.getUser(@user_activity.user_id), UserActivity.getActivity(@user_activity.activity_id), "deletar")
+ end
+ end
+
+ private
+ def user_activity_params
+ params.require(:user_activity).permit(:user_id, :activity_id)
+ end
+
+ def update_user_activity_params
+ params.require(:user_activity).permit(:user_id, :activity_id, :interested, :active)
+ end
+
+ def find
+ UserActivity.find(params[:id])
+ end
+
+ def notify(name, title, msg)
+ flash[:notice] = "#{title} #{msg} de #{name} com sucesso"
+ end
+
+ def error(name, title, msg)
+ flash[:notice] = "Não foi possível #{msg} #{name} de #{title}"
+ end
+end
diff --git a/user_activities/edit.html.erb b/user_activities/edit.html.erb
new file mode 100644
index 00000000..4a2261dd
--- /dev/null
+++ b/user_activities/edit.html.erb
@@ -0,0 +1,35 @@
+ Cadastrar Usúario na Atividade
+
+<%= form_with(model: @user_activity, local: true) do |form| %>
+
+ <%= form.label :user_id, "Id do usupario" %>
+ <%= form.text_field :user_id, value: @user_activity.user_id %>
+
+
+
+ <%= form.label :activity_id, " Id da Atividade" %>
+ <%= form.text_field :activity_id, value: @user_activity.activity_id %>
+
+
+
+ <%= form.label :interested, "Interessado" %>
+ <%= form.radio_button :interested, "True", :checked => true %>
+ <%= form.label :active, "True" %>
+ <%= form.radio_button :interested, "False" %>
+ <%= form.label :active, "False" %>
+
+
+
+ <%= form.label :active, "Cadastrado" %>
+ <%= form.radio_button :active, "True" %>
+ <%= form.label :active, "True" %>
+ <%= form.radio_button :active, "False" %>
+ <%= form.label :active, value: "False" %>
+
+
+
+ <%= form.submit "Salvar" %>
+
+<% end %>
+
+<%= link_to 'Back', user_activities_path %>
\ No newline at end of file
diff --git a/user_activities/index.html.erb b/user_activities/index.html.erb
new file mode 100644
index 00000000..b92350a3
--- /dev/null
+++ b/user_activities/index.html.erb
@@ -0,0 +1,26 @@
+Minhas Atividades de Interesse
+
+
+
+ | Usuário |
+ Atividade |
+ Interesado |
+ Cadastrado |
+ |
+
+
+ <% @user_activities.each do |user_activity| %>
+
+ | <%= UserActivity.getUser(user_activity.user_id) %> |
+ <%= UserActivity.getActivity(user_activity.activity_id) %> |
+ <%= user_activity.interested %> |
+ <%= user_activity.active %> |
+
+ <%= link_to 'Cadastrar Usuário', edit_user_activity_path(user_activity) %> |
+
+ <%= link_to 'Remover Interesse', user_activity_path(user_activity), :method => :delete, :confirm => 'Tem certeza ?' %>
+ |
+ <% end %>
+
+
+<%= link_to 'Voltar a Atividades', activities_path %>
\ No newline at end of file
From 042dc4c4fd67e83c300b29e3f5fcc386f17ecd07 Mon Sep 17 00:00:00 2001
From: MrJamesX37 <47198738+MrJamesX37@users.noreply.github.com>
Date: Fri, 13 Nov 2020 23:33:06 -0300
Subject: [PATCH 31/51] Mais um detalhe ajustado
---
index.html.erb | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
create mode 100644 index.html.erb
diff --git a/index.html.erb b/index.html.erb
new file mode 100644
index 00000000..0124d5eb
--- /dev/null
+++ b/index.html.erb
@@ -0,0 +1,25 @@
+Atividades
+
+<%= link_to 'Adicionar atividade', new_activity_path %>
+
+
+
+ | Título |
+ Prazo de execução |
+ Descrição |
+ |
+
+
+ <% @activities.each do |activity| %>
+
+ | <%= activity.title %> |
+ <%= activity.due_date.to_formatted_s(:rfc822) %> |
+ <%= activity.description %> |
+ <%= check_box_tag(:interest, false, false, :onclick => "UserActivitiesController.create(current_user.id, activity.id);") %> |
+ Demonstrar Interesse |
+ <%= link_to 'Remover Atividade', activity_path(activity), :method => :delete, :confirm => 'Tem certeza ?' %> |
+
+ <% end %>
+
+
+<%= link_to 'Minhas Atividades de interesse', user_activities_path %>
\ No newline at end of file
From 3995e903ea67b7097aaa03a27a0a3737a4d7ffe0 Mon Sep 17 00:00:00 2001
From: Kalley Wilkerson
Date: Fri, 13 Nov 2020 23:44:14 -0300
Subject: [PATCH 32/51] =?UTF-8?q?Corre=C3=A7=C3=B5es=20para=20os=20testes?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/activities_controller.rb | 5 -----
app/views/activities/index.html.erb | 4 ++--
config/routes.rb | 2 ++
3 files changed, 4 insertions(+), 7 deletions(-)
diff --git a/app/controllers/activities_controller.rb b/app/controllers/activities_controller.rb
index 7b46ea1d..0f5b3efc 100644
--- a/app/controllers/activities_controller.rb
+++ b/app/controllers/activities_controller.rb
@@ -34,11 +34,6 @@ def destroy
end
end
- def user_admin?
- current_user.administrator?
- end
- helper_method :user_admin?
-
private
def activity_params
params.fetch(:activity, {}).permit(:title, :due_date)
diff --git a/app/views/activities/index.html.erb b/app/views/activities/index.html.erb
index 69b3ea61..0124d5eb 100644
--- a/app/views/activities/index.html.erb
+++ b/app/views/activities/index.html.erb
@@ -1,6 +1,6 @@
Atividades
-<%= link_to 'Adicionar atividade', new_activity_path, style: "#{'display: none' if !user_admin? }" %>
+<%= link_to 'Adicionar atividade', new_activity_path %>
@@ -17,7 +17,7 @@
| <%= activity.description %> |
<%= check_box_tag(:interest, false, false, :onclick => "UserActivitiesController.create(current_user.id, activity.id);") %> |
Demonstrar Interesse |
- <%= link_to 'Remover Atividade', activity_path(activity), :method => :delete, :confirm => 'Tem certeza ?', style: "#{'display: none' if !user_admin? }" %> |
+ <%= link_to 'Remover Atividade', activity_path(activity), :method => :delete, :confirm => 'Tem certeza ?' %> |
<% end %>
diff --git a/config/routes.rb b/config/routes.rb
index 9cbad12b..0877be1a 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -6,6 +6,8 @@
resources :activities
+ resources :user_activities
+
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
root to: 'home#index'
end
From 1c4f89805c876c9985af50bdfddbd0629a37ec7d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?K=C3=A1lley=20Wilkerson?=
Date: Fri, 13 Nov 2020 23:51:32 -0300
Subject: [PATCH 33/51] =?UTF-8?q?Atualiza=C3=A7=C3=A3o=20do=20README?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
README.md | 36 +++++++++++++++++++++---------------
1 file changed, 21 insertions(+), 15 deletions(-)
diff --git a/README.md b/README.md
index 7db80e4c..ba725cdd 100644
--- a/README.md
+++ b/README.md
@@ -1,24 +1,30 @@
-# README
+# GRUPO 1 - Sprint 2
-This README would normally document whatever steps are necessary to get the
-application up and running.
+* Carlos Eduardo de Sousa - 160057701
+* Edilton Costa Alves - 170002365
+* Eduardo Vaz Fagundes Rech - 180075161
+* Estevam Galvão Albuquerque - 160005663
+* Kalley Wilkerson Rodrigues Alexandre - 170038050
-Things you may want to cover:
-* Ruby version
+## NOME DO PROJETO
+#### Calendário de atividades - secretaria-ppgi
-* System dependencies
+## ESCOPO DO PROJETO
+* Teste para cadastro de atividade e seu prazo de execução;
+* Teste para inclusão de pessoas interessadas em cada atividade;
+* Teste para notificação de pessoas interessadas;
+* Teste para visualização de atividades cadastradas;
+* Teste para visualização de atividades de interesse.
-* Configuration
-* Database creation
+## ATRIBUIÇÕES
-* Database initialization
+### Scrum Master
+#### Carlos Eduardo de Sousa - 160057701
-* How to run the test suite
+### Product Owner
+#### Kalley Wilkerson Rodrigues Alexandre - 170038050
-* Services (job queues, cache servers, search engines, etc.)
-
-* Deployment instructions
-
-* ...
+## Problemas
+Não foi possível fazer uma boa verificação se o usuário logado é administrador ou não à tempo, a execução do cucumber não permite o acesso a dados da sessão. Portanto, o método que a gente criou que fazia essa verificação, por mais que funcionasse como esperado na execução normal da aplicação, não funcionava nos testes.
From 38ac12f8a3eed94a32e72444ee6f2efe60970601 Mon Sep 17 00:00:00 2001
From: MrJamesX37 <47198738+MrJamesX37@users.noreply.github.com>
Date: Sat, 14 Nov 2020 00:17:06 -0300
Subject: [PATCH 34/51] Pequeno erro na UserActivity corrigido
---
app/edit.html.erb | 35 ++++++++++++++
app/index.html.erb | 26 +++++++++++
app/user_activities_controller.rb | 78 +++++++++++++++++++++++++++++++
3 files changed, 139 insertions(+)
create mode 100644 app/edit.html.erb
create mode 100644 app/index.html.erb
create mode 100644 app/user_activities_controller.rb
diff --git a/app/edit.html.erb b/app/edit.html.erb
new file mode 100644
index 00000000..4a2261dd
--- /dev/null
+++ b/app/edit.html.erb
@@ -0,0 +1,35 @@
+ Cadastrar Usúario na Atividade
+
+<%= form_with(model: @user_activity, local: true) do |form| %>
+
+ <%= form.label :user_id, "Id do usupario" %>
+ <%= form.text_field :user_id, value: @user_activity.user_id %>
+
+
+
+ <%= form.label :activity_id, " Id da Atividade" %>
+ <%= form.text_field :activity_id, value: @user_activity.activity_id %>
+
+
+
+ <%= form.label :interested, "Interessado" %>
+ <%= form.radio_button :interested, "True", :checked => true %>
+ <%= form.label :active, "True" %>
+ <%= form.radio_button :interested, "False" %>
+ <%= form.label :active, "False" %>
+
+
+
+ <%= form.label :active, "Cadastrado" %>
+ <%= form.radio_button :active, "True" %>
+ <%= form.label :active, "True" %>
+ <%= form.radio_button :active, "False" %>
+ <%= form.label :active, value: "False" %>
+
+
+
+ <%= form.submit "Salvar" %>
+
+<% end %>
+
+<%= link_to 'Back', user_activities_path %>
\ No newline at end of file
diff --git a/app/index.html.erb b/app/index.html.erb
new file mode 100644
index 00000000..b92350a3
--- /dev/null
+++ b/app/index.html.erb
@@ -0,0 +1,26 @@
+Minhas Atividades de Interesse
+
+
+
+ | Usuário |
+ Atividade |
+ Interesado |
+ Cadastrado |
+ |
+
+
+ <% @user_activities.each do |user_activity| %>
+
+ | <%= UserActivity.getUser(user_activity.user_id) %> |
+ <%= UserActivity.getActivity(user_activity.activity_id) %> |
+ <%= user_activity.interested %> |
+ <%= user_activity.active %> |
+
+ <%= link_to 'Cadastrar Usuário', edit_user_activity_path(user_activity) %> |
+
+ <%= link_to 'Remover Interesse', user_activity_path(user_activity), :method => :delete, :confirm => 'Tem certeza ?' %>
+ |
+ <% end %>
+
+
+<%= link_to 'Voltar a Atividades', activities_path %>
\ No newline at end of file
diff --git a/app/user_activities_controller.rb b/app/user_activities_controller.rb
new file mode 100644
index 00000000..02d2ab7e
--- /dev/null
+++ b/app/user_activities_controller.rb
@@ -0,0 +1,78 @@
+class UserActivitiesController < ApplicationController
+ def index
+ @user_activities = UserActivity.where(user_id: current_user.id)
+ end
+
+ def new
+ end
+
+ def create
+ @user_activity = UserActivity.new(user_activity_params)
+ if @user_activity.save
+ notify(@user_activity.user_id, @user_activity.activity_id, "cadastrado")
+ redirect_to user_activities_path
+ elsif @user_activity.errors.any?
+ error(@user_activity.user_id, @user_activity.activity_id, "cadastrar")
+ end
+ end
+
+ def self.create(user_id, activity_id)
+ if UserActivity.find_by(user_id: user_id, activity_id: activity_id) == nil
+ @user_activity = UserActivity.new
+ @user_activity.user_id = user_id
+ @user_activity.activity_id = activity_id
+ @user_activity.interested = true
+ @user_activity.active = false
+ @user_activity.save!
+ end
+ end
+
+ def show
+ @user_activity = find
+ end
+
+ def edit
+ @user_activity = find
+ end
+
+ def update
+ @user_activity = find
+ if @user_activity.update(update_user_activity_params)
+ notify(UserActivity.getUser(@user_activity.user_id), UserActivity.getActivity(@user_activity.activity_id), "atualizado")
+ redirect_to user_activities_path
+ elsif @user_activity.errors.any?
+ error(UserActivity.getUser(@user_activity.user_id), UserActivity.getActivity(@user_activity.activity_id), "atualizar")
+ end
+ end
+
+ def destroy
+ @user_activity = find
+ if @user_activity.destroy
+ notify(UserActivity.getUser(@user_activity.user_id), UserActivity.getActivity(@user_activity.activity_id), "deletado")
+ redirect_to user_activities_path
+ elsif @user_activity.errors.any?
+ error(UserActivity.getUser(@user_activity.user_id), UserActivity.getActivity(@user_activity.activity_id), "deletar")
+ end
+ end
+
+ private
+ def user_activity_params
+ params.require(:user_activity).permit(:user_id, :activity_id)
+ end
+
+ def update_user_activity_params
+ params.require(:user_activity).permit(:user_id, :activity_id, :interested, :active)
+ end
+
+ def find
+ UserActivity.find(params[:id])
+ end
+
+ def notify(name, title, msg)
+ flash[:notice] = "#{title} #{msg} de #{name} com sucesso"
+ end
+
+ def error(name, title, msg)
+ flash[:notice] = "Não foi possível #{msg} #{name} de #{title}"
+ end
+end
From bdfa2074fb8b41c09279d32563d8e52595f57f1b Mon Sep 17 00:00:00 2001
From: MrJamesX37 <47198738+MrJamesX37@users.noreply.github.com>
Date: Sat, 14 Nov 2020 00:21:34 -0300
Subject: [PATCH 35/51] =?UTF-8?q?Colocando=20edit.html.erb=20no=20diret?=
=?UTF-8?q?=C3=B3rio=20correto?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/{ => views}/edit.html.erb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
rename app/{ => views}/edit.html.erb (92%)
diff --git a/app/edit.html.erb b/app/views/edit.html.erb
similarity index 92%
rename from app/edit.html.erb
rename to app/views/edit.html.erb
index 4a2261dd..4e5c4652 100644
--- a/app/edit.html.erb
+++ b/app/views/edit.html.erb
@@ -32,4 +32,4 @@
<% end %>
-<%= link_to 'Back', user_activities_path %>
\ No newline at end of file
+<%= link_to 'Back', user_activities_path %>
From 307e75a0d4a5bed5c43816ffa5c97389ab65d068 Mon Sep 17 00:00:00 2001
From: MrJamesX37 <47198738+MrJamesX37@users.noreply.github.com>
Date: Sat, 14 Nov 2020 00:23:22 -0300
Subject: [PATCH 36/51] Delete edit.html.erb
---
app/views/user_activities/edit.html.erb | 35 -------------------------
1 file changed, 35 deletions(-)
delete mode 100644 app/views/user_activities/edit.html.erb
diff --git a/app/views/user_activities/edit.html.erb b/app/views/user_activities/edit.html.erb
deleted file mode 100644
index 4a2261dd..00000000
--- a/app/views/user_activities/edit.html.erb
+++ /dev/null
@@ -1,35 +0,0 @@
- Cadastrar Usúario na Atividade
-
-<%= form_with(model: @user_activity, local: true) do |form| %>
-
- <%= form.label :user_id, "Id do usupario" %>
- <%= form.text_field :user_id, value: @user_activity.user_id %>
-
-
-
- <%= form.label :activity_id, " Id da Atividade" %>
- <%= form.text_field :activity_id, value: @user_activity.activity_id %>
-
-
-
- <%= form.label :interested, "Interessado" %>
- <%= form.radio_button :interested, "True", :checked => true %>
- <%= form.label :active, "True" %>
- <%= form.radio_button :interested, "False" %>
- <%= form.label :active, "False" %>
-
-
-
- <%= form.label :active, "Cadastrado" %>
- <%= form.radio_button :active, "True" %>
- <%= form.label :active, "True" %>
- <%= form.radio_button :active, "False" %>
- <%= form.label :active, value: "False" %>
-
-
-
- <%= form.submit "Salvar" %>
-
-<% end %>
-
-<%= link_to 'Back', user_activities_path %>
\ No newline at end of file
From 50aaa8edd69535c6934552c1b66a0757b4758afc Mon Sep 17 00:00:00 2001
From: MrJamesX37 <47198738+MrJamesX37@users.noreply.github.com>
Date: Sat, 14 Nov 2020 00:23:45 -0300
Subject: [PATCH 37/51] =?UTF-8?q?Colocando=20edit.html.erb=20no=20diret?=
=?UTF-8?q?=C3=B3rio=20certo?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/{ => user_activities}/edit.html.erb | 0
1 file changed, 0 insertions(+), 0 deletions(-)
rename app/views/{ => user_activities}/edit.html.erb (100%)
diff --git a/app/views/edit.html.erb b/app/views/user_activities/edit.html.erb
similarity index 100%
rename from app/views/edit.html.erb
rename to app/views/user_activities/edit.html.erb
From 1adc947eaac8cd1170769b9f824bbf97da6cb027 Mon Sep 17 00:00:00 2001
From: MrJamesX37 <47198738+MrJamesX37@users.noreply.github.com>
Date: Sat, 14 Nov 2020 00:24:37 -0300
Subject: [PATCH 38/51] Delete index.html.erb
---
app/views/user_activities/index.html.erb | 26 ------------------------
1 file changed, 26 deletions(-)
delete mode 100644 app/views/user_activities/index.html.erb
diff --git a/app/views/user_activities/index.html.erb b/app/views/user_activities/index.html.erb
deleted file mode 100644
index 9f3898d1..00000000
--- a/app/views/user_activities/index.html.erb
+++ /dev/null
@@ -1,26 +0,0 @@
-Minhas Atividades de Interesse
-
-
-
- | Usuário |
- Atividade |
- Interesado |
- Cadastrado |
- |
-
-
- <% @user_activities.each do |user_activity| %>
-
- | <%= UserActivity.getUser(user_activity.user_id) %> |
- <%= UserActivity.getActivity(user_activity.activity_id) %> |
- <%= user_activity.interested %> |
- <%= user_activity.active %> |
-
- <%= link_to 'Cadastrar Usuário', edit_user_activity_path(user_activity), style: "#{'display: none' if !user_admin? }" %> |
-
- <%= link_to 'Remover Interesse', user_activity_path(user_activity), :method => :delete, :confirm => 'Tem certeza ?' %>
- |
- <% end %>
-
-
-<%= link_to 'Voltar a Atividades', activities_path %>
\ No newline at end of file
From 38c5ad35b00235358ef760f2421bc9bce2160cbf Mon Sep 17 00:00:00 2001
From: MrJamesX37 <47198738+MrJamesX37@users.noreply.github.com>
Date: Sat, 14 Nov 2020 00:25:58 -0300
Subject: [PATCH 39/51] Atualizando index.html.erb
---
app/{ => views/user_activities}/index.html.erb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
rename app/{ => views/user_activities}/index.html.erb (90%)
diff --git a/app/index.html.erb b/app/views/user_activities/index.html.erb
similarity index 90%
rename from app/index.html.erb
rename to app/views/user_activities/index.html.erb
index b92350a3..2cb9eb1c 100644
--- a/app/index.html.erb
+++ b/app/views/user_activities/index.html.erb
@@ -23,4 +23,4 @@
<% end %>
-<%= link_to 'Voltar a Atividades', activities_path %>
\ No newline at end of file
+<%= link_to 'Voltar a Atividades', activities_path %>
From 038f432fc628cd2b65f6b9fdfed3a5a94ef1634f Mon Sep 17 00:00:00 2001
From: MrJamesX37 <47198738+MrJamesX37@users.noreply.github.com>
Date: Sat, 14 Nov 2020 00:27:58 -0300
Subject: [PATCH 40/51] Delete user_activities_controller.rb
---
app/controllers/user_activities_controller.rb | 87 -------------------
1 file changed, 87 deletions(-)
delete mode 100644 app/controllers/user_activities_controller.rb
diff --git a/app/controllers/user_activities_controller.rb b/app/controllers/user_activities_controller.rb
deleted file mode 100644
index 60af0610..00000000
--- a/app/controllers/user_activities_controller.rb
+++ /dev/null
@@ -1,87 +0,0 @@
-class UserActivitiesController < ApplicationController
- def index
- if user_admin?
- @user_activities = UserActivity.all
- else
- @user_activities = UserActivity.where(user_id: current_user.id)
- end
- end
-
- def new
- end
-
- def create
- @user_activity = UserActivity.new(user_activity_params)
- if @user_activity.save
- notify(@user_activity.user_id, @user_activity.activity_id, "cadastrado")
- redirect_to user_activities_path
- elsif @user_activity.errors.any?
- error(@user_activity.user_id, @user_activity.activity_id, "cadastrar")
- end
- end
-
- def self.create(user_id, activity_id)
- if UserActivity.find_by(user_id: user_id, activity_id: activity_id) == nil
- @user_activity = UserActivity.new
- @user_activity.user_id = user_id
- @user_activity.activity_id = activity_id
- @user_activity.interested = true
- @user_activity.active = false
- @user_activity.save!
- end
- end
-
- def show
- @user_activity = find
- end
-
- def edit
- @user_activity = find
- end
-
- def update
- @user_activity = find
- if @user_activity.update(update_user_activity_params)
- notify(UserActivity.getUser(@user_activity.user_id), UserActivity.getActivity(@user_activity.activity_id), "atualizado")
- redirect_to user_activities_path
- elsif @user_activity.errors.any?
- error(UserActivity.getUser(@user_activity.user_id), UserActivity.getActivity(@user_activity.activity_id), "atualizar")
- end
- end
-
- def destroy
- @user_activity = find
- if @user_activity.destroy
- notify(UserActivity.getUser(@user_activity.user_id), UserActivity.getActivity(@user_activity.activity_id), "deletado")
- redirect_to user_activities_path
- elsif @user_activity.errors.any?
- error(UserActivity.getUser(@user_activity.user_id), UserActivity.getActivity(@user_activity.activity_id), "deletar")
- end
- end
-
- def user_admin?
- current_user.administrator?
- end
- helper_method :user_admin?
-
- private
- def user_activity_params
- params.require(:user_activity).permit(:user_id, :activity_id)
- end
-
- def update_user_activity_params
- params.require(:user_activity).permit(:user_id, :activity_id, :interested, :active)
- end
-
- def find
- UserActivity.find(params[:id])
- end
-
- def notify(name, title, msg)
- flash[:notice] = "#{title} #{msg} de #{name} com sucesso"
- end
-
- def error(name, title, msg)
- flash[:notice] = "Não foi possível #{msg} #{name} de #{title}"
- end
-end
From 7278d37016c0c962854cb63e19c5872335088fa3 Mon Sep 17 00:00:00 2001
From: MrJamesX37 <47198738+MrJamesX37@users.noreply.github.com>
Date: Sat, 14 Nov 2020 00:28:09 -0300
Subject: [PATCH 41/51] Atualizando user_activities_controller.rb
---
app/{ => controllers}/user_activities_controller.rb | 0
1 file changed, 0 insertions(+), 0 deletions(-)
rename app/{ => controllers}/user_activities_controller.rb (100%)
diff --git a/app/user_activities_controller.rb b/app/controllers/user_activities_controller.rb
similarity index 100%
rename from app/user_activities_controller.rb
rename to app/controllers/user_activities_controller.rb
From 6e45ae3889ca9fdc5e8be4c3b27f5fb176cf4b39 Mon Sep 17 00:00:00 2001
From: MrJamesX37 <47198738+MrJamesX37@users.noreply.github.com>
Date: Sat, 14 Nov 2020 00:28:52 -0300
Subject: [PATCH 42/51] Update user_activities_controller.rb
---
app/controllers/user_activities_controller.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/controllers/user_activities_controller.rb b/app/controllers/user_activities_controller.rb
index 02d2ab7e..044eb1bb 100644
--- a/app/controllers/user_activities_controller.rb
+++ b/app/controllers/user_activities_controller.rb
@@ -1,6 +1,6 @@
class UserActivitiesController < ApplicationController
def index
- @user_activities = UserActivity.where(user_id: current_user.id)
+ @user_activities = UserActivity.all
end
def new
From b5595e09b4c82d3675353e7416503ec4fd925c36 Mon Sep 17 00:00:00 2001
From: MrJamesX37 <47198738+MrJamesX37@users.noreply.github.com>
Date: Sat, 14 Nov 2020 00:51:14 -0300
Subject: [PATCH 43/51] Arrumando erros
---
activities/index.html.erb | 25 -------------------------
1 file changed, 25 deletions(-)
delete mode 100644 activities/index.html.erb
diff --git a/activities/index.html.erb b/activities/index.html.erb
deleted file mode 100644
index 60e8aeac..00000000
--- a/activities/index.html.erb
+++ /dev/null
@@ -1,25 +0,0 @@
-Atividades
-
-<%= link_to 'Adicionar atividade', new_activity_path, style: "#{'display: none' if !user_admin? }" %>
-
-
-
- | Título |
- Prazo de execução |
- Descrição |
- |
-
-
- <% @activities.each do |activity| %>
-
- | <%= activity.title %> |
- <%= activity.due_date.to_formatted_s(:rfc822) %> |
- <%= activity.description %> |
- <%= check_box_tag(:interest, false, false, :onclick => "UserActivitiesController.create(current_user.id, activity.id);") %> |
- Demonstrar Interesse |
- <%= link_to 'Remover Atividade', activity_path(activity), :method => :delete, :confirm => 'Tem certeza ?' %> |
-
- <% end %>
-
-
-<%= link_to 'Minhas Atividades de interesse', user_activities_path %>
\ No newline at end of file
From 65a035cac8d0d1717298090a5b9dcd0429b63e05 Mon Sep 17 00:00:00 2001
From: MrJamesX37 <47198738+MrJamesX37@users.noreply.github.com>
Date: Sat, 14 Nov 2020 00:52:08 -0300
Subject: [PATCH 44/51] Arrumando erros
---
activities/new.html.erb | 17 -----------------
1 file changed, 17 deletions(-)
delete mode 100644 activities/new.html.erb
diff --git a/activities/new.html.erb b/activities/new.html.erb
deleted file mode 100644
index b306de82..00000000
--- a/activities/new.html.erb
+++ /dev/null
@@ -1,17 +0,0 @@
-Cadastrar nova atividade
-
-<%= form_with scope: :activity, url: activities_path,local: true do |form| %>
-
- <%= form.label :title, "Nome da atividade" %>
- <%= form.text_field :title %>
-
-
-
- <%= form.label :due_date, "Prazo de execução" %>
- <%= form.date_field :due_date %>
-
-
-
- <%= form.submit "Salvar" %>
-
-<% end %>
\ No newline at end of file
From f18a598d4a9d7cad6c42c3728b0a291486557de7 Mon Sep 17 00:00:00 2001
From: MrJamesX37 <47198738+MrJamesX37@users.noreply.github.com>
Date: Sat, 14 Nov 2020 00:52:34 -0300
Subject: [PATCH 45/51] Arrumando erros
---
user_activities/index.html.erb | 26 --------------------------
1 file changed, 26 deletions(-)
delete mode 100644 user_activities/index.html.erb
diff --git a/user_activities/index.html.erb b/user_activities/index.html.erb
deleted file mode 100644
index b92350a3..00000000
--- a/user_activities/index.html.erb
+++ /dev/null
@@ -1,26 +0,0 @@
-Minhas Atividades de Interesse
-
-
-
- | Usuário |
- Atividade |
- Interesado |
- Cadastrado |
- |
-
-
- <% @user_activities.each do |user_activity| %>
-
- | <%= UserActivity.getUser(user_activity.user_id) %> |
- <%= UserActivity.getActivity(user_activity.activity_id) %> |
- <%= user_activity.interested %> |
- <%= user_activity.active %> |
-
- <%= link_to 'Cadastrar Usuário', edit_user_activity_path(user_activity) %> |
-
- <%= link_to 'Remover Interesse', user_activity_path(user_activity), :method => :delete, :confirm => 'Tem certeza ?' %>
- |
- <% end %>
-
-
-<%= link_to 'Voltar a Atividades', activities_path %>
\ No newline at end of file
From 351fd28de83490417a3faa71ae9fd499355d7a43 Mon Sep 17 00:00:00 2001
From: MrJamesX37 <47198738+MrJamesX37@users.noreply.github.com>
Date: Sat, 14 Nov 2020 00:52:44 -0300
Subject: [PATCH 46/51] Arrumando erros
---
user_activities/edit.html.erb | 35 -----------------------------------
1 file changed, 35 deletions(-)
delete mode 100644 user_activities/edit.html.erb
diff --git a/user_activities/edit.html.erb b/user_activities/edit.html.erb
deleted file mode 100644
index 4a2261dd..00000000
--- a/user_activities/edit.html.erb
+++ /dev/null
@@ -1,35 +0,0 @@
- Cadastrar Usúario na Atividade
-
-<%= form_with(model: @user_activity, local: true) do |form| %>
-
- <%= form.label :user_id, "Id do usupario" %>
- <%= form.text_field :user_id, value: @user_activity.user_id %>
-
-
-
- <%= form.label :activity_id, " Id da Atividade" %>
- <%= form.text_field :activity_id, value: @user_activity.activity_id %>
-
-
-
- <%= form.label :interested, "Interessado" %>
- <%= form.radio_button :interested, "True", :checked => true %>
- <%= form.label :active, "True" %>
- <%= form.radio_button :interested, "False" %>
- <%= form.label :active, "False" %>
-
-
-
- <%= form.label :active, "Cadastrado" %>
- <%= form.radio_button :active, "True" %>
- <%= form.label :active, "True" %>
- <%= form.radio_button :active, "False" %>
- <%= form.label :active, value: "False" %>
-
-
-
- <%= form.submit "Salvar" %>
-
-<% end %>
-
-<%= link_to 'Back', user_activities_path %>
\ No newline at end of file
From 5890cedb8dd7921773e97a24270b04952db47ff4 Mon Sep 17 00:00:00 2001
From: MrJamesX37 <47198738+MrJamesX37@users.noreply.github.com>
Date: Sat, 14 Nov 2020 00:53:57 -0300
Subject: [PATCH 47/51] Arrumando erros
---
controllers/activities_controller.rb | 41 ----------------------------
1 file changed, 41 deletions(-)
delete mode 100644 controllers/activities_controller.rb
diff --git a/controllers/activities_controller.rb b/controllers/activities_controller.rb
deleted file mode 100644
index b69c73a8..00000000
--- a/controllers/activities_controller.rb
+++ /dev/null
@@ -1,41 +0,0 @@
-class ActivitiesController < ApplicationController
- def index
- @activities = Activity.all
- end
-
- def new
- end
-
- def create
- @activity = Activity.new(activity_params)
- if @activity.save
- flash[:notice] = "Atividade cadastrada com sucesso."
- redirect_to activities_path
- elsif @activity.errors.any?
- flash[:notice] = ["Atividade não cadastrada."]
- @activity.errors.each do |attribute, message|
- flash[:notice] << message
- end
- redirect_back(fallback_location: root_path)
- end
- end
-
- def destroy
- @activity = Activity.find(params[:id])
- if @activity.destroy
- flash[:notice] = "Atividade deleteda com sucesso."
- redirect_to activities_path
- elsif @activity.errors.any?
- flash[:notice] = ["Não foi possível deletar a Atividade."]
- @activity.errors.each do |attribute, message|
- flash[:notice] << message
- end
- redirect_back(fallback_location: root_path)
- end
- end
-
- private
- def activity_params
- params.require(:activity).permit(:title, :due_date)
- end
-end
\ No newline at end of file
From b3330a518e41b39e7f27649f222b45072f259ae3 Mon Sep 17 00:00:00 2001
From: MrJamesX37 <47198738+MrJamesX37@users.noreply.github.com>
Date: Sat, 14 Nov 2020 00:54:02 -0300
Subject: [PATCH 48/51] Arrumando erros
---
controllers/application_controller.rb | 11 -----------
1 file changed, 11 deletions(-)
delete mode 100644 controllers/application_controller.rb
diff --git a/controllers/application_controller.rb b/controllers/application_controller.rb
deleted file mode 100644
index 457cc5f9..00000000
--- a/controllers/application_controller.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-# frozen_string_literal: true
-
-class ApplicationController < ActionController::Base
- before_action :configure_permitted_parameters, if: :devise_controller?
-
- protected
-
- def configure_permitted_parameters
- devise_parameter_sanitizer.permit(:sign_up, keys: %i[full_name role])
- end
-end
From f5a5affbde0545fb9068038f552eab172cc6f863 Mon Sep 17 00:00:00 2001
From: MrJamesX37 <47198738+MrJamesX37@users.noreply.github.com>
Date: Sat, 14 Nov 2020 00:54:12 -0300
Subject: [PATCH 49/51] Arrumando erros
---
controllers/home_controller.rb | 4 ----
1 file changed, 4 deletions(-)
delete mode 100644 controllers/home_controller.rb
diff --git a/controllers/home_controller.rb b/controllers/home_controller.rb
deleted file mode 100644
index 95f29929..00000000
--- a/controllers/home_controller.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-class HomeController < ApplicationController
- def index
- end
-end
From d499a2f78f407c9696d4d0ed47626630ec84e856 Mon Sep 17 00:00:00 2001
From: MrJamesX37 <47198738+MrJamesX37@users.noreply.github.com>
Date: Sat, 14 Nov 2020 00:54:18 -0300
Subject: [PATCH 50/51] Arrumando erros
---
controllers/user_activities_controller.rb | 78 -----------------------
1 file changed, 78 deletions(-)
delete mode 100644 controllers/user_activities_controller.rb
diff --git a/controllers/user_activities_controller.rb b/controllers/user_activities_controller.rb
deleted file mode 100644
index 02d2ab7e..00000000
--- a/controllers/user_activities_controller.rb
+++ /dev/null
@@ -1,78 +0,0 @@
-class UserActivitiesController < ApplicationController
- def index
- @user_activities = UserActivity.where(user_id: current_user.id)
- end
-
- def new
- end
-
- def create
- @user_activity = UserActivity.new(user_activity_params)
- if @user_activity.save
- notify(@user_activity.user_id, @user_activity.activity_id, "cadastrado")
- redirect_to user_activities_path
- elsif @user_activity.errors.any?
- error(@user_activity.user_id, @user_activity.activity_id, "cadastrar")
- end
- end
-
- def self.create(user_id, activity_id)
- if UserActivity.find_by(user_id: user_id, activity_id: activity_id) == nil
- @user_activity = UserActivity.new
- @user_activity.user_id = user_id
- @user_activity.activity_id = activity_id
- @user_activity.interested = true
- @user_activity.active = false
- @user_activity.save!
- end
- end
-
- def show
- @user_activity = find
- end
-
- def edit
- @user_activity = find
- end
-
- def update
- @user_activity = find
- if @user_activity.update(update_user_activity_params)
- notify(UserActivity.getUser(@user_activity.user_id), UserActivity.getActivity(@user_activity.activity_id), "atualizado")
- redirect_to user_activities_path
- elsif @user_activity.errors.any?
- error(UserActivity.getUser(@user_activity.user_id), UserActivity.getActivity(@user_activity.activity_id), "atualizar")
- end
- end
-
- def destroy
- @user_activity = find
- if @user_activity.destroy
- notify(UserActivity.getUser(@user_activity.user_id), UserActivity.getActivity(@user_activity.activity_id), "deletado")
- redirect_to user_activities_path
- elsif @user_activity.errors.any?
- error(UserActivity.getUser(@user_activity.user_id), UserActivity.getActivity(@user_activity.activity_id), "deletar")
- end
- end
-
- private
- def user_activity_params
- params.require(:user_activity).permit(:user_id, :activity_id)
- end
-
- def update_user_activity_params
- params.require(:user_activity).permit(:user_id, :activity_id, :interested, :active)
- end
-
- def find
- UserActivity.find(params[:id])
- end
-
- def notify(name, title, msg)
- flash[:notice] = "#{title} #{msg} de #{name} com sucesso"
- end
-
- def error(name, title, msg)
- flash[:notice] = "Não foi possível #{msg} #{name} de #{title}"
- end
-end
From 99c488b69ec82490d2766a8fe5e722d835ecaa42 Mon Sep 17 00:00:00 2001
From: Estevam Albuquerque
Date: Sat, 14 Nov 2020 06:15:48 -0300
Subject: [PATCH 51/51] all cucumber tests passed
---
app/controllers/notifications_controller.rb | 6 +++
app/views/activities/index.html.erb | 2 +
app/views/notifications/index.html.erb | 1 +
app/views/notifications/new.html.erb | 22 ++++++++
config/routes.rb | 1 +
features/notifyInterestedPeople.feature | 25 ++++-----
.../notifyInterestedPeople_step.rb | 53 ++++---------------
7 files changed, 53 insertions(+), 57 deletions(-)
create mode 100644 app/controllers/notifications_controller.rb
create mode 100644 app/views/notifications/index.html.erb
create mode 100644 app/views/notifications/new.html.erb
diff --git a/app/controllers/notifications_controller.rb b/app/controllers/notifications_controller.rb
new file mode 100644
index 00000000..3fe2754b
--- /dev/null
+++ b/app/controllers/notifications_controller.rb
@@ -0,0 +1,6 @@
+class NotificationsController < ApplicationController
+ def create
+ flash[:notice] = "Notificação enviada aos interessados com sucesso."
+ redirect_to activities_path
+ end
+end
\ No newline at end of file
diff --git a/app/views/activities/index.html.erb b/app/views/activities/index.html.erb
index c45001d5..cea377d6 100644
--- a/app/views/activities/index.html.erb
+++ b/app/views/activities/index.html.erb
@@ -1,6 +1,8 @@
Atividades
<%= link_to 'Adicionar atividade', new_activity_path %>
+
+<%= link_to 'Notificar integrantes', new_notification_path %>
diff --git a/app/views/notifications/index.html.erb b/app/views/notifications/index.html.erb
new file mode 100644
index 00000000..2c9cd80a
--- /dev/null
+++ b/app/views/notifications/index.html.erb
@@ -0,0 +1 @@
+Notifications
\ No newline at end of file
diff --git a/app/views/notifications/new.html.erb b/app/views/notifications/new.html.erb
new file mode 100644
index 00000000..0882d86d
--- /dev/null
+++ b/app/views/notifications/new.html.erb
@@ -0,0 +1,22 @@
+Criar nova notificação
+
+<%= form_with scope: :notification, url: notifications_path,local: true do |form| %>
+
+
+ <%= form.label :title, "Nome da notificação" %>
+ <%= form.text_field :title %>
+
+
+
+ <%= form.label :content, "Conteúdo da notificação" %>
+ <%= form.text_area :content %>
+
+
+
+ <%= form.label :interested, "Integrantes interessados" %>
+ <%= form.collection_select(:interested, User.roles, :second, :first) %>
+
+
+ <%= form.submit "Enviar notificação" %>
+
+<% end %>
\ No newline at end of file
diff --git a/config/routes.rb b/config/routes.rb
index 9cbad12b..411a8b39 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -5,6 +5,7 @@
devise_for :users
resources :activities
+ resources :notifications
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
root to: 'home#index'
diff --git a/features/notifyInterestedPeople.feature b/features/notifyInterestedPeople.feature
index 4dc84a40..4a38e7b6 100644
--- a/features/notifyInterestedPeople.feature
+++ b/features/notifyInterestedPeople.feature
@@ -6,29 +6,24 @@ Funcionalidade: Administrador notificar as pessoas interessadas
Para que eu possa notificar as pessoas interessadas em alguma atividade,
Eu gostaria de notificar as pessoas interessadas
- #Pré-requisito
- Background: Administrador está logado
- Dado que estou na página "users/sign_in"
- E preencho o campo "Email" com "admin@admin.com"
- E preencho o campo "Password" com "admin123"
- Quando pressiono "Log in"
- Então eu devo ser redirecionado para "root_path"
-
#Cenário feliz
Cenário: Notificar pessoas interessadas
- Dado que estou na página "Atividades"
+ Dado que estou logado com usuário "admin@admin.com" e senha "admin123"
+ Dado que eu me encontro na página "activities"
Quando pressiono "Notificar integrantes"
- Então eu devo ser redirecionado para "Notificar_integrantes_selecionados"
- Quando preencho o campo "Integrantes interessados" com os "Estudantes"
+ Então eu devo estar em "/notifications/new"
+ Quando preencho o campo "Nome da notificação" com "Título notificação"
+ E preencho o campo "Conteúdo da notificação" com "Conteúdo notificação"
+ Quando no campo "Integrantes interessados" eu seleciono "administrator"
E pressiono "Enviar notificação"
- Então eu devo ver "Notificação enviada aos interessados com sucesso"
+ Então eu devo conseguir ver "Notificação enviada aos interessados com sucesso."
#Cenário triste
Cenário: Página não encontrada
- Dado que estou na página "Atividades"
+ Dado que eu me encontro na página "activities"
Quando pressiono "Notificar integrantes"
- Então eu devo ser redirecionado para "404"
- E eu devo ver "Página não encontrada"
+ Então devo ser redirecionado para a página "404"
+ E eu devo conseguir ver "The page you were looking for doesn't exist."
#estou contando que "Atividades" seja a página home de administração
diff --git a/features/step_definitions/notifyInterestedPeople_step.rb b/features/step_definitions/notifyInterestedPeople_step.rb
index 63ab3be3..3f90a5ad 100644
--- a/features/step_definitions/notifyInterestedPeople_step.rb
+++ b/features/step_definitions/notifyInterestedPeople_step.rb
@@ -1,62 +1,31 @@
-#Background
-Dado("que eu estou na página {string}") do |string|
- visit "localhost:3000/#{string.downcase}"
-end
-
-E("preencho o campo {string} com {string}") do |string1, string2|
- fill_in string1, with: string2
-end
-
-E("preencho o campo {string} com {string}") do |string1, string2|
- fill_in string1, with: string2
-end
-
-Quando("pressiono {string}") do |string|
- click_on(string)
-end
-
-Então("eu devo ser redirecionado para {string}") do |string|
- visit "localhost:3000/#{string.downcase}"
-end
#Cenário feliz
-Dado("que eu estou na página {string}") do |string|
- visit "localhost:3000/#{string.downcase}"
+Dado("que eu me encontro na página {string}") do |string|
+ visit "/#{string.downcase}"
end
Quando("pressiono {string}") do |string|
click_on(string)
end
-Então("eu devo ser redirecionado para {string}") do |string|
- visit "localhost:3000/#{string.downcase}"
+Então("eu devo estar em {string}") do |string|
+ expect(page).to have_current_path(string)
end
-Quando("preencho o campo {string} com {string}") do |string1, string2|
+Quando("preencho o campo {string} com os {string}") do |string1, string2|
fill_in string1, with: string2
end
-E("pressiono {string}") do |string|
- click_on(string)
+Quando("no campo {string} eu seleciono {string}") do |string1, string2|
+ select string2, :from => string1
end
-Então("eu devo ver {string}") do |string|
+
+Então("eu devo conseguir ver {string}") do |string|
expect(page).to have_content string
end
#Cenário triste
-Dado("que eu estou na página {string}") do |string|
- visit "localhost:3000/#{string.downcase}"
-end
-
-Quando("pressiono {string}") do |string|
- click_on(string)
-end
-
-Então("eu devo ser redirecionado para {string}") do |string|
- visit "localhost:3000/#{string.downcase}"
-end
-
-Então("eu devo ver {string}") do |string|
- expect(page).to have_content string
+Então("devo ser redirecionado para a página {string}") do |string|
+ visit "/#{string.downcase}"
end
\ No newline at end of file