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/45] 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/45] 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/45] 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/45] 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 ed6dd2c04ad55c959195ed8932721c9f32064567 Mon Sep 17 00:00:00 2001 From: aliceborges_42 Date: Wed, 28 Oct 2020 17:47:08 -0300 Subject: [PATCH 05/45] =?UTF-8?q?Adiciona=20featurs=20e=20.rb=20de=20Edita?= =?UTF-8?q?r=20processos=20e=20Adicionar=20coment=C3=A1rios?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Gemfile | 2 + Gemfile.lock | 6 + features/adicionar_comentario_wiki.feature | 21 ++ features/editar_processo_wiki.feature | 19 ++ .../adicionar_comentario_wiki.rb | 34 +++ .../step_definitions/editar_processo_wiki.rb | 32 +++ features/step_definitions/web_steps.rb | 254 ++++++++++++++++++ features/support/paths.rb | 38 +++ features/support/selectors.rb | 44 +++ 9 files changed, 450 insertions(+) create mode 100644 features/adicionar_comentario_wiki.feature create mode 100644 features/editar_processo_wiki.feature create mode 100644 features/step_definitions/adicionar_comentario_wiki.rb create mode 100644 features/step_definitions/editar_processo_wiki.rb create mode 100644 features/step_definitions/web_steps.rb create mode 100644 features/support/paths.rb create mode 100644 features/support/selectors.rb diff --git a/Gemfile b/Gemfile index 54be0f4e..e33df326 100644 --- a/Gemfile +++ b/Gemfile @@ -64,6 +64,8 @@ group :test do # database_cleaner is not required, but highly recommended gem 'database_cleaner' gem 'shoulda-matchers' + gem 'cucumber-rails-training-wheels' + gem 'launchy' end # Windows does not include zoneinfo files, so bundle the tzinfo-data gem diff --git a/Gemfile.lock b/Gemfile.lock index 0a9e4f86..b6223e46 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -90,6 +90,8 @@ GEM mime-types (>= 2.0, < 4) nokogiri (~> 1.8) railties (>= 4.2, < 7) + cucumber-rails-training-wheels (1.0.0) + cucumber-rails (>= 1.1.1) cucumber-tag_expressions (1.1.1) cucumber-wire (0.0.1) database_cleaner (1.7.0) @@ -110,6 +112,8 @@ GEM concurrent-ruby (~> 1.0) jbuilder (2.9.1) activesupport (>= 4.2.0) + launchy (2.5.0) + addressable (~> 2.7) listen (3.1.5) rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) @@ -256,9 +260,11 @@ DEPENDENCIES capybara (>= 2.15) coffee-rails (~> 4.2) cucumber-rails + cucumber-rails-training-wheels database_cleaner devise jbuilder (~> 2.5) + launchy listen (>= 3.0.5, < 3.2) pg (>= 0.18, < 2.0) puma (~> 3.12) diff --git a/features/adicionar_comentario_wiki.feature b/features/adicionar_comentario_wiki.feature new file mode 100644 index 00000000..76ba8d31 --- /dev/null +++ b/features/adicionar_comentario_wiki.feature @@ -0,0 +1,21 @@ + +#language: pt +#encoding: utf-8 + +Funcionalidade: Adicionar comentário a um processo de atendimento + Como um secretário, + para que eu possa adicionar informações a um processo de atendimento, + sem alterar o conteúdo original, + eu gostaria de adicionar um comentário nesse processo de atendimento. + + Contexto: + Dado que eu esteja cadastrado como usuario "user@user.com", "123456", "secretario", + E que esteja na pagina da wiki de atendimento + E eu seleciono um processo + E eu clico no campo "Comentário" + Então devo adicionar um comentário ao processo + + Cenário: Campos com informações do processo + E existe o campo "Comentário" + Quando seleciono o campo "Comentário" + Então devo adicionar um comentário \ No newline at end of file diff --git a/features/editar_processo_wiki.feature b/features/editar_processo_wiki.feature new file mode 100644 index 00000000..c6d61268 --- /dev/null +++ b/features/editar_processo_wiki.feature @@ -0,0 +1,19 @@ + +#language: pt +#encoding: utf-8 + +Funcionalidade: Editar processo de atendimento + Como um secretário cadastrado, + para que eu possa manter a Wiki atualizada, + eu gostaria de editar um processo de atendimento já cadastrado + + Contexto: + Dado que eu esteja cadastrado como usuario "user@user.com", "123456", "secretario", + E que esteja na pagina da wiki de atendimento + E eu seleciono um processo + E eu clico no botão "Editar processo" + + Cenário: Campos com informações do processo + E existe informações "número SEI", "nome/tipo do processo", "nome dos envolvidos no processo" e "status" cadastradas + Quando eu seleciono um campo + Então devo editar as informações do campo \ No newline at end of file diff --git a/features/step_definitions/adicionar_comentario_wiki.rb b/features/step_definitions/adicionar_comentario_wiki.rb new file mode 100644 index 00000000..53dce0c0 --- /dev/null +++ b/features/step_definitions/adicionar_comentario_wiki.rb @@ -0,0 +1,34 @@ +Dado("que eu esteja cadastrado como usuario {string}, {string}, {string},") do |string, string2, string3| + pending # Write code here that turns the phrase above into concrete actions + end + + Dado("que esteja na pagina da wiki de atendimento") do + pending # Write code here that turns the phrase above into concrete actions + end + + Dado("eu seleciono um processo") do + pending # Write code here that turns the phrase above into concrete actions + end + + Dado("eu clico no campo {string}") do |string| + pending # Write code here that turns the phrase above into concrete actions + end + + Então("devo adicionar um comentário ao processo") do + pending # Write code here that turns the phrase above into concrete actions + end + + Então("existe o campo {string}") do |string| + pending # Write code here that turns the phrase above into concrete actions + end + + Quando("seleciono o campo {string}") do |string| + pending # Write code here that turns the phrase above into concrete actions + end + + Então("devo adicionar um comentário") do + pending # Write code here that turns the phrase above into concrete actions + end + + + \ No newline at end of file diff --git a/features/step_definitions/editar_processo_wiki.rb b/features/step_definitions/editar_processo_wiki.rb new file mode 100644 index 00000000..a9ce404f --- /dev/null +++ b/features/step_definitions/editar_processo_wiki.rb @@ -0,0 +1,32 @@ +Dado("que eu esteja cadastrado como usuario {string}, {string}, {string},") do |string, string2, string3| + pending # Write code here that turns the phrase above into concrete actions + end + + Dado("que esteja logado") do + pending # Write code here that turns the phrase above into concrete actions + end + + Dado("que esteja na pagina da wiki de atendimento") do + pending # Write code here that turns the phrase above into concrete actions + end + + Dado("eu seleciono um processo") do + pending # Write code here that turns the phrase above into concrete actions + end + + Dado("eu clico no botão {string}") do |string| + pending # Write code here that turns the phrase above into concrete actions + end + + Dado("existe informações {string}, {string}, {string} e {string} cadastradas") do |string, string2, string3, string4| + pending # Write code here that turns the phrase above into concrete actions + end + + Quando("eu seleciono um campo") do + pending # Write code here that turns the phrase above into concrete actions + end + + Então("devo editar as informações do campo") do + pending # Write code here that turns the phrase above into concrete actions + end + \ No newline at end of file diff --git a/features/step_definitions/web_steps.rb b/features/step_definitions/web_steps.rb new file mode 100644 index 00000000..4d9aab64 --- /dev/null +++ b/features/step_definitions/web_steps.rb @@ -0,0 +1,254 @@ +# TL;DR: YOU SHOULD DELETE THIS FILE +# +# This file was generated by Cucumber-Rails and is only here to get you a head start +# These step definitions are thin wrappers around the Capybara/Webrat API that lets you +# visit pages, interact with widgets and make assertions about page content. +# +# If you use these step definitions as basis for your features you will quickly end up +# with features that are: +# +# * Hard to maintain +# * Verbose to read +# +# A much better approach is to write your own higher level step definitions, following +# the advice in the following blog posts: +# +# * http://benmabey.com/2008/05/19/imperative-vs-declarative-scenarios-in-user-stories.html +# * http://dannorth.net/2011/01/31/whose-domain-is-it-anyway/ +# * http://elabs.se/blog/15-you-re-cuking-it-wrong +# + + +require 'uri' +require 'cgi' +require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "paths")) +require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "selectors")) + +module WithinHelpers + def with_scope(locator) + locator ? within(*selector_for(locator)) { yield } : yield + end +end +World(WithinHelpers) + +# Single-line step scoper +When /^(.*) within (.*[^:])$/ do |step, parent| + with_scope(parent) { When step } +end + +# Multi-line step scoper +When /^(.*) within (.*[^:]):$/ do |step, parent, table_or_string| + with_scope(parent) { When "#{step}:", table_or_string } +end + +Given /^(?:|I )am on (.+)$/ do |page_name| + visit path_to(page_name) +end + +When /^(?:|I )go to (.+)$/ do |page_name| + visit path_to(page_name) +end + +When /^(?:|I )press "([^"]*)"$/ do |button| + click_button(button) +end + +When /^(?:|I )follow "([^"]*)"$/ do |link| + click_link(link) +end + +When /^(?:|I )fill in "([^"]*)" with "([^"]*)"$/ do |field, value| + fill_in(field, :with => value) +end + +When /^(?:|I )fill in "([^"]*)" for "([^"]*)"$/ do |value, field| + fill_in(field, :with => value) +end + +# Use this to fill in an entire form with data from a table. Example: +# +# When I fill in the following: +# | Account Number | 5002 | +# | Expiry date | 2009-11-01 | +# | Note | Nice guy | +# | Wants Email? | | +# +# TODO: Add support for checkbox, select or option +# based on naming conventions. +# +When /^(?:|I )fill in the following:$/ do |fields| + fields.rows_hash.each do |name, value| + When %{I fill in "#{name}" with "#{value}"} + end +end + +When /^(?:|I )select "([^"]*)" from "([^"]*)"$/ do |value, field| + select(value, :from => field) +end + +When /^(?:|I )check "([^"]*)"$/ do |field| + check(field) +end + +When /^(?:|I )uncheck "([^"]*)"$/ do |field| + uncheck(field) +end + +When /^(?:|I )choose "([^"]*)"$/ do |field| + choose(field) +end + +When /^(?:|I )attach the file "([^"]*)" to "([^"]*)"$/ do |path, field| + attach_file(field, File.expand_path(path)) +end + +Then /^(?:|I )should see "([^"]*)"$/ do |text| + if page.respond_to? :should + page.should have_content(text) + else + assert page.has_content?(text) + end +end + +Then /^(?:|I )should see \/([^\/]*)\/$/ do |regexp| + regexp = Regexp.new(regexp) + + if page.respond_to? :should + page.should have_xpath('//*', :text => regexp) + else + assert page.has_xpath?('//*', :text => regexp) + end +end + +Then /^(?:|I )should not see "([^"]*)"$/ do |text| + if page.respond_to? :should + page.should have_no_content(text) + else + assert page.has_no_content?(text) + end +end + +Then /^(?:|I )should not see \/([^\/]*)\/$/ do |regexp| + regexp = Regexp.new(regexp) + + if page.respond_to? :should + page.should have_no_xpath('//*', :text => regexp) + else + assert page.has_no_xpath?('//*', :text => regexp) + end +end + +Then /^the "([^"]*)" field(?: within (.*))? should contain "([^"]*)"$/ do |field, parent, value| + with_scope(parent) do + field = find_field(field) + field_value = (field.tag_name == 'textarea') ? field.text : field.value + if field_value.respond_to? :should + field_value.should =~ /#{value}/ + else + assert_match(/#{value}/, field_value) + end + end +end + +Then /^the "([^"]*)" field(?: within (.*))? should not contain "([^"]*)"$/ do |field, parent, value| + with_scope(parent) do + field = find_field(field) + field_value = (field.tag_name == 'textarea') ? field.text : field.value + if field_value.respond_to? :should_not + field_value.should_not =~ /#{value}/ + else + assert_no_match(/#{value}/, field_value) + end + end +end + +Then /^the "([^"]*)" field should have the error "([^"]*)"$/ do |field, error_message| + element = find_field(field) + classes = element.find(:xpath, '..')[:class].split(' ') + + form_for_input = element.find(:xpath, 'ancestor::form[1]') + using_formtastic = form_for_input[:class].include?('formtastic') + error_class = using_formtastic ? 'error' : 'field_with_errors' + + if classes.respond_to? :should + classes.should include(error_class) + else + assert classes.include?(error_class) + end + + if page.respond_to?(:should) + if using_formtastic + error_paragraph = element.find(:xpath, '../*[@class="inline-errors"][1]') + error_paragraph.should have_content(error_message) + else + page.should have_content("#{field.titlecase} #{error_message}") + end + else + if using_formtastic + error_paragraph = element.find(:xpath, '../*[@class="inline-errors"][1]') + assert error_paragraph.has_content?(error_message) + else + assert page.has_content?("#{field.titlecase} #{error_message}") + end + end +end + +Then /^the "([^"]*)" field should have no error$/ do |field| + element = find_field(field) + classes = element.find(:xpath, '..')[:class].split(' ') + if classes.respond_to? :should + classes.should_not include('field_with_errors') + classes.should_not include('error') + else + assert !classes.include?('field_with_errors') + assert !classes.include?('error') + end +end + +Then /^the "([^"]*)" checkbox(?: within (.*))? should be checked$/ do |label, parent| + with_scope(parent) do + field_checked = find_field(label)['checked'] + if field_checked.respond_to? :should + field_checked.should be_true + else + assert field_checked + end + end +end + +Then /^the "([^"]*)" checkbox(?: within (.*))? should not be checked$/ do |label, parent| + with_scope(parent) do + field_checked = find_field(label)['checked'] + if field_checked.respond_to? :should + field_checked.should be_false + else + assert !field_checked + end + end +end + +Then /^(?:|I )should be on (.+)$/ do |page_name| + current_path = URI.parse(current_url).path + if current_path.respond_to? :should + current_path.should == path_to(page_name) + else + assert_equal path_to(page_name), current_path + end +end + +Then /^(?:|I )should have the following query string:$/ do |expected_pairs| + query = URI.parse(current_url).query + actual_params = query ? CGI.parse(query) : {} + expected_params = {} + expected_pairs.rows_hash.each_pair{|k,v| expected_params[k] = v.split(',')} + + if actual_params.respond_to? :should + actual_params.should == expected_params + else + assert_equal expected_params, actual_params + end +end + +Then /^show me the page$/ do + save_and_open_page +end diff --git a/features/support/paths.rb b/features/support/paths.rb new file mode 100644 index 00000000..290543c3 --- /dev/null +++ b/features/support/paths.rb @@ -0,0 +1,38 @@ +# TL;DR: YOU SHOULD DELETE THIS FILE +# +# This file is used by web_steps.rb, which you should also delete +# +# You have been warned +module NavigationHelpers + # Maps a name to a path. Used by the + # + # When /^I go to (.+)$/ do |page_name| + # + # step definition in web_steps.rb + # + def path_to(page_name) + case page_name + + when /^the home\s?page$/ + '/' + + # Add more mappings here. + # Here is an example that pulls values out of the Regexp: + # + # when /^(.*)'s profile page$/i + # user_profile_path(User.find_by_login($1)) + + else + begin + page_name =~ /^the (.*) page$/ + path_components = $1.split(/\s+/) + self.send(path_components.push('path').join('_').to_sym) + rescue NoMethodError, ArgumentError + raise "Can't find mapping from \"#{page_name}\" to a path.\n" + + "Now, go and add a mapping in #{__FILE__}" + end + end + end +end + +World(NavigationHelpers) diff --git a/features/support/selectors.rb b/features/support/selectors.rb new file mode 100644 index 00000000..33bebc1d --- /dev/null +++ b/features/support/selectors.rb @@ -0,0 +1,44 @@ +# TL;DR: YOU SHOULD DELETE THIS FILE +# +# This file is used by web_steps.rb, which you should also delete +# +# You have been warned +module HtmlSelectorsHelpers + # Maps a name to a selector. Used primarily by the + # + # When /^(.+) within (.+)$/ do |step, scope| + # + # step definitions in web_steps.rb + # + def selector_for(locator) + case locator + + when "the page" + "html > body" + + # Add more mappings here. + # Here is an example that pulls values out of the Regexp: + # + # when /^the (notice|error|info) flash$/ + # ".flash.#{$1}" + + # You can also return an array to use a different selector + # type, like: + # + # when /the header/ + # [:xpath, "//header"] + + # This allows you to provide a quoted selector as the scope + # for "within" steps as was previously the default for the + # web steps: + when /^"(.+)"$/ + $1 + + else + raise "Can't find mapping from \"#{locator}\" to a selector.\n" + + "Now, go and add a mapping in #{__FILE__}" + end + end +end + +World(HtmlSelectorsHelpers) From 9f3caa9c1ad2f2921582a72abe1a7d78124a1fea Mon Sep 17 00:00:00 2001 From: nayarasilva Date: Wed, 28 Oct 2020 21:28:57 -0300 Subject: [PATCH 06/45] New Feature: Criando Processos como secretario --- features/novoprocesso.feature | 18 +++++++++ .../step_definitions/novoprocesso_steps.rb | 37 +++++++++++++++++++ spec/controllers/processos_controller_spec.rb | 17 +++++++++ 3 files changed, 72 insertions(+) create mode 100644 features/novoprocesso.feature create mode 100644 features/step_definitions/novoprocesso_steps.rb create mode 100644 spec/controllers/processos_controller_spec.rb diff --git a/features/novoprocesso.feature b/features/novoprocesso.feature new file mode 100644 index 00000000..b894e994 --- /dev/null +++ b/features/novoprocesso.feature @@ -0,0 +1,18 @@ +#language: pt + +Funcionalidade: Cadastrar um novo processo na Wiki de atendimento + + COMO um secretario EU QUERO cadastrar um novo processo na Wiki de atendimento A FIM de disponibilizar informações para outros secretários. + + Contexto: + Dado que eu esteja logado como secretario "usuario_secretario@secretario.com", "123456", + E que esteja na página de atendimento da Wiki + + Cenário: Cadastrar um novo processo na Wiki de atendimento(caminho feliz) + Quando eu clicar "Adicionar processo" + Então eu devo estar na pagina Criar Novo processo + Quando eu preencher "Aluno" + E eu preencher "Numero do processo" + E eu clicar em "Criar Processo" + Então eu devo estar na página de atendimento + E eu devo ver o Processo de "Numero do processo" \ No newline at end of file diff --git a/features/step_definitions/novoprocesso_steps.rb b/features/step_definitions/novoprocesso_steps.rb new file mode 100644 index 00000000..98e7a712 --- /dev/null +++ b/features/step_definitions/novoprocesso_steps.rb @@ -0,0 +1,37 @@ +Dado("que eu esteja logado como secretario {string}, {string},") do |string, string2| + User.create(email:'usuario_secretario@secretario.com', password: "123456", is_secretary: true) + + visit new_user_session_path + fill_in :user_email, with: string + fill_in :user_password, with: string + click_button "Entrar" +end + +Dado("que eu estou na página de atendimento da Wiki") do + pending # Write code here that turns the phrase above into concrete actions + end + + Quando("eu clicar {string}") do |string| + pending # Write code here that turns the phrase above into concrete actions + end + + Então("eu devo estar na pagina Criar Novo processo") do + pending # Write code here that turns the phrase above into concrete actions + end + + Quando("eu preencher {string}") do |string| + pending # Write code here that turns the phrase above into concrete actions + end + + Quando("eu clicar em {string}") do |string| + pending # Write code here that turns the phrase above into concrete actions + end + + Então("eu devo estar na página de atendimento") do + pending # Write code here that turns the phrase above into concrete actions + end + + Então("eu devo ver a mensagem {string}") do |string| + pending # Write code here that turns the phrase above into concrete actions + end + \ No newline at end of file diff --git a/spec/controllers/processos_controller_spec.rb b/spec/controllers/processos_controller_spec.rb new file mode 100644 index 00000000..0a982690 --- /dev/null +++ b/spec/controllers/processos_controller_spec.rb @@ -0,0 +1,17 @@ +require 'rails_helper' +require 'capybara/rails' + +RSpec.describe ProcessosController, type: :controller do + before(:each) do + @secretario = User.new(email: 'usuario_secretario@secretario.com', password: '123456', is_secretary:true) + @secretario.save! + sign_in @secretario + end + + describe 'POST #create' do + it 'criar um novo processo' do + @processo = Processo.create(aluno:"João", num_process:"123") + @processo.should be_an_instante_of Processo + end + end +end \ No newline at end of file From 32c66f94ad0ea6ebc23eb3c3dfb58ddf1c02b801 Mon Sep 17 00:00:00 2001 From: nayarasilva Date: Thu, 29 Oct 2020 21:02:19 -0300 Subject: [PATCH 07/45] Atualizando o projeto para seguir o banco do icaro --- features/novoprocesso.feature | 3 +- .../step_definitions/novoprocesso_steps.rb | 60 +++++++++---------- spec/controllers/processos_controller_spec.rb | 2 +- 3 files changed, 29 insertions(+), 36 deletions(-) diff --git a/features/novoprocesso.feature b/features/novoprocesso.feature index b894e994..7d7e777d 100644 --- a/features/novoprocesso.feature +++ b/features/novoprocesso.feature @@ -11,8 +11,7 @@ Funcionalidade: Cadastrar um novo processo na Wiki de atendimento Cenário: Cadastrar um novo processo na Wiki de atendimento(caminho feliz) Quando eu clicar "Adicionar processo" Então eu devo estar na pagina Criar Novo processo - Quando eu preencher "Aluno" - E eu preencher "Numero do processo" + Quando eu preencher "numero SEI", "nome/tipo do processo", "nome dos envolvidos no processo", "status" E eu clicar em "Criar Processo" Então eu devo estar na página de atendimento E eu devo ver o Processo de "Numero do processo" \ No newline at end of file diff --git a/features/step_definitions/novoprocesso_steps.rb b/features/step_definitions/novoprocesso_steps.rb index 98e7a712..dd0cee08 100644 --- a/features/step_definitions/novoprocesso_steps.rb +++ b/features/step_definitions/novoprocesso_steps.rb @@ -1,37 +1,31 @@ Dado("que eu esteja logado como secretario {string}, {string},") do |string, string2| - User.create(email:'usuario_secretario@secretario.com', password: "123456", is_secretary: true) + pending # Write code here that turns the phrase above into concrete actions +end + +Dado("que esteja na página de atendimento da Wiki") do + pending # Write code here that turns the phrase above into concrete actions +end + +Quando("eu clicar {string}") do |string| + pending # Write code here that turns the phrase above into concrete actions +end + +Então("eu devo estar na pagina Criar Novo processo") do + pending # Write code here that turns the phrase above into concrete actions +end + +Quando("eu preencher {string}, {string}, {string}, {string}") do |string, string2, string3, string4| + pending # Write code here that turns the phrase above into concrete actions +end + +Quando("eu clicar em {string}") do |string| + pending # Write code here that turns the phrase above into concrete actions +end - visit new_user_session_path - fill_in :user_email, with: string - fill_in :user_password, with: string - click_button "Entrar" +Então("eu devo estar na página de atendimento") do + pending # Write code here that turns the phrase above into concrete actions end -Dado("que eu estou na página de atendimento da Wiki") do - pending # Write code here that turns the phrase above into concrete actions - end - - Quando("eu clicar {string}") do |string| - pending # Write code here that turns the phrase above into concrete actions - end - - Então("eu devo estar na pagina Criar Novo processo") do - pending # Write code here that turns the phrase above into concrete actions - end - - Quando("eu preencher {string}") do |string| - pending # Write code here that turns the phrase above into concrete actions - end - - Quando("eu clicar em {string}") do |string| - pending # Write code here that turns the phrase above into concrete actions - end - - Então("eu devo estar na página de atendimento") do - pending # Write code here that turns the phrase above into concrete actions - end - - Então("eu devo ver a mensagem {string}") do |string| - pending # Write code here that turns the phrase above into concrete actions - end - \ No newline at end of file +Então("eu devo ver o Processo de {string}") do |string| + pending # Write code here that turns the phrase above into concrete actions +end \ No newline at end of file diff --git a/spec/controllers/processos_controller_spec.rb b/spec/controllers/processos_controller_spec.rb index 0a982690..8642e73c 100644 --- a/spec/controllers/processos_controller_spec.rb +++ b/spec/controllers/processos_controller_spec.rb @@ -10,7 +10,7 @@ describe 'POST #create' do it 'criar um novo processo' do - @processo = Processo.create(aluno:"João", num_process:"123") + @processo = Processo.create(num_SEI:123, tipo: 1, nome_envolvidos:"Joao, Maria, Luizinho", status: "pending") @processo.should be_an_instante_of Processo end end From 75f736855120204d1dff35c8b11fa168e6646881 Mon Sep 17 00:00:00 2001 From: clarice42 Date: Fri, 30 Oct 2020 14:49:38 -0300 Subject: [PATCH 08/45] Adiciona feature e teste de consultar processo --- features/consultar_processo.feature | 14 ++++++++++++++ .../step_definitions/consultar_processo.rb | 19 +++++++++++++++++++ spec/controllers/processos_controller_spec.rb | 18 ++++++++++++++++++ 3 files changed, 51 insertions(+) create mode 100644 features/consultar_processo.feature create mode 100644 features/step_definitions/consultar_processo.rb create mode 100644 spec/controllers/processos_controller_spec.rb diff --git a/features/consultar_processo.feature b/features/consultar_processo.feature new file mode 100644 index 00000000..9966b579 --- /dev/null +++ b/features/consultar_processo.feature @@ -0,0 +1,14 @@ +Funcionalidade: Consultar processo de atendimento na Wiki + Como um secretário, + Quero consultar uma entrada na Wiki sobre um processo de atendimento, + Para que eu possa me informar sobre como um processo é realizado + + Contexto: + Dado que eu esteja cadastrado como secretario "secretary@secretary.com", "admin123", "secretary", + E que esteja logado, + E que esteja na página de atendimento da Wiki + E eu clicar no link "Ver detalhes" + + Cenário: Consultar um processo de atendimento + Quando eu clicar no botão "Ver detalhes" + Então eu devo estar em uma página com as informações do processo diff --git a/features/step_definitions/consultar_processo.rb b/features/step_definitions/consultar_processo.rb new file mode 100644 index 00000000..656436b9 --- /dev/null +++ b/features/step_definitions/consultar_processo.rb @@ -0,0 +1,19 @@ +Dado("que eu esteja cadastrado como usuario {string}, {string}, {string},") do |string, string2, string3| + pending # Write code here that turns the phrase above into concrete actions + end + + Dado("que esteja logado") do + pending # Write code here that turns the phrase above into concrete actions + end + + Dado("que esteja na pagina da wiki de atendimento") do + pending # Write code here that turns the phrase above into concrete actions + end + + Quando("eu clicar no botão {string}") do |string| + pending # Write code here that turns the phrase above into concrete actions + end + + Então("devo visualizar as informações do processo") do + pending # Write code here that turns the phrase above into concrete actions + end \ No newline at end of file diff --git a/spec/controllers/processos_controller_spec.rb b/spec/controllers/processos_controller_spec.rb new file mode 100644 index 00000000..ce911a48 --- /dev/null +++ b/spec/controllers/processos_controller_spec.rb @@ -0,0 +1,18 @@ +require 'rails_helper' +require 'capybara/rails' + +RSpec.describe ProcessosController, type: :controller do + before(:each) do + @secretario = User.new(email: 'secretary@secretary.com', password: 'admin123', role: "secretary") + @secretario.save! + sign_in @secretario + end + + describe 'GET#show' do + it 'deve exibir informações do processo selecionado' do + get :show, params: {id: processo.to_param} + expect(response).to be_successful + expect(response).to have_http_status(200) + end + end +end From d4a91ff8e52518f923bff655e5071a692515b401 Mon Sep 17 00:00:00 2001 From: aliceborges_42 Date: Fri, 30 Oct 2020 16:58:04 -0300 Subject: [PATCH 09/45] Adiciona rspec e novos cucumbers - editar processo e adicionar comenario - wiki --- features/adicionar_comentario_wiki.feature | 19 +++-- features/editar_processo_wiki.feature | 22 ++++-- .../adicionar_comentario_wiki.rb | 70 ++++++++--------- .../step_definitions/editar_processo_wiki.rb | 75 +++++++++++-------- .../adicionar_comentario_processo_wiki.rb | 18 +++++ spec/controllers/update_processo_wiki_spec.rb | 19 +++++ 6 files changed, 145 insertions(+), 78 deletions(-) create mode 100644 spec/controllers/adicionar_comentario_processo_wiki.rb create mode 100644 spec/controllers/update_processo_wiki_spec.rb diff --git a/features/adicionar_comentario_wiki.feature b/features/adicionar_comentario_wiki.feature index 76ba8d31..90fa61c2 100644 --- a/features/adicionar_comentario_wiki.feature +++ b/features/adicionar_comentario_wiki.feature @@ -9,13 +9,18 @@ Funcionalidade: Adicionar comentário a um processo de atendimento eu gostaria de adicionar um comentário nesse processo de atendimento. Contexto: - Dado que eu esteja cadastrado como usuario "user@user.com", "123456", "secretario", + Dado que eu esteja cadastrado como usuario "alicinha@gatinha.com", "123456", "secretario", E que esteja na pagina da wiki de atendimento E eu seleciono um processo - E eu clico no campo "Comentário" - Então devo adicionar um comentário ao processo + E eu clico no botão "Adicionar comentário" - Cenário: Campos com informações do processo - E existe o campo "Comentário" - Quando seleciono o campo "Comentário" - Então devo adicionar um comentário \ No newline at end of file + Cenário: Preenche campo de comentário + Quando eu preencho o campo "comentário" com "Processo acompanhado também pela professora Maristela Holanda" + E clico no botão "Confirmar" + Então sou redirecionado para a página da wiki de atendimento + E recebo uma mensagem de sucesso + + Cenário: Deixa o campo de comentário vazio + Quando eu não preencho o campo de comentário + E clico no botão "Confirmar" + Então recebo uma mensagem de erro \ No newline at end of file diff --git a/features/editar_processo_wiki.feature b/features/editar_processo_wiki.feature index c6d61268..d1331783 100644 --- a/features/editar_processo_wiki.feature +++ b/features/editar_processo_wiki.feature @@ -8,12 +8,24 @@ Funcionalidade: Editar processo de atendimento eu gostaria de editar um processo de atendimento já cadastrado Contexto: - Dado que eu esteja cadastrado como usuario "user@user.com", "123456", "secretario", + Dado que eu esteja cadastrado como usuario "alicinha@gatinha.com", "123456", "secretario", E que esteja na pagina da wiki de atendimento E eu seleciono um processo E eu clico no botão "Editar processo" - Cenário: Campos com informações do processo - E existe informações "número SEI", "nome/tipo do processo", "nome dos envolvidos no processo" e "status" cadastradas - Quando eu seleciono um campo - Então devo editar as informações do campo \ No newline at end of file + Cenário: Preenche campos com informações válidas + Quando eu preencho o campo "número SEI" com o valor "0423-123456/2017" + E preencho o campo "nome/tipo do processo" com "Processo Seletivo para admissão de alunos" + E preencho o campo "nome dos envolvidos" com "Genaína Rodrigues" + E preencho o campo "status" com "em andamento" + E clico no botão "Confirmar" + Então sou redirecionado para a página da wiki de atendimento + E recebo uma mensagem de sucesso + + Cenário: Preenche campos com informações inválidas + Quando eu preencho o campo "número SEI" com o valor "alilicece" + E preencho o campo "nome/tipo do processo" com "Processo Seletivo para admissão de alunos" + E preencho o campo "nome dos envolvidos" com "Genaína Rodrigues" + E preencho o campo "status" com "em andamento" + E clico no botão "Confirmar" + Então recebo uma mensagem de erro \ No newline at end of file diff --git a/features/step_definitions/adicionar_comentario_wiki.rb b/features/step_definitions/adicionar_comentario_wiki.rb index 53dce0c0..c6ce5639 100644 --- a/features/step_definitions/adicionar_comentario_wiki.rb +++ b/features/step_definitions/adicionar_comentario_wiki.rb @@ -1,34 +1,36 @@ -Dado("que eu esteja cadastrado como usuario {string}, {string}, {string},") do |string, string2, string3| - pending # Write code here that turns the phrase above into concrete actions - end - - Dado("que esteja na pagina da wiki de atendimento") do - pending # Write code here that turns the phrase above into concrete actions - end - - Dado("eu seleciono um processo") do - pending # Write code here that turns the phrase above into concrete actions - end - - Dado("eu clico no campo {string}") do |string| - pending # Write code here that turns the phrase above into concrete actions - end - - Então("devo adicionar um comentário ao processo") do - pending # Write code here that turns the phrase above into concrete actions - end - - Então("existe o campo {string}") do |string| - pending # Write code here that turns the phrase above into concrete actions - end - - Quando("seleciono o campo {string}") do |string| - pending # Write code here that turns the phrase above into concrete actions - end - - Então("devo adicionar um comentário") do - pending # Write code here that turns the phrase above into concrete actions - end - - - \ No newline at end of file +Dado("cadastrado como usuario {string}, {string}, {string},") do |string, string2, string3| + pending # Write code here that turns the phrase above into concrete actions +end + +Dado("esteja na pagina da wiki de atendimento") do + pending # Write code here that turns the phrase above into concrete actions +end + +Dado("eu seleciono um processo") do + pending # Write code here that turns the phrase above into concrete actions +end + +Dado("eu clico no botão {string}") do |string| + pending # Write code here that turns the phrase above into concrete actions +end + +Quando("clico no botão {string}") do |string| + pending # Write code here that turns the phrase above into concrete actions +end + +Então("sou redirecionado para a página da wiki de atendimento") do + pending # Write code here that turns the phrase above into concrete actions +end + +Então("recebo uma mensagem de sucesso") do + pending # Write code here that turns the phrase above into concrete actions +end + +Quando("eu não preencho o campo de comentário") do + pending # Write code here that turns the phrase above into concrete actions +end + +Então("recebo uma mensagem de erro") do + pending # Write code here that turns the phrase above into concrete actions +end + diff --git a/features/step_definitions/editar_processo_wiki.rb b/features/step_definitions/editar_processo_wiki.rb index a9ce404f..7378ed84 100644 --- a/features/step_definitions/editar_processo_wiki.rb +++ b/features/step_definitions/editar_processo_wiki.rb @@ -1,32 +1,43 @@ -Dado("que eu esteja cadastrado como usuario {string}, {string}, {string},") do |string, string2, string3| - pending # Write code here that turns the phrase above into concrete actions - end - - Dado("que esteja logado") do - pending # Write code here that turns the phrase above into concrete actions - end - - Dado("que esteja na pagina da wiki de atendimento") do - pending # Write code here that turns the phrase above into concrete actions - end - - Dado("eu seleciono um processo") do - pending # Write code here that turns the phrase above into concrete actions - end - - Dado("eu clico no botão {string}") do |string| - pending # Write code here that turns the phrase above into concrete actions - end - - Dado("existe informações {string}, {string}, {string} e {string} cadastradas") do |string, string2, string3, string4| - pending # Write code here that turns the phrase above into concrete actions - end - - Quando("eu seleciono um campo") do - pending # Write code here that turns the phrase above into concrete actions - end - - Então("devo editar as informações do campo") do - pending # Write code here that turns the phrase above into concrete actions - end - \ No newline at end of file +Dado("que eu esteja cadastrado como usuario {string}, {string}, {string},") do |email, password, role| + pending # Write code here that turns the phrase above into concrete actions +end + +Dado("que esteja na pagina da wiki de atendimento") do + pending # Write code here that turns the phrase above into concrete actions +end + +Dado("eu seleciono um processo") do + pending # Write code here that turns the phrase above into concrete actions +end + +Dado("eu clico no botão {string}") do |string| + pending # Write code here that turns the phrase above into concrete actions +end + +Quando("eu preencho o campo {string} com {string}") do |string, string2| + pending # Write code here that turns the phrase above into concrete actions +end + +Quando("clico no botão {string}") do |string| + pending # Write code here that turns the phrase above into concrete actions +end + +Então("sou redirecionado para a página da wiki de atendimento") do + pending # Write code here that turns the phrase above into concrete actions +end + +Então("recebo uma mensagem de sucesso") do + pending # Write code here that turns the phrase above into concrete actions +end + +Então("recebo uma mensagem de erro") do + pending # Write code here that turns the phrase above into concrete actions +end + +Quando("eu preencho o campo {string} com o valor {string}") do |string, string2| + pending # Write code here that turns the phrase above into concrete actions +end + +Quando("preencho o campo {string} com {string}") do |string, string2| + pending # Write code here that turns the phrase above into concrete actions +end diff --git a/spec/controllers/adicionar_comentario_processo_wiki.rb b/spec/controllers/adicionar_comentario_processo_wiki.rb new file mode 100644 index 00000000..b3fcf13f --- /dev/null +++ b/spec/controllers/adicionar_comentario_processo_wiki.rb @@ -0,0 +1,18 @@ +require 'rails_helper' +require 'capybara/rails' + +RSpec.describe ProcessosController, type: :controller do + before(:each) do + @secretario = User.new(email: 'teste@teste.com', password: '123456', is_secretary:true) + @secretario.save! + sign_in @secretario + end + + describe 'POST #create' do + it 'adicionar um comentário' do + @processo = Processo.find(1) + @comentario = Comentario.create(id: 1, id_process: 1, text:'Acompanhando o Processo') + @comentario.should be_an_instante_of Comentario + end + end +end \ No newline at end of file diff --git a/spec/controllers/update_processo_wiki_spec.rb b/spec/controllers/update_processo_wiki_spec.rb new file mode 100644 index 00000000..05f7e010 --- /dev/null +++ b/spec/controllers/update_processo_wiki_spec.rb @@ -0,0 +1,19 @@ +require 'rails_helper' +require 'capybara/rails' + +RSpec.describe ProcessosController, type: :controller do + before(:each) do + @secretario = User.new(email: 'usuario_secretario@secretario.com', password: '123456', is_secretary:true) + @secretario.save! + sign_in @secretario + end + + describe 'PUT #update' do + it 'editar processo existente' do + @processo = Processo.find(1) + @processo = Processo.update(numero_SEI:"0423-123477/2020", tipo_processo:"", nome_envolvidos: "", status:"finalizado") + expect(@processo.numero_SEI).to eq('0423-123477/2020') + expect(@processo.status).to eq('finalizado') + end + end +end \ No newline at end of file From 6755fd37b8e9685ea87daa0afabce5c7509488b4 Mon Sep 17 00:00:00 2001 From: aliceborges_42 Date: Fri, 30 Oct 2020 20:10:34 -0300 Subject: [PATCH 10/45] refatora de steps --- features/editar_processo_wiki.feature | 6 ++-- .../adicionar_comentario_wiki.rb | 17 ++------- .../step_definitions/editar_processo_wiki.rb | 36 ++----------------- spec/controllers/update_processo_wiki_spec.rb | 2 +- 4 files changed, 7 insertions(+), 54 deletions(-) diff --git a/features/editar_processo_wiki.feature b/features/editar_processo_wiki.feature index d1331783..45018421 100644 --- a/features/editar_processo_wiki.feature +++ b/features/editar_processo_wiki.feature @@ -14,7 +14,7 @@ Funcionalidade: Editar processo de atendimento E eu clico no botão "Editar processo" Cenário: Preenche campos com informações válidas - Quando eu preencho o campo "número SEI" com o valor "0423-123456/2017" + Quando eu preencho o campo "número SEI" com "0423-123456/2017" E preencho o campo "nome/tipo do processo" com "Processo Seletivo para admissão de alunos" E preencho o campo "nome dos envolvidos" com "Genaína Rodrigues" E preencho o campo "status" com "em andamento" @@ -23,9 +23,7 @@ Funcionalidade: Editar processo de atendimento E recebo uma mensagem de sucesso Cenário: Preenche campos com informações inválidas - Quando eu preencho o campo "número SEI" com o valor "alilicece" - E preencho o campo "nome/tipo do processo" com "Processo Seletivo para admissão de alunos" - E preencho o campo "nome dos envolvidos" com "Genaína Rodrigues" + Quando eu preencho o campo "número SEI" com "alilicece" E preencho o campo "status" com "em andamento" E clico no botão "Confirmar" Então recebo uma mensagem de erro \ No newline at end of file diff --git a/features/step_definitions/adicionar_comentario_wiki.rb b/features/step_definitions/adicionar_comentario_wiki.rb index c6ce5639..96bf78ce 100644 --- a/features/step_definitions/adicionar_comentario_wiki.rb +++ b/features/step_definitions/adicionar_comentario_wiki.rb @@ -1,20 +1,8 @@ -Dado("cadastrado como usuario {string}, {string}, {string},") do |string, string2, string3| - pending # Write code here that turns the phrase above into concrete actions -end - -Dado("esteja na pagina da wiki de atendimento") do - pending # Write code here that turns the phrase above into concrete actions -end - Dado("eu seleciono um processo") do pending # Write code here that turns the phrase above into concrete actions end -Dado("eu clico no botão {string}") do |string| - pending # Write code here that turns the phrase above into concrete actions -end - -Quando("clico no botão {string}") do |string| +Quando(/clico no botão "([^"]*)"/) do |string| pending # Write code here that turns the phrase above into concrete actions end @@ -32,5 +20,4 @@ Então("recebo uma mensagem de erro") do pending # Write code here that turns the phrase above into concrete actions -end - +end \ No newline at end of file diff --git a/features/step_definitions/editar_processo_wiki.rb b/features/step_definitions/editar_processo_wiki.rb index 7378ed84..d3cdb4a6 100644 --- a/features/step_definitions/editar_processo_wiki.rb +++ b/features/step_definitions/editar_processo_wiki.rb @@ -1,4 +1,4 @@ -Dado("que eu esteja cadastrado como usuario {string}, {string}, {string},") do |email, password, role| +Dado("que eu esteja cadastrado como usuario {string}, {string}, {string},") do |string, string2, string3| pending # Write code here that turns the phrase above into concrete actions end @@ -6,38 +6,6 @@ pending # Write code here that turns the phrase above into concrete actions end -Dado("eu seleciono um processo") do - pending # Write code here that turns the phrase above into concrete actions -end - -Dado("eu clico no botão {string}") do |string| - pending # Write code here that turns the phrase above into concrete actions -end - -Quando("eu preencho o campo {string} com {string}") do |string, string2| - pending # Write code here that turns the phrase above into concrete actions -end - -Quando("clico no botão {string}") do |string| - pending # Write code here that turns the phrase above into concrete actions -end - -Então("sou redirecionado para a página da wiki de atendimento") do - pending # Write code here that turns the phrase above into concrete actions -end - -Então("recebo uma mensagem de sucesso") do - pending # Write code here that turns the phrase above into concrete actions -end - -Então("recebo uma mensagem de erro") do - pending # Write code here that turns the phrase above into concrete actions -end - -Quando("eu preencho o campo {string} com o valor {string}") do |string, string2| - pending # Write code here that turns the phrase above into concrete actions -end - -Quando("preencho o campo {string} com {string}") do |string, string2| +Quando(/preencho o campo "([^"]*)" com "([^"]*)"/) do |string, string2| pending # Write code here that turns the phrase above into concrete actions end diff --git a/spec/controllers/update_processo_wiki_spec.rb b/spec/controllers/update_processo_wiki_spec.rb index 05f7e010..f03ce71a 100644 --- a/spec/controllers/update_processo_wiki_spec.rb +++ b/spec/controllers/update_processo_wiki_spec.rb @@ -11,7 +11,7 @@ describe 'PUT #update' do it 'editar processo existente' do @processo = Processo.find(1) - @processo = Processo.update(numero_SEI:"0423-123477/2020", tipo_processo:"", nome_envolvidos: "", status:"finalizado") + @processo = Processo.update(numero_SEI:"0423-123477/2020", status:"finalizado") expect(@processo.numero_SEI).to eq('0423-123477/2020') expect(@processo.status).to eq('finalizado') end From 540d437ae1ff022a9e2a2b00f50924d4989d0c8a Mon Sep 17 00:00:00 2001 From: aliceborges_42 Date: Fri, 30 Oct 2020 23:39:49 -0300 Subject: [PATCH 11/45] renomeia criar processos --- features/novoprocesso.feature | 17 ----------------- 1 file changed, 17 deletions(-) delete mode 100644 features/novoprocesso.feature diff --git a/features/novoprocesso.feature b/features/novoprocesso.feature deleted file mode 100644 index 7d7e777d..00000000 --- a/features/novoprocesso.feature +++ /dev/null @@ -1,17 +0,0 @@ -#language: pt - -Funcionalidade: Cadastrar um novo processo na Wiki de atendimento - - COMO um secretario EU QUERO cadastrar um novo processo na Wiki de atendimento A FIM de disponibilizar informações para outros secretários. - - Contexto: - Dado que eu esteja logado como secretario "usuario_secretario@secretario.com", "123456", - E que esteja na página de atendimento da Wiki - - Cenário: Cadastrar um novo processo na Wiki de atendimento(caminho feliz) - Quando eu clicar "Adicionar processo" - Então eu devo estar na pagina Criar Novo processo - Quando eu preencher "numero SEI", "nome/tipo do processo", "nome dos envolvidos no processo", "status" - E eu clicar em "Criar Processo" - Então eu devo estar na página de atendimento - E eu devo ver o Processo de "Numero do processo" \ No newline at end of file From 36e6a5ece1bf63a5b887acef2fade4e18ad8a255 Mon Sep 17 00:00:00 2001 From: aliceborges_42 Date: Fri, 30 Oct 2020 23:41:16 -0300 Subject: [PATCH 12/45] atualiza arquivos .feature --- features/adicionar_comentario_wiki.feature | 8 +++---- features/anexar_novo_processo.feature | 23 ++++++++++++++++++++ features/anexar_processo.feature | 24 +++++++++++++++++++++ features/consultar_processo.feature | 21 ++++++++++++------ features/criar_processo.feature | 25 ++++++++++++++++++++++ features/editar_processo_wiki.feature | 12 +++++------ 6 files changed, 95 insertions(+), 18 deletions(-) create mode 100644 features/anexar_novo_processo.feature create mode 100644 features/anexar_processo.feature create mode 100644 features/criar_processo.feature diff --git a/features/adicionar_comentario_wiki.feature b/features/adicionar_comentario_wiki.feature index 90fa61c2..b35b7aab 100644 --- a/features/adicionar_comentario_wiki.feature +++ b/features/adicionar_comentario_wiki.feature @@ -9,18 +9,18 @@ Funcionalidade: Adicionar comentário a um processo de atendimento eu gostaria de adicionar um comentário nesse processo de atendimento. Contexto: - Dado que eu esteja cadastrado como usuario "alicinha@gatinha.com", "123456", "secretario", - E que esteja na pagina da wiki de atendimento + Dado que eu esteja conectado como usuario "alicinha@gatinha.com", "123456", "secretario" + E que esteja na página "processos de atendimento" E eu seleciono um processo E eu clico no botão "Adicionar comentário" Cenário: Preenche campo de comentário Quando eu preencho o campo "comentário" com "Processo acompanhado também pela professora Maristela Holanda" E clico no botão "Confirmar" - Então sou redirecionado para a página da wiki de atendimento + Então sou redirecionado para a página "processos de atendimento" E recebo uma mensagem de sucesso Cenário: Deixa o campo de comentário vazio - Quando eu não preencho o campo de comentário + Quando eu não preencho o campo "comentário" E clico no botão "Confirmar" Então recebo uma mensagem de erro \ No newline at end of file diff --git a/features/anexar_novo_processo.feature b/features/anexar_novo_processo.feature new file mode 100644 index 00000000..a52826ce --- /dev/null +++ b/features/anexar_novo_processo.feature @@ -0,0 +1,23 @@ +#language:pt + +Funcionalidade: Anexar arquivo a um processo existente + Como um secretário, + para que eu possa detalhar mais os processos da Wiki, + eu gostaria de anexar um ou mais documentos em um processo já existente + + Contexto: + Dado que eu esteja conectado como usuario "usuario_secretario@secretario.com", "123456", "secretario" + E que esteja na página "processos de atendimento" + E clico no botão "Adicionar processo" + + Cenário: Anexar um arquivo válido + Quando eu clico no botão "Adicionar documento" + E envio o arquivo "documento.pdf" + E clico no botão "Confirmar" + Então sou redirecionado para a página "processos de atendimento" + E recebo uma mensagem de sucesso + + Cenário: Anexar arquivo nválido + Quando eu clico no botão "Adicionar documento" + E envio o arquivo "Pabllo_Vittar_seu_crime.mp4" + Então recebo uma mensagem de erro \ No newline at end of file diff --git a/features/anexar_processo.feature b/features/anexar_processo.feature new file mode 100644 index 00000000..2b55a654 --- /dev/null +++ b/features/anexar_processo.feature @@ -0,0 +1,24 @@ +#language:pt + +Funcionalidade: Anexar arquivo a um processo existente + Como um secretário, + para que eu possa detalhar mais os processos da Wiki, + eu gostaria de anexar um ou mais documentos em um processo já existente + + Contexto: + Dado que eu esteja conectado como usuario "alicinha@gatinha.com", "123456", "secretario" + E que esteja na página "processos de atendimentoo" + E seleciono um processo + E clico no botão "Editar processo" + + Cenário: Anexar um arquivo válido + Quando eu clico no botão "Adicionar documento" + E envio o arquivo "documento.pdf" + E clico no botão "Confirmar" + Então sou redirecionado para a página "processos de atendimentoo" + E recebo uma mensagem de sucesso + + Cenário: Anexar arquivo nválido + Quando eu clico no botão "Adicionar documento" + E envio o arquivo "Pabllo_Vittar_seu_crime.mp4" + Então recebo uma mensagem de erro \ No newline at end of file diff --git a/features/consultar_processo.feature b/features/consultar_processo.feature index 9966b579..8ab80278 100644 --- a/features/consultar_processo.feature +++ b/features/consultar_processo.feature @@ -1,14 +1,21 @@ +#language: pt Funcionalidade: Consultar processo de atendimento na Wiki Como um secretário, Quero consultar uma entrada na Wiki sobre um processo de atendimento, Para que eu possa me informar sobre como um processo é realizado Contexto: - Dado que eu esteja cadastrado como secretario "secretary@secretary.com", "admin123", "secretary", - E que esteja logado, - E que esteja na página de atendimento da Wiki - E eu clicar no link "Ver detalhes" + Dado que eu esteja conectado como usuario "usuario_secretario@secretario.com", "123456", "secretario" + E que esteja na página "processos de atendimento" + E seleciono um processo + E eu clicar no botão "Ver detalhes" - Cenário: Consultar um processo de atendimento - Quando eu clicar no botão "Ver detalhes" - Então eu devo estar em uma página com as informações do processo + Cenário: Consultar um processo de atendimento existente + Então sou redirecionado para a página "informações do processo" + E devo poder visualizar o "número SEI" + E devo poder visualizar a "responsável" + E devo poder visualizar o "status" + E devo poder visualizar os "documentos" + + Cenário: Consultar um processo de atendimento inexistente + Então recebo uma mensagem de erro diff --git a/features/criar_processo.feature b/features/criar_processo.feature new file mode 100644 index 00000000..d9f3a780 --- /dev/null +++ b/features/criar_processo.feature @@ -0,0 +1,25 @@ +#language: pt + +Funcionalidade: Cadastrar um novo processo na Wiki de atendimento + + COMO um secretario + EU QUERO cadastrar um novo processo na Wiki de atendimento + A FIM de disponibilizar informações para outros secretários. + + Contexto: + Dado que eu esteja conectado como usuario "usuario_secretario@secretario.com", "123456", "secretario" + E que esteja na página "processos de atendimento" + E clico no botão "Adicionar processo" + + Cenário: Preenche campos com informações válidas(caminho feliz) + Quando eu preencho o campo "número SEI" com "0423-123456/2017" + E preencho o campo "reponsável" com "Genaína Rodrigues" + E seleciono o "status" "em andamento" + E clico no botão "Confirmar" + Então sou redirecionado para a página "processos de atendimento" + E recebo uma mensagem de sucesso + + Cenário: Preenche campos com informações inválidas + Quando eu preencho o campo "número SEI" com "alilicece" + E clico no botão "Confirmar" + Então recebo uma mensagem de erro \ No newline at end of file diff --git a/features/editar_processo_wiki.feature b/features/editar_processo_wiki.feature index 45018421..c5b75b92 100644 --- a/features/editar_processo_wiki.feature +++ b/features/editar_processo_wiki.feature @@ -8,22 +8,20 @@ Funcionalidade: Editar processo de atendimento eu gostaria de editar um processo de atendimento já cadastrado Contexto: - Dado que eu esteja cadastrado como usuario "alicinha@gatinha.com", "123456", "secretario", - E que esteja na pagina da wiki de atendimento + Dado que eu esteja conectado como usuario "alicinha@gatinha.com", "123456", "secretario" + E que esteja na página "processos de atendimento" E eu seleciono um processo E eu clico no botão "Editar processo" Cenário: Preenche campos com informações válidas Quando eu preencho o campo "número SEI" com "0423-123456/2017" - E preencho o campo "nome/tipo do processo" com "Processo Seletivo para admissão de alunos" - E preencho o campo "nome dos envolvidos" com "Genaína Rodrigues" - E preencho o campo "status" com "em andamento" + E preencho o campo "reponsável" com "Genaína Rodrigues" + E seleciono o "status" "em andamento" E clico no botão "Confirmar" - Então sou redirecionado para a página da wiki de atendimento + Então sou redirecionado para a página "processos de atendimento" E recebo uma mensagem de sucesso Cenário: Preenche campos com informações inválidas Quando eu preencho o campo "número SEI" com "alilicece" - E preencho o campo "status" com "em andamento" E clico no botão "Confirmar" Então recebo uma mensagem de erro \ No newline at end of file From 6262435c23090ddb0cf12a6b5d1001656e885cd6 Mon Sep 17 00:00:00 2001 From: aliceborges_42 Date: Fri, 30 Oct 2020 23:42:09 -0300 Subject: [PATCH 13/45] atualiza arquivos de step definitions --- features/step_definitions/processos_steps.rb | 6 ++++ features/step_definitions/shared_steps.rb | 36 ++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 features/step_definitions/processos_steps.rb create mode 100644 features/step_definitions/shared_steps.rb diff --git a/features/step_definitions/processos_steps.rb b/features/step_definitions/processos_steps.rb new file mode 100644 index 00000000..29a5d769 --- /dev/null +++ b/features/step_definitions/processos_steps.rb @@ -0,0 +1,6 @@ +Dado(/seleciono um processo/) do + pending # Write code here that turns the phrase above into concrete actions +end + + + \ No newline at end of file diff --git a/features/step_definitions/shared_steps.rb b/features/step_definitions/shared_steps.rb new file mode 100644 index 00000000..5a01237a --- /dev/null +++ b/features/step_definitions/shared_steps.rb @@ -0,0 +1,36 @@ +Quando(/(?:clico|clicar) no botão "([^"]*)"/) do |botao| + pending # Write code here that turns the phrase above into concrete actions +end + +Então(/recebo uma mensagem de (sucesso|erro)/) do |status| + pending # Write code here that turns the phrase above into concrete actions +end + +Quando(/não preencho o campo "([^"]*)"/) do |campo| + pending # Write code here that turns the phrase above into concrete actions +end + +Quando(/preencho o campo "([^"]*)" com "([^"]*)"/) do |campo, valor| + pending # Write code here that turns the phrase above into concrete actions +end + +Dado(/(?:esteja na|redirecionado para a) página "([^"]*)"/) do |pagina| + pending # Write code here that turns the phrase above into concrete actions +end + +Dado(/esteja conectado como usuario "([^"]*)", "([^"]*)", "([^"]*)"/) do |usuario, senha, funcao| + pending # Write code here that turns the phrase above into concrete actions +end + +Quando(/visualizar (?:o|a|os|as) "([^"]*)"/) do |elemento| + pending +end + +Quando(/seleciono (?:o|a|os|as) "([^"]*)" "([^"]*)"/) do |campo, valor| + pending +end + +Quando(/envio o arquivo "([^"]*)"/) do |arquivo| + pending # Write code here that turns the phrase above into concrete actions +end + \ No newline at end of file From c9f3e54450069f1d09ad7adfd7080aac9b12cd43 Mon Sep 17 00:00:00 2001 From: aliceborges_42 Date: Fri, 30 Oct 2020 23:43:32 -0300 Subject: [PATCH 14/45] Faz rspec das controllers --- spec/controllers/processos_controller_spec.rb | 56 ++++++++++++++----- 1 file changed, 42 insertions(+), 14 deletions(-) diff --git a/spec/controllers/processos_controller_spec.rb b/spec/controllers/processos_controller_spec.rb index 2749756c..8bf3d14e 100644 --- a/spec/controllers/processos_controller_spec.rb +++ b/spec/controllers/processos_controller_spec.rb @@ -2,24 +2,52 @@ require 'capybara/rails' RSpec.describe ProcessosController, type: :controller do - before(:each) do - @secretario = User.new(email: 'usuario_secretario@secretario.com', password: '123456', is_secretary:true) - @secretario.save! - sign_in @secretario + describe "#create" do + it 'calls the create method from the Processos model' + describe "valid params" do + it 'saves the process in DB' + it "responds with an success HTTP status" + it 'redirects to process index page' + end + describe "invalid params" do + it "doesn't save the process in DB" + it "responds with an error HTTP status" + end end - describe 'GET#show' do - it 'deve exibir informações do processo selecionado' do - get :show, params: {id: processo.to_param} - expect(response).to be_successful - expect(response).to have_http_status(200) + describe "#update" do + it 'calls the update method from an instance of the Processos model' + describe "valid params" do + it 'updates the process data in the DB' + it "responds with an success HTTP status" + it 'redirects to process index page' end + describe "invalid params" do + it "doesn't update the process data in the DB" + it "responds with an error HTTP status" + end end -end - describe 'POST #create' do - it 'criar um novo processo' do - @processo = Processo.create(num_SEI:123, tipo: 1, nome_envolvidos:"Joao, Maria, Luizinho", status: "pending") - @processo.should be_an_instante_of Processo + + describe "#show" do + describe "valid process" do + it "responds with an success HTTP status" + it 'redirects to process show page' + end + describe "invalid process" do + it "responds with an error HTTP status" + end + end + + describe "add comment" do + it "calls the create method from the Comentarios model" + describe "valid params" do + it 'saves the comment in DB' + it "responds with an success HTTP status" + it 'redirects to comment index page' end + describe "invalid params" do + it "doesn't save the comment in DB" + it "responds with an error HTTP status" + end end end From 3617df3c1cf2c62a55d43a31130964602bb8395d Mon Sep 17 00:00:00 2001 From: aliceborges_42 Date: Fri, 30 Oct 2020 23:44:26 -0300 Subject: [PATCH 15/45] Faz rspec das models de comentarios e processos --- spec/models/comentarios_spec.rb | 9 +++++++++ spec/models/processos_spec.rb | 19 +++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 spec/models/comentarios_spec.rb create mode 100644 spec/models/processos_spec.rb diff --git a/spec/models/comentarios_spec.rb b/spec/models/comentarios_spec.rb new file mode 100644 index 00000000..45169498 --- /dev/null +++ b/spec/models/comentarios_spec.rb @@ -0,0 +1,9 @@ +require 'rails_helper' + +RSpec.describe Comentario, type: :model do + describe "#create" do + it "should create a process comment when the attribute are valid" + it "should not create a process comment when the content is blank" + it "should not create a content when the conten id too large" + end +end diff --git a/spec/models/processos_spec.rb b/spec/models/processos_spec.rb new file mode 100644 index 00000000..26976d75 --- /dev/null +++ b/spec/models/processos_spec.rb @@ -0,0 +1,19 @@ +require 'rails_helper' + +RSpec.describe Processos, type: :model do + describe "#create" do + it 'should create a new process when the attributes are valid' + it 'should not create a new process when the sei_process_code is not a valid code' + it 'should not create a new process when there is no assigned user' + it 'should not create a new process when the process_status_id is invalid' + it 'should not create a new process when trying to attach an invalid file ' + end + + describe "#update" do + it 'should update the process when the attributes are valid' + it 'should not update the process when the sei_process_code is not a valid code' + it 'should not update the process when there is no assigned user' + it 'should not update the process when the process_status_id is invalid' + it 'should not update the process when trying to attach an invalid file' + end +end From 2faf312aff4988ebb9b3f36bbee8e9908fc1347f Mon Sep 17 00:00:00 2001 From: aliceborges_42 Date: Fri, 30 Oct 2020 23:44:40 -0300 Subject: [PATCH 16/45] apaga lixo --- .../adicionar_comentario_wiki.rb | 23 -------------- .../step_definitions/consultar_processo.rb | 19 ------------ .../step_definitions/editar_processo_wiki.rb | 11 ------- .../step_definitions/novoprocesso_steps.rb | 31 ------------------- .../adicionar_comentario_processo_wiki.rb | 18 ----------- spec/controllers/update_processo_wiki_spec.rb | 19 ------------ 6 files changed, 121 deletions(-) delete mode 100644 features/step_definitions/adicionar_comentario_wiki.rb delete mode 100644 features/step_definitions/consultar_processo.rb delete mode 100644 features/step_definitions/editar_processo_wiki.rb delete mode 100644 features/step_definitions/novoprocesso_steps.rb delete mode 100644 spec/controllers/adicionar_comentario_processo_wiki.rb delete mode 100644 spec/controllers/update_processo_wiki_spec.rb diff --git a/features/step_definitions/adicionar_comentario_wiki.rb b/features/step_definitions/adicionar_comentario_wiki.rb deleted file mode 100644 index 96bf78ce..00000000 --- a/features/step_definitions/adicionar_comentario_wiki.rb +++ /dev/null @@ -1,23 +0,0 @@ -Dado("eu seleciono um processo") do - pending # Write code here that turns the phrase above into concrete actions -end - -Quando(/clico no botão "([^"]*)"/) do |string| - pending # Write code here that turns the phrase above into concrete actions -end - -Então("sou redirecionado para a página da wiki de atendimento") do - pending # Write code here that turns the phrase above into concrete actions -end - -Então("recebo uma mensagem de sucesso") do - pending # Write code here that turns the phrase above into concrete actions -end - -Quando("eu não preencho o campo de comentário") do - pending # Write code here that turns the phrase above into concrete actions -end - -Então("recebo uma mensagem de erro") do - pending # Write code here that turns the phrase above into concrete actions -end \ No newline at end of file diff --git a/features/step_definitions/consultar_processo.rb b/features/step_definitions/consultar_processo.rb deleted file mode 100644 index 656436b9..00000000 --- a/features/step_definitions/consultar_processo.rb +++ /dev/null @@ -1,19 +0,0 @@ -Dado("que eu esteja cadastrado como usuario {string}, {string}, {string},") do |string, string2, string3| - pending # Write code here that turns the phrase above into concrete actions - end - - Dado("que esteja logado") do - pending # Write code here that turns the phrase above into concrete actions - end - - Dado("que esteja na pagina da wiki de atendimento") do - pending # Write code here that turns the phrase above into concrete actions - end - - Quando("eu clicar no botão {string}") do |string| - pending # Write code here that turns the phrase above into concrete actions - end - - Então("devo visualizar as informações do processo") do - pending # Write code here that turns the phrase above into concrete actions - end \ No newline at end of file diff --git a/features/step_definitions/editar_processo_wiki.rb b/features/step_definitions/editar_processo_wiki.rb deleted file mode 100644 index d3cdb4a6..00000000 --- a/features/step_definitions/editar_processo_wiki.rb +++ /dev/null @@ -1,11 +0,0 @@ -Dado("que eu esteja cadastrado como usuario {string}, {string}, {string},") do |string, string2, string3| - pending # Write code here that turns the phrase above into concrete actions -end - -Dado("que esteja na pagina da wiki de atendimento") do - pending # Write code here that turns the phrase above into concrete actions -end - -Quando(/preencho o campo "([^"]*)" com "([^"]*)"/) do |string, string2| - pending # Write code here that turns the phrase above into concrete actions -end diff --git a/features/step_definitions/novoprocesso_steps.rb b/features/step_definitions/novoprocesso_steps.rb deleted file mode 100644 index dd0cee08..00000000 --- a/features/step_definitions/novoprocesso_steps.rb +++ /dev/null @@ -1,31 +0,0 @@ -Dado("que eu esteja logado como secretario {string}, {string},") do |string, string2| - pending # Write code here that turns the phrase above into concrete actions -end - -Dado("que esteja na página de atendimento da Wiki") do - pending # Write code here that turns the phrase above into concrete actions -end - -Quando("eu clicar {string}") do |string| - pending # Write code here that turns the phrase above into concrete actions -end - -Então("eu devo estar na pagina Criar Novo processo") do - pending # Write code here that turns the phrase above into concrete actions -end - -Quando("eu preencher {string}, {string}, {string}, {string}") do |string, string2, string3, string4| - pending # Write code here that turns the phrase above into concrete actions -end - -Quando("eu clicar em {string}") do |string| - pending # Write code here that turns the phrase above into concrete actions -end - -Então("eu devo estar na página de atendimento") do - pending # Write code here that turns the phrase above into concrete actions -end - -Então("eu devo ver o Processo de {string}") do |string| - pending # Write code here that turns the phrase above into concrete actions -end \ No newline at end of file diff --git a/spec/controllers/adicionar_comentario_processo_wiki.rb b/spec/controllers/adicionar_comentario_processo_wiki.rb deleted file mode 100644 index b3fcf13f..00000000 --- a/spec/controllers/adicionar_comentario_processo_wiki.rb +++ /dev/null @@ -1,18 +0,0 @@ -require 'rails_helper' -require 'capybara/rails' - -RSpec.describe ProcessosController, type: :controller do - before(:each) do - @secretario = User.new(email: 'teste@teste.com', password: '123456', is_secretary:true) - @secretario.save! - sign_in @secretario - end - - describe 'POST #create' do - it 'adicionar um comentário' do - @processo = Processo.find(1) - @comentario = Comentario.create(id: 1, id_process: 1, text:'Acompanhando o Processo') - @comentario.should be_an_instante_of Comentario - end - end -end \ No newline at end of file diff --git a/spec/controllers/update_processo_wiki_spec.rb b/spec/controllers/update_processo_wiki_spec.rb deleted file mode 100644 index f03ce71a..00000000 --- a/spec/controllers/update_processo_wiki_spec.rb +++ /dev/null @@ -1,19 +0,0 @@ -require 'rails_helper' -require 'capybara/rails' - -RSpec.describe ProcessosController, type: :controller do - before(:each) do - @secretario = User.new(email: 'usuario_secretario@secretario.com', password: '123456', is_secretary:true) - @secretario.save! - sign_in @secretario - end - - describe 'PUT #update' do - it 'editar processo existente' do - @processo = Processo.find(1) - @processo = Processo.update(numero_SEI:"0423-123477/2020", status:"finalizado") - expect(@processo.numero_SEI).to eq('0423-123477/2020') - expect(@processo.status).to eq('finalizado') - end - end -end \ No newline at end of file From 315b079b95e6efa5d9ef7532d895ffe078474f69 Mon Sep 17 00:00:00 2001 From: aliceborges_42 Date: Wed, 11 Nov 2020 16:37:16 -0300 Subject: [PATCH 17/45] scaffold da tabela wiki e comentario --- app/assets/javascripts/comentarios.coffee | 3 + app/assets/javascripts/wikis.coffee | 3 + app/assets/stylesheets/comentarios.scss | 3 + app/assets/stylesheets/scaffolds.scss | 84 +++++++++++ app/assets/stylesheets/wikis.scss | 3 + app/controllers/comentarios_controller.rb | 74 +++++++++ app/controllers/wikis_controller.rb | 74 +++++++++ app/helpers/comentarios_helper.rb | 2 + app/helpers/wikis_helper.rb | 2 + app/models/comentario.rb | 2 + app/models/wiki.rb | 2 + .../comentarios/_comentario.json.jbuilder | 2 + app/views/comentarios/_form.html.erb | 22 +++ app/views/comentarios/edit.html.erb | 6 + app/views/comentarios/index.html.erb | 27 ++++ app/views/comentarios/index.json.jbuilder | 1 + app/views/comentarios/new.html.erb | 5 + app/views/comentarios/show.html.erb | 9 ++ app/views/comentarios/show.json.jbuilder | 1 + app/views/wikis/_form.html.erb | 27 ++++ app/views/wikis/_wiki.json.jbuilder | 2 + app/views/wikis/edit.html.erb | 6 + app/views/wikis/index.html.erb | 29 ++++ app/views/wikis/index.json.jbuilder | 1 + app/views/wikis/new.html.erb | 5 + app/views/wikis/show.html.erb | 14 ++ app/views/wikis/show.json.jbuilder | 1 + config/routes.rb | 2 + db/migrate/20201111004117_create_wikis.rb | 10 ++ .../20201111010011_create_comentarios.rb | 9 ++ features/criar_processo.feature | 2 +- features/step_definitions/shared_steps.rb | 13 +- .../comentarios_controller_spec.rb | 141 ++++++++++++++++++ spec/controllers/home_controller_spec.rb | 12 -- spec/controllers/processos_controller_spec.rb | 53 ------- spec/controllers/wikis_controller_spec.rb | 141 ++++++++++++++++++ spec/helpers/comentarios_helper_spec.rb | 15 ++ spec/helpers/wikis_helper_spec.rb | 15 ++ spec/models/comentario_spec.rb | 5 + spec/models/comentarios_spec.rb | 9 -- spec/models/processos_spec.rb | 19 --- spec/models/{user_spec.rb => wiki_spec.rb} | 2 +- spec/requests/comentarios_spec.rb | 10 ++ spec/requests/wikis_spec.rb | 10 ++ spec/routing/comentarios_routing_spec.rb | 38 +++++ spec/routing/wikis_routing_spec.rb | 38 +++++ spec/views/comentarios/edit.html.erb_spec.rb | 18 +++ spec/views/comentarios/index.html.erb_spec.rb | 19 +++ spec/views/comentarios/new.html.erb_spec.rb | 18 +++ spec/views/comentarios/show.html.erb_spec.rb | 14 ++ spec/views/wikis/edit.html.erb_spec.rb | 21 +++ spec/views/wikis/index.html.erb_spec.rb | 22 +++ spec/views/wikis/new.html.erb_spec.rb | 21 +++ spec/views/wikis/show.html.erb_spec.rb | 16 ++ 54 files changed, 1005 insertions(+), 98 deletions(-) create mode 100644 app/assets/javascripts/comentarios.coffee create mode 100644 app/assets/javascripts/wikis.coffee create mode 100644 app/assets/stylesheets/comentarios.scss create mode 100644 app/assets/stylesheets/scaffolds.scss create mode 100644 app/assets/stylesheets/wikis.scss create mode 100644 app/controllers/comentarios_controller.rb create mode 100644 app/controllers/wikis_controller.rb create mode 100644 app/helpers/comentarios_helper.rb create mode 100644 app/helpers/wikis_helper.rb create mode 100644 app/models/comentario.rb create mode 100644 app/models/wiki.rb create mode 100644 app/views/comentarios/_comentario.json.jbuilder create mode 100644 app/views/comentarios/_form.html.erb create mode 100644 app/views/comentarios/edit.html.erb create mode 100644 app/views/comentarios/index.html.erb create mode 100644 app/views/comentarios/index.json.jbuilder create mode 100644 app/views/comentarios/new.html.erb create mode 100644 app/views/comentarios/show.html.erb create mode 100644 app/views/comentarios/show.json.jbuilder create mode 100644 app/views/wikis/_form.html.erb create mode 100644 app/views/wikis/_wiki.json.jbuilder create mode 100644 app/views/wikis/edit.html.erb create mode 100644 app/views/wikis/index.html.erb create mode 100644 app/views/wikis/index.json.jbuilder create mode 100644 app/views/wikis/new.html.erb create mode 100644 app/views/wikis/show.html.erb create mode 100644 app/views/wikis/show.json.jbuilder create mode 100644 db/migrate/20201111004117_create_wikis.rb create mode 100644 db/migrate/20201111010011_create_comentarios.rb create mode 100644 spec/controllers/comentarios_controller_spec.rb delete mode 100644 spec/controllers/home_controller_spec.rb delete mode 100644 spec/controllers/processos_controller_spec.rb create mode 100644 spec/controllers/wikis_controller_spec.rb create mode 100644 spec/helpers/comentarios_helper_spec.rb create mode 100644 spec/helpers/wikis_helper_spec.rb create mode 100644 spec/models/comentario_spec.rb delete mode 100644 spec/models/comentarios_spec.rb delete mode 100644 spec/models/processos_spec.rb rename spec/models/{user_spec.rb => wiki_spec.rb} (69%) create mode 100644 spec/requests/comentarios_spec.rb create mode 100644 spec/requests/wikis_spec.rb create mode 100644 spec/routing/comentarios_routing_spec.rb create mode 100644 spec/routing/wikis_routing_spec.rb create mode 100644 spec/views/comentarios/edit.html.erb_spec.rb create mode 100644 spec/views/comentarios/index.html.erb_spec.rb create mode 100644 spec/views/comentarios/new.html.erb_spec.rb create mode 100644 spec/views/comentarios/show.html.erb_spec.rb create mode 100644 spec/views/wikis/edit.html.erb_spec.rb create mode 100644 spec/views/wikis/index.html.erb_spec.rb create mode 100644 spec/views/wikis/new.html.erb_spec.rb create mode 100644 spec/views/wikis/show.html.erb_spec.rb diff --git a/app/assets/javascripts/comentarios.coffee b/app/assets/javascripts/comentarios.coffee new file mode 100644 index 00000000..24f83d18 --- /dev/null +++ b/app/assets/javascripts/comentarios.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/javascripts/wikis.coffee b/app/assets/javascripts/wikis.coffee new file mode 100644 index 00000000..24f83d18 --- /dev/null +++ b/app/assets/javascripts/wikis.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/comentarios.scss b/app/assets/stylesheets/comentarios.scss new file mode 100644 index 00000000..df69af76 --- /dev/null +++ b/app/assets/stylesheets/comentarios.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the Comentarios controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/scaffolds.scss b/app/assets/stylesheets/scaffolds.scss new file mode 100644 index 00000000..60451880 --- /dev/null +++ b/app/assets/stylesheets/scaffolds.scss @@ -0,0 +1,84 @@ +body { + background-color: #fff; + color: #333; + margin: 33px; + font-family: verdana, arial, helvetica, sans-serif; + font-size: 13px; + line-height: 18px; +} + +p, ol, ul, td { + font-family: verdana, arial, helvetica, sans-serif; + font-size: 13px; + line-height: 18px; +} + +pre { + background-color: #eee; + padding: 10px; + font-size: 11px; +} + +a { + color: #000; + + &:visited { + color: #666; + } + + &:hover { + color: #fff; + background-color: #000; + } +} + +th { + padding-bottom: 5px; +} + +td { + padding: 0 5px 7px; +} + +div { + &.field, &.actions { + margin-bottom: 10px; + } +} + +#notice { + color: green; +} + +.field_with_errors { + padding: 2px; + background-color: red; + display: table; +} + +#error_explanation { + width: 450px; + border: 2px solid red; + padding: 7px 7px 0; + margin-bottom: 20px; + background-color: #f0f0f0; + + h2 { + text-align: left; + font-weight: bold; + padding: 5px 5px 5px 15px; + font-size: 12px; + margin: -7px -7px 0; + background-color: #c00; + color: #fff; + } + + ul li { + font-size: 12px; + list-style: square; + } +} + +label { + display: block; +} diff --git a/app/assets/stylesheets/wikis.scss b/app/assets/stylesheets/wikis.scss new file mode 100644 index 00000000..6534d6dd --- /dev/null +++ b/app/assets/stylesheets/wikis.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the Wikis 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/comentarios_controller.rb b/app/controllers/comentarios_controller.rb new file mode 100644 index 00000000..7aefc8b3 --- /dev/null +++ b/app/controllers/comentarios_controller.rb @@ -0,0 +1,74 @@ +class ComentariosController < ApplicationController + before_action :set_comentario, only: [:show, :edit, :update, :destroy] + + # GET /comentarios + # GET /comentarios.json + def index + @comentarios = Comentario.all + end + + # GET /comentarios/1 + # GET /comentarios/1.json + def show + end + + # GET /comentarios/new + def new + @comentario = Comentario.new + end + + # GET /comentarios/1/edit + def edit + end + + # POST /comentarios + # POST /comentarios.json + def create + @comentario = Comentario.new(comentario_params) + + respond_to do |format| + if @comentario.save + format.html { redirect_to @comentario, notice: 'Comentario was successfully created.' } + format.json { render :show, status: :created, location: @comentario } + else + format.html { render :new } + format.json { render json: @comentario.errors, status: :unprocessable_entity } + end + end + end + + # PATCH/PUT /comentarios/1 + # PATCH/PUT /comentarios/1.json + def update + respond_to do |format| + if @comentario.update(comentario_params) + format.html { redirect_to @comentario, notice: 'Comentario was successfully updated.' } + format.json { render :show, status: :ok, location: @comentario } + else + format.html { render :edit } + format.json { render json: @comentario.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /comentarios/1 + # DELETE /comentarios/1.json + def destroy + @comentario.destroy + respond_to do |format| + format.html { redirect_to comentarios_url, notice: 'Comentario was successfully destroyed.' } + format.json { head :no_content } + end + end + + private + # Use callbacks to share common setup or constraints between actions. + def set_comentario + @comentario = Comentario.find(params[:id]) + end + + # Never trust parameters from the scary internet, only allow the white list through. + def comentario_params + params.require(:comentario).permit(:content) + end +end diff --git a/app/controllers/wikis_controller.rb b/app/controllers/wikis_controller.rb new file mode 100644 index 00000000..33cf8ad0 --- /dev/null +++ b/app/controllers/wikis_controller.rb @@ -0,0 +1,74 @@ +class WikisController < ApplicationController + before_action :set_wiki, only: [:show, :edit, :update, :destroy] + + # GET /wikis + # GET /wikis.json + def index + @wikis = Wiki.all + end + + # GET /wikis/1 + # GET /wikis/1.json + def show + end + + # GET /wikis/new + def new + @wiki = Wiki.new + end + + # GET /wikis/1/edit + def edit + end + + # POST /wikis + # POST /wikis.json + def create + @wiki = Wiki.new(wiki_params) + + respond_to do |format| + if @wiki.save + format.html { redirect_to @wiki, notice: 'Wiki was successfully created.' } + format.json { render :show, status: :created, location: @wiki } + else + format.html { render :new } + format.json { render json: @wiki.errors, status: :unprocessable_entity } + end + end + end + + # PATCH/PUT /wikis/1 + # PATCH/PUT /wikis/1.json + def update + respond_to do |format| + if @wiki.update(wiki_params) + format.html { redirect_to @wiki, notice: 'Wiki was successfully updated.' } + format.json { render :show, status: :ok, location: @wiki } + else + format.html { render :edit } + format.json { render json: @wiki.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /wikis/1 + # DELETE /wikis/1.json + def destroy + @wiki.destroy + respond_to do |format| + format.html { redirect_to wikis_url, notice: 'Wiki was successfully destroyed.' } + format.json { head :no_content } + end + end + + private + # Use callbacks to share common setup or constraints between actions. + def set_wiki + @wiki = Wiki.find(params[:id]) + end + + # Never trust parameters from the scary internet, only allow the white list through. + def wiki_params + params.require(:wiki).permit(:title, :content) + end +end diff --git a/app/helpers/comentarios_helper.rb b/app/helpers/comentarios_helper.rb new file mode 100644 index 00000000..a8f928b0 --- /dev/null +++ b/app/helpers/comentarios_helper.rb @@ -0,0 +1,2 @@ +module ComentariosHelper +end diff --git a/app/helpers/wikis_helper.rb b/app/helpers/wikis_helper.rb new file mode 100644 index 00000000..bb168351 --- /dev/null +++ b/app/helpers/wikis_helper.rb @@ -0,0 +1,2 @@ +module WikisHelper +end diff --git a/app/models/comentario.rb b/app/models/comentario.rb new file mode 100644 index 00000000..f485ee06 --- /dev/null +++ b/app/models/comentario.rb @@ -0,0 +1,2 @@ +class Comentario < ApplicationRecord +end diff --git a/app/models/wiki.rb b/app/models/wiki.rb new file mode 100644 index 00000000..ffb83a36 --- /dev/null +++ b/app/models/wiki.rb @@ -0,0 +1,2 @@ +class Wiki < ApplicationRecord +end diff --git a/app/views/comentarios/_comentario.json.jbuilder b/app/views/comentarios/_comentario.json.jbuilder new file mode 100644 index 00000000..db67448b --- /dev/null +++ b/app/views/comentarios/_comentario.json.jbuilder @@ -0,0 +1,2 @@ +json.extract! comentario, :id, :content, :created_at, :updated_at +json.url comentario_url(comentario, format: :json) diff --git a/app/views/comentarios/_form.html.erb b/app/views/comentarios/_form.html.erb new file mode 100644 index 00000000..be21c7a2 --- /dev/null +++ b/app/views/comentarios/_form.html.erb @@ -0,0 +1,22 @@ +<%= form_with(model: comentario, local: true) do |form| %> + <% if comentario.errors.any? %> +
+

<%= pluralize(comentario.errors.count, "error") %> prohibited this comentario from being saved:

+ +
    + <% comentario.errors.full_messages.each do |message| %> +
  • <%= message %>
  • + <% end %> +
+
+ <% end %> + +
+ <%= form.label :content %> + <%= form.text_area :content %> +
+ +
+ <%= form.submit %> +
+<% end %> diff --git a/app/views/comentarios/edit.html.erb b/app/views/comentarios/edit.html.erb new file mode 100644 index 00000000..0d68e5fd --- /dev/null +++ b/app/views/comentarios/edit.html.erb @@ -0,0 +1,6 @@ +

Editing Comentario

+ +<%= render 'form', comentario: @comentario %> + +<%= link_to 'Show', @comentario %> | +<%= link_to 'Back', comentarios_path %> diff --git a/app/views/comentarios/index.html.erb b/app/views/comentarios/index.html.erb new file mode 100644 index 00000000..e0155f7c --- /dev/null +++ b/app/views/comentarios/index.html.erb @@ -0,0 +1,27 @@ +

<%= notice %>

+ +

Comentarios

+ + + + + + + + + + + <% @comentarios.each do |comentario| %> + + + + + + + <% end %> + +
Content
<%= comentario.content %><%= link_to 'Show', comentario %><%= link_to 'Edit', edit_comentario_path(comentario) %><%= link_to 'Destroy', comentario, method: :delete, data: { confirm: 'Are you sure?' } %>
+ +
+ +<%= link_to 'New Comentario', new_comentario_path %> diff --git a/app/views/comentarios/index.json.jbuilder b/app/views/comentarios/index.json.jbuilder new file mode 100644 index 00000000..4bf60503 --- /dev/null +++ b/app/views/comentarios/index.json.jbuilder @@ -0,0 +1 @@ +json.array! @comentarios, partial: "comentarios/comentario", as: :comentario diff --git a/app/views/comentarios/new.html.erb b/app/views/comentarios/new.html.erb new file mode 100644 index 00000000..adc8b541 --- /dev/null +++ b/app/views/comentarios/new.html.erb @@ -0,0 +1,5 @@ +

New Comentario

+ +<%= render 'form', comentario: @comentario %> + +<%= link_to 'Back', comentarios_path %> diff --git a/app/views/comentarios/show.html.erb b/app/views/comentarios/show.html.erb new file mode 100644 index 00000000..42097ae5 --- /dev/null +++ b/app/views/comentarios/show.html.erb @@ -0,0 +1,9 @@ +

<%= notice %>

+ +

+ Content: + <%= @comentario.content %> +

+ +<%= link_to 'Edit', edit_comentario_path(@comentario) %> | +<%= link_to 'Back', comentarios_path %> diff --git a/app/views/comentarios/show.json.jbuilder b/app/views/comentarios/show.json.jbuilder new file mode 100644 index 00000000..d084a63e --- /dev/null +++ b/app/views/comentarios/show.json.jbuilder @@ -0,0 +1 @@ +json.partial! "comentarios/comentario", comentario: @comentario diff --git a/app/views/wikis/_form.html.erb b/app/views/wikis/_form.html.erb new file mode 100644 index 00000000..e624566a --- /dev/null +++ b/app/views/wikis/_form.html.erb @@ -0,0 +1,27 @@ +<%= form_with(model: wiki, local: true) do |form| %> + <% if wiki.errors.any? %> +
+

<%= pluralize(wiki.errors.count, "error") %> prohibited this wiki from being saved:

+ +
    + <% wiki.errors.full_messages.each do |message| %> +
  • <%= message %>
  • + <% end %> +
+
+ <% end %> + +
+ <%= form.label :title %> + <%= form.text_field :title %> +
+ +
+ <%= form.label :content %> + <%= form.text_area :content %> +
+ +
+ <%= form.submit %> +
+<% end %> diff --git a/app/views/wikis/_wiki.json.jbuilder b/app/views/wikis/_wiki.json.jbuilder new file mode 100644 index 00000000..dccc63e2 --- /dev/null +++ b/app/views/wikis/_wiki.json.jbuilder @@ -0,0 +1,2 @@ +json.extract! wiki, :id, :title, :content, :created_at, :updated_at +json.url wiki_url(wiki, format: :json) diff --git a/app/views/wikis/edit.html.erb b/app/views/wikis/edit.html.erb new file mode 100644 index 00000000..1cddd4de --- /dev/null +++ b/app/views/wikis/edit.html.erb @@ -0,0 +1,6 @@ +

Editing Wiki

+ +<%= render 'form', wiki: @wiki %> + +<%= link_to 'Show', @wiki %> | +<%= link_to 'Back', wikis_path %> diff --git a/app/views/wikis/index.html.erb b/app/views/wikis/index.html.erb new file mode 100644 index 00000000..e66bc637 --- /dev/null +++ b/app/views/wikis/index.html.erb @@ -0,0 +1,29 @@ +

<%= notice %>

+ +

Wikis

+ + + + + + + + + + + + <% @wikis.each do |wiki| %> + + + + + + + + <% end %> + +
TitleContent
<%= wiki.title %><%= wiki.content %><%= link_to 'Show', wiki %><%= link_to 'Edit', edit_wiki_path(wiki) %><%= link_to 'Destroy', wiki, method: :delete, data: { confirm: 'Are you sure?' } %>
+ +
+ +<%= link_to 'New Wiki', new_wiki_path %> diff --git a/app/views/wikis/index.json.jbuilder b/app/views/wikis/index.json.jbuilder new file mode 100644 index 00000000..cc9cfcab --- /dev/null +++ b/app/views/wikis/index.json.jbuilder @@ -0,0 +1 @@ +json.array! @wikis, partial: "wikis/wiki", as: :wiki diff --git a/app/views/wikis/new.html.erb b/app/views/wikis/new.html.erb new file mode 100644 index 00000000..015f9522 --- /dev/null +++ b/app/views/wikis/new.html.erb @@ -0,0 +1,5 @@ +

New Wiki

+ +<%= render 'form', wiki: @wiki %> + +<%= link_to 'Back', wikis_path %> diff --git a/app/views/wikis/show.html.erb b/app/views/wikis/show.html.erb new file mode 100644 index 00000000..3d2b7c42 --- /dev/null +++ b/app/views/wikis/show.html.erb @@ -0,0 +1,14 @@ +

<%= notice %>

+ +

+ Title: + <%= @wiki.title %> +

+ +

+ Content: + <%= @wiki.content %> +

+ +<%= link_to 'Edit', edit_wiki_path(@wiki) %> | +<%= link_to 'Back', wikis_path %> diff --git a/app/views/wikis/show.json.jbuilder b/app/views/wikis/show.json.jbuilder new file mode 100644 index 00000000..52e94a6f --- /dev/null +++ b/app/views/wikis/show.json.jbuilder @@ -0,0 +1 @@ +json.partial! "wikis/wiki", wiki: @wiki diff --git a/config/routes.rb b/config/routes.rb index f33f7f68..fbd3d414 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,6 +1,8 @@ # frozen_string_literal: true Rails.application.routes.draw do + resources :comentarios + resources :wikis get 'home/index' devise_for :users # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html diff --git a/db/migrate/20201111004117_create_wikis.rb b/db/migrate/20201111004117_create_wikis.rb new file mode 100644 index 00000000..df60b96c --- /dev/null +++ b/db/migrate/20201111004117_create_wikis.rb @@ -0,0 +1,10 @@ +class CreateWikis < ActiveRecord::Migration[5.2] + def change + create_table :wikis do |t| + t.string :title + t.text :content + + t.timestamps + end + end +end diff --git a/db/migrate/20201111010011_create_comentarios.rb b/db/migrate/20201111010011_create_comentarios.rb new file mode 100644 index 00000000..16c22e2d --- /dev/null +++ b/db/migrate/20201111010011_create_comentarios.rb @@ -0,0 +1,9 @@ +class CreateComentarios < ActiveRecord::Migration[5.2] + def change + create_table :comentarios do |t| + t.text :content + + t.timestamps + end + end +end diff --git a/features/criar_processo.feature b/features/criar_processo.feature index d9f3a780..19840f9f 100644 --- a/features/criar_processo.feature +++ b/features/criar_processo.feature @@ -7,7 +7,7 @@ Funcionalidade: Cadastrar um novo processo na Wiki de atendimento A FIM de disponibilizar informações para outros secretários. Contexto: - Dado que eu esteja conectado como usuario "usuario_secretario@secretario.com", "123456", "secretario" + Dado que eu esteja conectado como usuario "secretary@secretary.com", "admin123", "secretary" E que esteja na página "processos de atendimento" E clico no botão "Adicionar processo" diff --git a/features/step_definitions/shared_steps.rb b/features/step_definitions/shared_steps.rb index 5a01237a..74d55fa3 100644 --- a/features/step_definitions/shared_steps.rb +++ b/features/step_definitions/shared_steps.rb @@ -15,12 +15,19 @@ end Dado(/(?:esteja na|redirecionado para a) página "([^"]*)"/) do |pagina| - pending # Write code here that turns the phrase above into concrete actions + pending end Dado(/esteja conectado como usuario "([^"]*)", "([^"]*)", "([^"]*)"/) do |usuario, senha, funcao| - pending # Write code here that turns the phrase above into concrete actions -end + #faz login + + User.create(full_name: "Secretário", email: "secretary@secretary.com", password: "admin123", role: "secretary", registration: "000000000") + visit new_user_session_path + fill_in :user_email, with: usuario + fill_in :user_password, with: senha + click_button "Log in" + +end Quando(/visualizar (?:o|a|os|as) "([^"]*)"/) do |elemento| pending diff --git a/spec/controllers/comentarios_controller_spec.rb b/spec/controllers/comentarios_controller_spec.rb new file mode 100644 index 00000000..3062f677 --- /dev/null +++ b/spec/controllers/comentarios_controller_spec.rb @@ -0,0 +1,141 @@ +require 'rails_helper' + +# This spec was generated by rspec-rails when you ran the scaffold generator. +# It demonstrates how one might use RSpec to specify the controller code that +# was generated by Rails when you ran the scaffold generator. +# +# It assumes that the implementation code is generated by the rails scaffold +# generator. If you are using any extension libraries to generate different +# controller code, this generated spec may or may not pass. +# +# It only uses APIs available in rails and/or rspec-rails. There are a number +# of tools you can use to make these specs even more expressive, but we're +# sticking to rails and rspec-rails APIs to keep things simple and stable. +# +# Compared to earlier versions of this generator, there is very limited use of +# stubs and message expectations in this spec. Stubs are only used when there +# is no simpler way to get a handle on the object needed for the example. +# Message expectations are only used when there is no simpler way to specify +# that an instance is receiving a specific message. +# +# Also compared to earlier versions of this generator, there are no longer any +# expectations of assigns and templates rendered. These features have been +# removed from Rails core in Rails 5, but can be added back in via the +# `rails-controller-testing` gem. + +RSpec.describe ComentariosController, type: :controller do + + # This should return the minimal set of attributes required to create a valid + # Comentario. As you add validations to Comentario, be sure to + # adjust the attributes here as well. + let(:valid_attributes) { + skip("Add a hash of attributes valid for your model") + } + + let(:invalid_attributes) { + skip("Add a hash of attributes invalid for your model") + } + + # This should return the minimal set of values that should be in the session + # in order to pass any filters (e.g. authentication) defined in + # ComentariosController. Be sure to keep this updated too. + let(:valid_session) { {} } + + describe "GET #index" do + it "returns a success response" do + Comentario.create! valid_attributes + get :index, params: {}, session: valid_session + expect(response).to be_successful + end + end + + describe "GET #show" do + it "returns a success response" do + comentario = Comentario.create! valid_attributes + get :show, params: {id: comentario.to_param}, session: valid_session + expect(response).to be_successful + end + end + + describe "GET #new" do + it "returns a success response" do + get :new, params: {}, session: valid_session + expect(response).to be_successful + end + end + + describe "GET #edit" do + it "returns a success response" do + comentario = Comentario.create! valid_attributes + get :edit, params: {id: comentario.to_param}, session: valid_session + expect(response).to be_successful + end + end + + describe "POST #create" do + context "with valid params" do + it "creates a new Comentario" do + expect { + post :create, params: {comentario: valid_attributes}, session: valid_session + }.to change(Comentario, :count).by(1) + end + + it "redirects to the created comentario" do + post :create, params: {comentario: valid_attributes}, session: valid_session + expect(response).to redirect_to(Comentario.last) + end + end + + context "with invalid params" do + it "returns a success response (i.e. to display the 'new' template)" do + post :create, params: {comentario: invalid_attributes}, session: valid_session + expect(response).to be_successful + end + end + end + + describe "PUT #update" do + context "with valid params" do + let(:new_attributes) { + skip("Add a hash of attributes valid for your model") + } + + it "updates the requested comentario" do + comentario = Comentario.create! valid_attributes + put :update, params: {id: comentario.to_param, comentario: new_attributes}, session: valid_session + comentario.reload + skip("Add assertions for updated state") + end + + it "redirects to the comentario" do + comentario = Comentario.create! valid_attributes + put :update, params: {id: comentario.to_param, comentario: valid_attributes}, session: valid_session + expect(response).to redirect_to(comentario) + end + end + + context "with invalid params" do + it "returns a success response (i.e. to display the 'edit' template)" do + comentario = Comentario.create! valid_attributes + put :update, params: {id: comentario.to_param, comentario: invalid_attributes}, session: valid_session + expect(response).to be_successful + end + end + end + + describe "DELETE #destroy" do + it "destroys the requested comentario" do + comentario = Comentario.create! valid_attributes + expect { + delete :destroy, params: {id: comentario.to_param}, session: valid_session + }.to change(Comentario, :count).by(-1) + end + + it "redirects to the comentarios list" do + comentario = Comentario.create! valid_attributes + delete :destroy, params: {id: comentario.to_param}, session: valid_session + expect(response).to redirect_to(comentarios_url) + end + end + +end diff --git a/spec/controllers/home_controller_spec.rb b/spec/controllers/home_controller_spec.rb deleted file mode 100644 index 6fd68742..00000000 --- a/spec/controllers/home_controller_spec.rb +++ /dev/null @@ -1,12 +0,0 @@ -require 'rails_helper' - -RSpec.describe HomeController, type: :controller do - - describe "GET #index" do - it "returns http success" do - get :index - expect(response).to have_http_status(:success) - end - end - -end diff --git a/spec/controllers/processos_controller_spec.rb b/spec/controllers/processos_controller_spec.rb deleted file mode 100644 index 8bf3d14e..00000000 --- a/spec/controllers/processos_controller_spec.rb +++ /dev/null @@ -1,53 +0,0 @@ -require 'rails_helper' -require 'capybara/rails' - -RSpec.describe ProcessosController, type: :controller do - describe "#create" do - it 'calls the create method from the Processos model' - describe "valid params" do - it 'saves the process in DB' - it "responds with an success HTTP status" - it 'redirects to process index page' - end - describe "invalid params" do - it "doesn't save the process in DB" - it "responds with an error HTTP status" - end - end - - describe "#update" do - it 'calls the update method from an instance of the Processos model' - describe "valid params" do - it 'updates the process data in the DB' - it "responds with an success HTTP status" - it 'redirects to process index page' - end - describe "invalid params" do - it "doesn't update the process data in the DB" - it "responds with an error HTTP status" - end - end - - describe "#show" do - describe "valid process" do - it "responds with an success HTTP status" - it 'redirects to process show page' - end - describe "invalid process" do - it "responds with an error HTTP status" - end - end - - describe "add comment" do - it "calls the create method from the Comentarios model" - describe "valid params" do - it 'saves the comment in DB' - it "responds with an success HTTP status" - it 'redirects to comment index page' - end - describe "invalid params" do - it "doesn't save the comment in DB" - it "responds with an error HTTP status" - end - end -end diff --git a/spec/controllers/wikis_controller_spec.rb b/spec/controllers/wikis_controller_spec.rb new file mode 100644 index 00000000..996b2abb --- /dev/null +++ b/spec/controllers/wikis_controller_spec.rb @@ -0,0 +1,141 @@ +require 'rails_helper' + +# This spec was generated by rspec-rails when you ran the scaffold generator. +# It demonstrates how one might use RSpec to specify the controller code that +# was generated by Rails when you ran the scaffold generator. +# +# It assumes that the implementation code is generated by the rails scaffold +# generator. If you are using any extension libraries to generate different +# controller code, this generated spec may or may not pass. +# +# It only uses APIs available in rails and/or rspec-rails. There are a number +# of tools you can use to make these specs even more expressive, but we're +# sticking to rails and rspec-rails APIs to keep things simple and stable. +# +# Compared to earlier versions of this generator, there is very limited use of +# stubs and message expectations in this spec. Stubs are only used when there +# is no simpler way to get a handle on the object needed for the example. +# Message expectations are only used when there is no simpler way to specify +# that an instance is receiving a specific message. +# +# Also compared to earlier versions of this generator, there are no longer any +# expectations of assigns and templates rendered. These features have been +# removed from Rails core in Rails 5, but can be added back in via the +# `rails-controller-testing` gem. + +RSpec.describe WikisController, type: :controller do + + # This should return the minimal set of attributes required to create a valid + # Wiki. As you add validations to Wiki, be sure to + # adjust the attributes here as well. + let(:valid_attributes) { + skip("Add a hash of attributes valid for your model") + } + + let(:invalid_attributes) { + skip("Add a hash of attributes invalid for your model") + } + + # This should return the minimal set of values that should be in the session + # in order to pass any filters (e.g. authentication) defined in + # WikisController. Be sure to keep this updated too. + let(:valid_session) { {} } + + describe "GET #index" do + it "returns a success response" do + Wiki.create! valid_attributes + get :index, params: {}, session: valid_session + expect(response).to be_successful + end + end + + describe "GET #show" do + it "returns a success response" do + wiki = Wiki.create! valid_attributes + get :show, params: {id: wiki.to_param}, session: valid_session + expect(response).to be_successful + end + end + + describe "GET #new" do + it "returns a success response" do + get :new, params: {}, session: valid_session + expect(response).to be_successful + end + end + + describe "GET #edit" do + it "returns a success response" do + wiki = Wiki.create! valid_attributes + get :edit, params: {id: wiki.to_param}, session: valid_session + expect(response).to be_successful + end + end + + describe "POST #create" do + context "with valid params" do + it "creates a new Wiki" do + expect { + post :create, params: {wiki: valid_attributes}, session: valid_session + }.to change(Wiki, :count).by(1) + end + + it "redirects to the created wiki" do + post :create, params: {wiki: valid_attributes}, session: valid_session + expect(response).to redirect_to(Wiki.last) + end + end + + context "with invalid params" do + it "returns a success response (i.e. to display the 'new' template)" do + post :create, params: {wiki: invalid_attributes}, session: valid_session + expect(response).to be_successful + end + end + end + + describe "PUT #update" do + context "with valid params" do + let(:new_attributes) { + skip("Add a hash of attributes valid for your model") + } + + it "updates the requested wiki" do + wiki = Wiki.create! valid_attributes + put :update, params: {id: wiki.to_param, wiki: new_attributes}, session: valid_session + wiki.reload + skip("Add assertions for updated state") + end + + it "redirects to the wiki" do + wiki = Wiki.create! valid_attributes + put :update, params: {id: wiki.to_param, wiki: valid_attributes}, session: valid_session + expect(response).to redirect_to(wiki) + end + end + + context "with invalid params" do + it "returns a success response (i.e. to display the 'edit' template)" do + wiki = Wiki.create! valid_attributes + put :update, params: {id: wiki.to_param, wiki: invalid_attributes}, session: valid_session + expect(response).to be_successful + end + end + end + + describe "DELETE #destroy" do + it "destroys the requested wiki" do + wiki = Wiki.create! valid_attributes + expect { + delete :destroy, params: {id: wiki.to_param}, session: valid_session + }.to change(Wiki, :count).by(-1) + end + + it "redirects to the wikis list" do + wiki = Wiki.create! valid_attributes + delete :destroy, params: {id: wiki.to_param}, session: valid_session + expect(response).to redirect_to(wikis_url) + end + end + +end diff --git a/spec/helpers/comentarios_helper_spec.rb b/spec/helpers/comentarios_helper_spec.rb new file mode 100644 index 00000000..3f6b4a2f --- /dev/null +++ b/spec/helpers/comentarios_helper_spec.rb @@ -0,0 +1,15 @@ +require 'rails_helper' + +# Specs in this file have access to a helper object that includes +# the ComentariosHelper. For example: +# +# describe ComentariosHelper 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 ComentariosHelper, type: :helper do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/helpers/wikis_helper_spec.rb b/spec/helpers/wikis_helper_spec.rb new file mode 100644 index 00000000..2bb13034 --- /dev/null +++ b/spec/helpers/wikis_helper_spec.rb @@ -0,0 +1,15 @@ +require 'rails_helper' + +# Specs in this file have access to a helper object that includes +# the WikisHelper. For example: +# +# describe WikisHelper 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 WikisHelper, type: :helper do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/comentario_spec.rb b/spec/models/comentario_spec.rb new file mode 100644 index 00000000..1a4ccf48 --- /dev/null +++ b/spec/models/comentario_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe Comentario, type: :model do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/comentarios_spec.rb b/spec/models/comentarios_spec.rb deleted file mode 100644 index 45169498..00000000 --- a/spec/models/comentarios_spec.rb +++ /dev/null @@ -1,9 +0,0 @@ -require 'rails_helper' - -RSpec.describe Comentario, type: :model do - describe "#create" do - it "should create a process comment when the attribute are valid" - it "should not create a process comment when the content is blank" - it "should not create a content when the conten id too large" - end -end diff --git a/spec/models/processos_spec.rb b/spec/models/processos_spec.rb deleted file mode 100644 index 26976d75..00000000 --- a/spec/models/processos_spec.rb +++ /dev/null @@ -1,19 +0,0 @@ -require 'rails_helper' - -RSpec.describe Processos, type: :model do - describe "#create" do - it 'should create a new process when the attributes are valid' - it 'should not create a new process when the sei_process_code is not a valid code' - it 'should not create a new process when there is no assigned user' - it 'should not create a new process when the process_status_id is invalid' - it 'should not create a new process when trying to attach an invalid file ' - end - - describe "#update" do - it 'should update the process when the attributes are valid' - it 'should not update the process when the sei_process_code is not a valid code' - it 'should not update the process when there is no assigned user' - it 'should not update the process when the process_status_id is invalid' - it 'should not update the process when trying to attach an invalid file' - end -end diff --git a/spec/models/user_spec.rb b/spec/models/wiki_spec.rb similarity index 69% rename from spec/models/user_spec.rb rename to spec/models/wiki_spec.rb index 47a31bb4..e9607704 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/wiki_spec.rb @@ -1,5 +1,5 @@ require 'rails_helper' -RSpec.describe User, type: :model do +RSpec.describe Wiki, type: :model do pending "add some examples to (or delete) #{__FILE__}" end diff --git a/spec/requests/comentarios_spec.rb b/spec/requests/comentarios_spec.rb new file mode 100644 index 00000000..8feac886 --- /dev/null +++ b/spec/requests/comentarios_spec.rb @@ -0,0 +1,10 @@ +require 'rails_helper' + +RSpec.describe "Comentarios", type: :request do + describe "GET /comentarios" do + it "works! (now write some real specs)" do + get comentarios_path + expect(response).to have_http_status(200) + end + end +end diff --git a/spec/requests/wikis_spec.rb b/spec/requests/wikis_spec.rb new file mode 100644 index 00000000..8eb4eca7 --- /dev/null +++ b/spec/requests/wikis_spec.rb @@ -0,0 +1,10 @@ +require 'rails_helper' + +RSpec.describe "Wikis", type: :request do + describe "GET /wikis" do + it "works! (now write some real specs)" do + get wikis_path + expect(response).to have_http_status(200) + end + end +end diff --git a/spec/routing/comentarios_routing_spec.rb b/spec/routing/comentarios_routing_spec.rb new file mode 100644 index 00000000..48161e10 --- /dev/null +++ b/spec/routing/comentarios_routing_spec.rb @@ -0,0 +1,38 @@ +require "rails_helper" + +RSpec.describe ComentariosController, type: :routing do + describe "routing" do + it "routes to #index" do + expect(:get => "/comentarios").to route_to("comentarios#index") + end + + it "routes to #new" do + expect(:get => "/comentarios/new").to route_to("comentarios#new") + end + + it "routes to #show" do + expect(:get => "/comentarios/1").to route_to("comentarios#show", :id => "1") + end + + it "routes to #edit" do + expect(:get => "/comentarios/1/edit").to route_to("comentarios#edit", :id => "1") + end + + + it "routes to #create" do + expect(:post => "/comentarios").to route_to("comentarios#create") + end + + it "routes to #update via PUT" do + expect(:put => "/comentarios/1").to route_to("comentarios#update", :id => "1") + end + + it "routes to #update via PATCH" do + expect(:patch => "/comentarios/1").to route_to("comentarios#update", :id => "1") + end + + it "routes to #destroy" do + expect(:delete => "/comentarios/1").to route_to("comentarios#destroy", :id => "1") + end + end +end diff --git a/spec/routing/wikis_routing_spec.rb b/spec/routing/wikis_routing_spec.rb new file mode 100644 index 00000000..b646b44a --- /dev/null +++ b/spec/routing/wikis_routing_spec.rb @@ -0,0 +1,38 @@ +require "rails_helper" + +RSpec.describe WikisController, type: :routing do + describe "routing" do + it "routes to #index" do + expect(:get => "/wikis").to route_to("wikis#index") + end + + it "routes to #new" do + expect(:get => "/wikis/new").to route_to("wikis#new") + end + + it "routes to #show" do + expect(:get => "/wikis/1").to route_to("wikis#show", :id => "1") + end + + it "routes to #edit" do + expect(:get => "/wikis/1/edit").to route_to("wikis#edit", :id => "1") + end + + + it "routes to #create" do + expect(:post => "/wikis").to route_to("wikis#create") + end + + it "routes to #update via PUT" do + expect(:put => "/wikis/1").to route_to("wikis#update", :id => "1") + end + + it "routes to #update via PATCH" do + expect(:patch => "/wikis/1").to route_to("wikis#update", :id => "1") + end + + it "routes to #destroy" do + expect(:delete => "/wikis/1").to route_to("wikis#destroy", :id => "1") + end + end +end diff --git a/spec/views/comentarios/edit.html.erb_spec.rb b/spec/views/comentarios/edit.html.erb_spec.rb new file mode 100644 index 00000000..925b3ca9 --- /dev/null +++ b/spec/views/comentarios/edit.html.erb_spec.rb @@ -0,0 +1,18 @@ +require 'rails_helper' + +RSpec.describe "comentarios/edit", type: :view do + before(:each) do + @comentario = assign(:comentario, Comentario.create!( + :content => "MyText" + )) + end + + it "renders the edit comentario form" do + render + + assert_select "form[action=?][method=?]", comentario_path(@comentario), "post" do + + assert_select "textarea[name=?]", "comentario[content]" + end + end +end diff --git a/spec/views/comentarios/index.html.erb_spec.rb b/spec/views/comentarios/index.html.erb_spec.rb new file mode 100644 index 00000000..ba8b6191 --- /dev/null +++ b/spec/views/comentarios/index.html.erb_spec.rb @@ -0,0 +1,19 @@ +require 'rails_helper' + +RSpec.describe "comentarios/index", type: :view do + before(:each) do + assign(:comentarios, [ + Comentario.create!( + :content => "MyText" + ), + Comentario.create!( + :content => "MyText" + ) + ]) + end + + it "renders a list of comentarios" do + render + assert_select "tr>td", :text => "MyText".to_s, :count => 2 + end +end diff --git a/spec/views/comentarios/new.html.erb_spec.rb b/spec/views/comentarios/new.html.erb_spec.rb new file mode 100644 index 00000000..fadd290c --- /dev/null +++ b/spec/views/comentarios/new.html.erb_spec.rb @@ -0,0 +1,18 @@ +require 'rails_helper' + +RSpec.describe "comentarios/new", type: :view do + before(:each) do + assign(:comentario, Comentario.new( + :content => "MyText" + )) + end + + it "renders new comentario form" do + render + + assert_select "form[action=?][method=?]", comentarios_path, "post" do + + assert_select "textarea[name=?]", "comentario[content]" + end + end +end diff --git a/spec/views/comentarios/show.html.erb_spec.rb b/spec/views/comentarios/show.html.erb_spec.rb new file mode 100644 index 00000000..5aa80791 --- /dev/null +++ b/spec/views/comentarios/show.html.erb_spec.rb @@ -0,0 +1,14 @@ +require 'rails_helper' + +RSpec.describe "comentarios/show", type: :view do + before(:each) do + @comentario = assign(:comentario, Comentario.create!( + :content => "MyText" + )) + end + + it "renders attributes in

" do + render + expect(rendered).to match(/MyText/) + end +end diff --git a/spec/views/wikis/edit.html.erb_spec.rb b/spec/views/wikis/edit.html.erb_spec.rb new file mode 100644 index 00000000..4a6621ad --- /dev/null +++ b/spec/views/wikis/edit.html.erb_spec.rb @@ -0,0 +1,21 @@ +require 'rails_helper' + +RSpec.describe "wikis/edit", type: :view do + before(:each) do + @wiki = assign(:wiki, Wiki.create!( + :title => "MyString", + :content => "MyText" + )) + end + + it "renders the edit wiki form" do + render + + assert_select "form[action=?][method=?]", wiki_path(@wiki), "post" do + + assert_select "input[name=?]", "wiki[title]" + + assert_select "textarea[name=?]", "wiki[content]" + end + end +end diff --git a/spec/views/wikis/index.html.erb_spec.rb b/spec/views/wikis/index.html.erb_spec.rb new file mode 100644 index 00000000..c26abe01 --- /dev/null +++ b/spec/views/wikis/index.html.erb_spec.rb @@ -0,0 +1,22 @@ +require 'rails_helper' + +RSpec.describe "wikis/index", type: :view do + before(:each) do + assign(:wikis, [ + Wiki.create!( + :title => "Title", + :content => "MyText" + ), + Wiki.create!( + :title => "Title", + :content => "MyText" + ) + ]) + end + + it "renders a list of wikis" do + render + assert_select "tr>td", :text => "Title".to_s, :count => 2 + assert_select "tr>td", :text => "MyText".to_s, :count => 2 + end +end diff --git a/spec/views/wikis/new.html.erb_spec.rb b/spec/views/wikis/new.html.erb_spec.rb new file mode 100644 index 00000000..48d1bd06 --- /dev/null +++ b/spec/views/wikis/new.html.erb_spec.rb @@ -0,0 +1,21 @@ +require 'rails_helper' + +RSpec.describe "wikis/new", type: :view do + before(:each) do + assign(:wiki, Wiki.new( + :title => "MyString", + :content => "MyText" + )) + end + + it "renders new wiki form" do + render + + assert_select "form[action=?][method=?]", wikis_path, "post" do + + assert_select "input[name=?]", "wiki[title]" + + assert_select "textarea[name=?]", "wiki[content]" + end + end +end diff --git a/spec/views/wikis/show.html.erb_spec.rb b/spec/views/wikis/show.html.erb_spec.rb new file mode 100644 index 00000000..63ec2686 --- /dev/null +++ b/spec/views/wikis/show.html.erb_spec.rb @@ -0,0 +1,16 @@ +require 'rails_helper' + +RSpec.describe "wikis/show", type: :view do + before(:each) do + @wiki = assign(:wiki, Wiki.create!( + :title => "Title", + :content => "MyText" + )) + end + + it "renders attributes in

" do + render + expect(rendered).to match(/Title/) + expect(rendered).to match(/MyText/) + end +end From 31adc1991e88469b7f8374ca599253e2f9f61c80 Mon Sep 17 00:00:00 2001 From: aliceborges_42 Date: Wed, 11 Nov 2020 22:00:14 -0300 Subject: [PATCH 18/45] refatora controllers --- app/controllers/wiki_entries_controller.rb | 74 ++++++++++++++++++++++ app/controllers/wikis_controller.rb | 74 ---------------------- app/models/comentario.rb | 2 - app/models/wiki_comment.rb | 2 + 4 files changed, 76 insertions(+), 76 deletions(-) create mode 100644 app/controllers/wiki_entries_controller.rb delete mode 100644 app/controllers/wikis_controller.rb delete mode 100644 app/models/comentario.rb create mode 100644 app/models/wiki_comment.rb diff --git a/app/controllers/wiki_entries_controller.rb b/app/controllers/wiki_entries_controller.rb new file mode 100644 index 00000000..4dc31d10 --- /dev/null +++ b/app/controllers/wiki_entries_controller.rb @@ -0,0 +1,74 @@ +class WikiEntriesController < ApplicationController + before_action :set_entry, only: [:show, :edit, :update, :destroy] + + # GET /wikis + # GET /wikis.json + def index + @entries = WikiEntry.all + end + + # GET /wikis/1 + # GET /wikis/1.json + def show + end + + # GET /wikis/new + def new + @entry= WikiEntry.new + end + + # GET /wikis/1/edit + def edit + end + + # POST /wikis + # POST /wikis.json + def create + @entry= WikiEntry.new(entry_params) + + respond_to do |format| + if @entry.save + format.html { redirect_to @entry notice: 'Wiki was successfully created.' } + format.json { render :show, status: :created, location: @entry} + else + format.html { render :new } + format.json { render json: @entry.errors, status: :unprocessable_entity } + end + end + end + + # PATCH/PUT /wikis/1 + # PATCH/PUT /wikis/1.json + def update + respond_to do |format| + if @entry.update(entry_params) + format.html { redirect_to @entry notice: 'Wiki was successfully updated.' } + format.json { render :show, status: :ok, location: @entry} + else + format.html { render :edit } + format.json { render json: @entry.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /wikis/1 + # DELETE /wikis/1.jso + def destroy + @entry.destroy + respond_to do |format| + format.html { redirect_to wiki_entries_url, notice: 'Wiki was successfully destroyed.' } + format.json { head :no_content } + end + end + + private + # Use callbacks to share common setup or constraints between actions. + def set_entry + @entry= WikiEntry.find(params[:id]) + end + + # Never trust parameters from the scary internet, only allow the white list through. + def entry_params + params.require(:wiki_entry).permit(:title, :content) + end +end diff --git a/app/controllers/wikis_controller.rb b/app/controllers/wikis_controller.rb deleted file mode 100644 index 33cf8ad0..00000000 --- a/app/controllers/wikis_controller.rb +++ /dev/null @@ -1,74 +0,0 @@ -class WikisController < ApplicationController - before_action :set_wiki, only: [:show, :edit, :update, :destroy] - - # GET /wikis - # GET /wikis.json - def index - @wikis = Wiki.all - end - - # GET /wikis/1 - # GET /wikis/1.json - def show - end - - # GET /wikis/new - def new - @wiki = Wiki.new - end - - # GET /wikis/1/edit - def edit - end - - # POST /wikis - # POST /wikis.json - def create - @wiki = Wiki.new(wiki_params) - - respond_to do |format| - if @wiki.save - format.html { redirect_to @wiki, notice: 'Wiki was successfully created.' } - format.json { render :show, status: :created, location: @wiki } - else - format.html { render :new } - format.json { render json: @wiki.errors, status: :unprocessable_entity } - end - end - end - - # PATCH/PUT /wikis/1 - # PATCH/PUT /wikis/1.json - def update - respond_to do |format| - if @wiki.update(wiki_params) - format.html { redirect_to @wiki, notice: 'Wiki was successfully updated.' } - format.json { render :show, status: :ok, location: @wiki } - else - format.html { render :edit } - format.json { render json: @wiki.errors, status: :unprocessable_entity } - end - end - end - - # DELETE /wikis/1 - # DELETE /wikis/1.json - def destroy - @wiki.destroy - respond_to do |format| - format.html { redirect_to wikis_url, notice: 'Wiki was successfully destroyed.' } - format.json { head :no_content } - end - end - - private - # Use callbacks to share common setup or constraints between actions. - def set_wiki - @wiki = Wiki.find(params[:id]) - end - - # Never trust parameters from the scary internet, only allow the white list through. - def wiki_params - params.require(:wiki).permit(:title, :content) - end -end diff --git a/app/models/comentario.rb b/app/models/comentario.rb deleted file mode 100644 index f485ee06..00000000 --- a/app/models/comentario.rb +++ /dev/null @@ -1,2 +0,0 @@ -class Comentario < ApplicationRecord -end diff --git a/app/models/wiki_comment.rb b/app/models/wiki_comment.rb new file mode 100644 index 00000000..eaa5375e --- /dev/null +++ b/app/models/wiki_comment.rb @@ -0,0 +1,2 @@ +class WikiComment < ApplicationRecord +end From a311b56c4d101c45bb7f83dde7c732680b191cb5 Mon Sep 17 00:00:00 2001 From: aliceborges_42 Date: Wed, 11 Nov 2020 22:01:48 -0300 Subject: [PATCH 19/45] refatora models --- app/controllers/comentarios_controller.rb | 74 --------------------- app/controllers/wiki_comments_controller.rb | 74 +++++++++++++++++++++ app/models/wiki.rb | 2 - app/models/wiki_entry.rb | 3 + 4 files changed, 77 insertions(+), 76 deletions(-) delete mode 100644 app/controllers/comentarios_controller.rb create mode 100644 app/controllers/wiki_comments_controller.rb delete mode 100644 app/models/wiki.rb create mode 100644 app/models/wiki_entry.rb diff --git a/app/controllers/comentarios_controller.rb b/app/controllers/comentarios_controller.rb deleted file mode 100644 index 7aefc8b3..00000000 --- a/app/controllers/comentarios_controller.rb +++ /dev/null @@ -1,74 +0,0 @@ -class ComentariosController < ApplicationController - before_action :set_comentario, only: [:show, :edit, :update, :destroy] - - # GET /comentarios - # GET /comentarios.json - def index - @comentarios = Comentario.all - end - - # GET /comentarios/1 - # GET /comentarios/1.json - def show - end - - # GET /comentarios/new - def new - @comentario = Comentario.new - end - - # GET /comentarios/1/edit - def edit - end - - # POST /comentarios - # POST /comentarios.json - def create - @comentario = Comentario.new(comentario_params) - - respond_to do |format| - if @comentario.save - format.html { redirect_to @comentario, notice: 'Comentario was successfully created.' } - format.json { render :show, status: :created, location: @comentario } - else - format.html { render :new } - format.json { render json: @comentario.errors, status: :unprocessable_entity } - end - end - end - - # PATCH/PUT /comentarios/1 - # PATCH/PUT /comentarios/1.json - def update - respond_to do |format| - if @comentario.update(comentario_params) - format.html { redirect_to @comentario, notice: 'Comentario was successfully updated.' } - format.json { render :show, status: :ok, location: @comentario } - else - format.html { render :edit } - format.json { render json: @comentario.errors, status: :unprocessable_entity } - end - end - end - - # DELETE /comentarios/1 - # DELETE /comentarios/1.json - def destroy - @comentario.destroy - respond_to do |format| - format.html { redirect_to comentarios_url, notice: 'Comentario was successfully destroyed.' } - format.json { head :no_content } - end - end - - private - # Use callbacks to share common setup or constraints between actions. - def set_comentario - @comentario = Comentario.find(params[:id]) - end - - # Never trust parameters from the scary internet, only allow the white list through. - def comentario_params - params.require(:comentario).permit(:content) - end -end diff --git a/app/controllers/wiki_comments_controller.rb b/app/controllers/wiki_comments_controller.rb new file mode 100644 index 00000000..3af2b429 --- /dev/null +++ b/app/controllers/wiki_comments_controller.rb @@ -0,0 +1,74 @@ +class WikiCommentsController < ApplicationController + before_action :set_comment, only: [:show, :edit, :update, :destroy] + + # GET /comments + # GET /comments.json + def index + @comments = WikiComment.all + end + + # GET /comments/1 + # GET /comments/1.json + def show + end + + # GET /comments/new + def new + @comment = WikiComment.new + end + + # GET /comments/1/edit + def edit + end + + # POST /comments + # POST /comments.json + def create + @comment = WikiComment.new(comment_params) + + respond_to do |format| + if @comment.save + format.html { redirect_to @comment, notice: 'Comment was successfully created.' } + format.json { render :show, status: :created, location: @comment } + else + format.html { render :new } + format.json { render json: @comment.errors, status: :unprocessable_entity } + end + end + end + + # PATCH/PUT /comments/1 + # PATCH/PUT /comments/1.json + def update + respond_to do |format| + if @comment.update(comment_params) + format.html { redirect_to @comment, notice: 'Comment was successfully updated.' } + format.json { render :show, status: :ok, location: @comment } + else + format.html { render :edit } + format.json { render json: @comment.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /comments/1 + # DELETE /comments/1.json + def destroy + @comment.destroy + respond_to do |format| + format.html { redirect_to comments_url, notice: 'Comment was successfully destroyed.' } + format.json { head :no_content } + end + end + + private + # Use callbacks to share common setup or constraints between actions. + def set_comment + @comment = Comment.find(params[:id]) + end + + # Never trust parameters from the scary internet, only allow the white list through. + def comment_params + params.require(:wiki_comment).permit(:content) + end +end diff --git a/app/models/wiki.rb b/app/models/wiki.rb deleted file mode 100644 index ffb83a36..00000000 --- a/app/models/wiki.rb +++ /dev/null @@ -1,2 +0,0 @@ -class Wiki < ApplicationRecord -end diff --git a/app/models/wiki_entry.rb b/app/models/wiki_entry.rb new file mode 100644 index 00000000..6ace5ba4 --- /dev/null +++ b/app/models/wiki_entry.rb @@ -0,0 +1,3 @@ +class WikiEntry < ApplicationRecord + has_one_attached :document +end From 4538d8c341787c8606237c23e4e20fbb5f44beb7 Mon Sep 17 00:00:00 2001 From: aliceborges_42 Date: Wed, 11 Nov 2020 22:40:21 -0300 Subject: [PATCH 20/45] refatora testes spec de controllers --- .../comentarios_controller_spec.rb | 141 ------------------ .../wiki_comments_controller_spec.rb | 110 ++++++++++++++ .../wiki_entries_controller_spec.rb | 109 ++++++++++++++ spec/controllers/wikis_controller_spec.rb | 141 ------------------ ...omentario_spec.rb => wiki_comment_spec.rb} | 0 spec/models/wiki_entry_spec.rb | 18 +++ spec/models/wiki_spec.rb | 5 - 7 files changed, 237 insertions(+), 287 deletions(-) delete mode 100644 spec/controllers/comentarios_controller_spec.rb create mode 100644 spec/controllers/wiki_comments_controller_spec.rb create mode 100644 spec/controllers/wiki_entries_controller_spec.rb delete mode 100644 spec/controllers/wikis_controller_spec.rb rename spec/models/{comentario_spec.rb => wiki_comment_spec.rb} (100%) create mode 100644 spec/models/wiki_entry_spec.rb delete mode 100644 spec/models/wiki_spec.rb diff --git a/spec/controllers/comentarios_controller_spec.rb b/spec/controllers/comentarios_controller_spec.rb deleted file mode 100644 index 3062f677..00000000 --- a/spec/controllers/comentarios_controller_spec.rb +++ /dev/null @@ -1,141 +0,0 @@ -require 'rails_helper' - -# This spec was generated by rspec-rails when you ran the scaffold generator. -# It demonstrates how one might use RSpec to specify the controller code that -# was generated by Rails when you ran the scaffold generator. -# -# It assumes that the implementation code is generated by the rails scaffold -# generator. If you are using any extension libraries to generate different -# controller code, this generated spec may or may not pass. -# -# It only uses APIs available in rails and/or rspec-rails. There are a number -# of tools you can use to make these specs even more expressive, but we're -# sticking to rails and rspec-rails APIs to keep things simple and stable. -# -# Compared to earlier versions of this generator, there is very limited use of -# stubs and message expectations in this spec. Stubs are only used when there -# is no simpler way to get a handle on the object needed for the example. -# Message expectations are only used when there is no simpler way to specify -# that an instance is receiving a specific message. -# -# Also compared to earlier versions of this generator, there are no longer any -# expectations of assigns and templates rendered. These features have been -# removed from Rails core in Rails 5, but can be added back in via the -# `rails-controller-testing` gem. - -RSpec.describe ComentariosController, type: :controller do - - # This should return the minimal set of attributes required to create a valid - # Comentario. As you add validations to Comentario, be sure to - # adjust the attributes here as well. - let(:valid_attributes) { - skip("Add a hash of attributes valid for your model") - } - - let(:invalid_attributes) { - skip("Add a hash of attributes invalid for your model") - } - - # This should return the minimal set of values that should be in the session - # in order to pass any filters (e.g. authentication) defined in - # ComentariosController. Be sure to keep this updated too. - let(:valid_session) { {} } - - describe "GET #index" do - it "returns a success response" do - Comentario.create! valid_attributes - get :index, params: {}, session: valid_session - expect(response).to be_successful - end - end - - describe "GET #show" do - it "returns a success response" do - comentario = Comentario.create! valid_attributes - get :show, params: {id: comentario.to_param}, session: valid_session - expect(response).to be_successful - end - end - - describe "GET #new" do - it "returns a success response" do - get :new, params: {}, session: valid_session - expect(response).to be_successful - end - end - - describe "GET #edit" do - it "returns a success response" do - comentario = Comentario.create! valid_attributes - get :edit, params: {id: comentario.to_param}, session: valid_session - expect(response).to be_successful - end - end - - describe "POST #create" do - context "with valid params" do - it "creates a new Comentario" do - expect { - post :create, params: {comentario: valid_attributes}, session: valid_session - }.to change(Comentario, :count).by(1) - end - - it "redirects to the created comentario" do - post :create, params: {comentario: valid_attributes}, session: valid_session - expect(response).to redirect_to(Comentario.last) - end - end - - context "with invalid params" do - it "returns a success response (i.e. to display the 'new' template)" do - post :create, params: {comentario: invalid_attributes}, session: valid_session - expect(response).to be_successful - end - end - end - - describe "PUT #update" do - context "with valid params" do - let(:new_attributes) { - skip("Add a hash of attributes valid for your model") - } - - it "updates the requested comentario" do - comentario = Comentario.create! valid_attributes - put :update, params: {id: comentario.to_param, comentario: new_attributes}, session: valid_session - comentario.reload - skip("Add assertions for updated state") - end - - it "redirects to the comentario" do - comentario = Comentario.create! valid_attributes - put :update, params: {id: comentario.to_param, comentario: valid_attributes}, session: valid_session - expect(response).to redirect_to(comentario) - end - end - - context "with invalid params" do - it "returns a success response (i.e. to display the 'edit' template)" do - comentario = Comentario.create! valid_attributes - put :update, params: {id: comentario.to_param, comentario: invalid_attributes}, session: valid_session - expect(response).to be_successful - end - end - end - - describe "DELETE #destroy" do - it "destroys the requested comentario" do - comentario = Comentario.create! valid_attributes - expect { - delete :destroy, params: {id: comentario.to_param}, session: valid_session - }.to change(Comentario, :count).by(-1) - end - - it "redirects to the comentarios list" do - comentario = Comentario.create! valid_attributes - delete :destroy, params: {id: comentario.to_param}, session: valid_session - expect(response).to redirect_to(comentarios_url) - end - end - -end diff --git a/spec/controllers/wiki_comments_controller_spec.rb b/spec/controllers/wiki_comments_controller_spec.rb new file mode 100644 index 00000000..c1cd5b2c --- /dev/null +++ b/spec/controllers/wiki_comments_controller_spec.rb @@ -0,0 +1,110 @@ +require 'rails_helper' + +RSpec.describe WikiCommentsController, type: :controller do + + + let(:valid_attributes) { + skip("Add a hash of attributes valid for your model") + } + + let(:invalid_attributes) { + skip("Add a hash of attributes invalid for your model") + } + + let(:valid_session) { {} } + + subject(:comment) { WikiComment.create! valid_attributes } + + describe "GET #index" do + it "returns a success response" do + get :index, params: {}, session: valid_session + expect(response).to be_successful + end + end + + describe "GET #show" do + it "returns a success response" do + get :show, params: {id: comment.id}, session: valid_session + expect(response).to be_successful + end + end + + describe "GET #new" do + it "returns a success response" do + get :new, params: {}, session: valid_session + expect(response).to be_successful + end + end + + describe "GET #edit" do + it "returns a success response" do + get :edit, params: {id: comment.id}, session: valid_session + expect(response).to be_successful + end + end + + describe "POST #create" do + context "with valid params" do + it "creates a new Comentario" do + expect { + post :create, params: {wiki_comment: valid_attributes}, session: valid_session + }.to change(WikiComment, :count).by(1) + end + + it "redirects to the created comentario" do + post :create, params: {wiki_comment: valid_attributes}, session: valid_session + expect(response).to redirect_to(WikiComment.last) + end + end + + context "with invalid params" do + it "redirects to new page" do + post :create, params: {wiki_comment: invalid_attributes}, session: valid_session + expect(response).to redirect_to(new_wiki_comment_path(comment.id)) + end + end + end + + describe "PUT #update" do + context "with valid params" do + let(:new_attributes) { + skip("Add a hash of attributes valid for your model") + } + + it "updates the requested comentario" do + + put :update, params: {id: comment.id, wiki_comment: new_attributes}, session: valid_session + comment.reload + skip("Add assertions for updated state") + end + + it "redirects to the comentario" do + + put :update, params: {id: comment.id, wiki_comment: valid_attributes}, session: valid_session + expect(response).to redirect_to(comment) + end + end + + context "with invalid params" do + it "redirects to the edit page" do + + put :update, params: {id: comment.id, wiki_comment: invalid_attributes}, session: valid_session + expect(response).to redirect_to(edit_wiki_comment_path(comment.id)) + end + end + end + + describe "DELETE #destroy" do + it "destroys the requested comentario" do + expect { + delete :destroy, params: {id: comment.id}, session: valid_session + }.to change(WikiComment, :count).by(-1) + end + + it "redirects to the comentarios list" do + delete :destroy, params: {id: comment.id}, session: valid_session + expect(response).to redirect_to(wiki_comments_url) + end + end + +end diff --git a/spec/controllers/wiki_entries_controller_spec.rb b/spec/controllers/wiki_entries_controller_spec.rb new file mode 100644 index 00000000..e22f2db2 --- /dev/null +++ b/spec/controllers/wiki_entries_controller_spec.rb @@ -0,0 +1,109 @@ +require 'rails_helper' + +RSpec.describe WikiEntriesController, type: :controller do + + let(:valid_attributes) { + skip("Add a hash of attributes valid for your model") + } + + let(:invalid_attributes) { + skip("Add a hash of attributes invalid for your model") + } + + let(:valid_session) { {} } + + subject(:entry) { WikiEntry.create! valid_attributes } + + describe "GET #index" do + it "returns a success response" do + get :index, params: {}, session: valid_session + expect(response).to be_successful + end + end + + describe "GET #show" do + it "returns a success response" do + get :show, params: {id: entry.id}, session: valid_session + expect(response).to be_successful + end + end + + describe "GET #new" do + it "returns a success response" do + get :new, params: {}, session: valid_session + expect(response).to be_successful + end + end + + describe "GET #edit" do + it "returns a success response" do + get :edit, params: {id: entry.id}, session: valid_session + expect(response).to be_successful + end + end + + describe "POST #create" do + context "with valid params" do + it "creates a new Wiki" do + expect { + post :create, params: {wiki_entry: valid_attributes}, session: valid_session + }.to change(WikiEntry, :count).by(1) + end + + it "redirects to the created wiki" do + post :create, params: {wiki_entry: valid_attributes}, session: valid_session + expect(response).to redirect_to(WikiEntry.last) + end + end + + context "with invalid params" do + it "redirects to new wiki entry page" do + post :create, params: {wiki_entry: invalid_attributes}, session: valid_session + expect(response).to redirect_to(new_wiki_entry_path(entry.id)) + end + end + end + + describe "PUT #update" do + context "with valid params" do + let(:new_attributes) { + skip("Add a hash of attributes valid for your model") + } + + it "updates the requested wiki" do + + put :update, params: {id: entry.id, wiki_entry: new_attributes}, session: valid_session + entry.reload + skip("Add assertions for updated state") + end + + it "redirects to the wiki" do + + put :update, params: {id: entry.id, wiki_entry: valid_attributes}, session: valid_session + expect(response).to redirect_to(wiki) + end + end + + context "with invalid params" do + it "redirects to edit wiki entry page" do + + put :update, params: {id: entry.id, wiki_entry: invalid_attributes}, session: valid_session + expect(response).to redirect_to(edit_wiki_entry_path(entry.id)) + end + end + end + + describe "DELETE #destroy" do + it "destroys the requested wiki" do + expect { + delete :destroy, params: {id: entry.id}, session: valid_session + }.to change(WikiEntry, :count).by(-1) + end + + it "redirects to the wikis list" do + delete :destroy, params: {id: entry.id}, session: valid_session + expect(response).to redirect_to(wiki_entries_url) + end + end + +end diff --git a/spec/controllers/wikis_controller_spec.rb b/spec/controllers/wikis_controller_spec.rb deleted file mode 100644 index 996b2abb..00000000 --- a/spec/controllers/wikis_controller_spec.rb +++ /dev/null @@ -1,141 +0,0 @@ -require 'rails_helper' - -# This spec was generated by rspec-rails when you ran the scaffold generator. -# It demonstrates how one might use RSpec to specify the controller code that -# was generated by Rails when you ran the scaffold generator. -# -# It assumes that the implementation code is generated by the rails scaffold -# generator. If you are using any extension libraries to generate different -# controller code, this generated spec may or may not pass. -# -# It only uses APIs available in rails and/or rspec-rails. There are a number -# of tools you can use to make these specs even more expressive, but we're -# sticking to rails and rspec-rails APIs to keep things simple and stable. -# -# Compared to earlier versions of this generator, there is very limited use of -# stubs and message expectations in this spec. Stubs are only used when there -# is no simpler way to get a handle on the object needed for the example. -# Message expectations are only used when there is no simpler way to specify -# that an instance is receiving a specific message. -# -# Also compared to earlier versions of this generator, there are no longer any -# expectations of assigns and templates rendered. These features have been -# removed from Rails core in Rails 5, but can be added back in via the -# `rails-controller-testing` gem. - -RSpec.describe WikisController, type: :controller do - - # This should return the minimal set of attributes required to create a valid - # Wiki. As you add validations to Wiki, be sure to - # adjust the attributes here as well. - let(:valid_attributes) { - skip("Add a hash of attributes valid for your model") - } - - let(:invalid_attributes) { - skip("Add a hash of attributes invalid for your model") - } - - # This should return the minimal set of values that should be in the session - # in order to pass any filters (e.g. authentication) defined in - # WikisController. Be sure to keep this updated too. - let(:valid_session) { {} } - - describe "GET #index" do - it "returns a success response" do - Wiki.create! valid_attributes - get :index, params: {}, session: valid_session - expect(response).to be_successful - end - end - - describe "GET #show" do - it "returns a success response" do - wiki = Wiki.create! valid_attributes - get :show, params: {id: wiki.to_param}, session: valid_session - expect(response).to be_successful - end - end - - describe "GET #new" do - it "returns a success response" do - get :new, params: {}, session: valid_session - expect(response).to be_successful - end - end - - describe "GET #edit" do - it "returns a success response" do - wiki = Wiki.create! valid_attributes - get :edit, params: {id: wiki.to_param}, session: valid_session - expect(response).to be_successful - end - end - - describe "POST #create" do - context "with valid params" do - it "creates a new Wiki" do - expect { - post :create, params: {wiki: valid_attributes}, session: valid_session - }.to change(Wiki, :count).by(1) - end - - it "redirects to the created wiki" do - post :create, params: {wiki: valid_attributes}, session: valid_session - expect(response).to redirect_to(Wiki.last) - end - end - - context "with invalid params" do - it "returns a success response (i.e. to display the 'new' template)" do - post :create, params: {wiki: invalid_attributes}, session: valid_session - expect(response).to be_successful - end - end - end - - describe "PUT #update" do - context "with valid params" do - let(:new_attributes) { - skip("Add a hash of attributes valid for your model") - } - - it "updates the requested wiki" do - wiki = Wiki.create! valid_attributes - put :update, params: {id: wiki.to_param, wiki: new_attributes}, session: valid_session - wiki.reload - skip("Add assertions for updated state") - end - - it "redirects to the wiki" do - wiki = Wiki.create! valid_attributes - put :update, params: {id: wiki.to_param, wiki: valid_attributes}, session: valid_session - expect(response).to redirect_to(wiki) - end - end - - context "with invalid params" do - it "returns a success response (i.e. to display the 'edit' template)" do - wiki = Wiki.create! valid_attributes - put :update, params: {id: wiki.to_param, wiki: invalid_attributes}, session: valid_session - expect(response).to be_successful - end - end - end - - describe "DELETE #destroy" do - it "destroys the requested wiki" do - wiki = Wiki.create! valid_attributes - expect { - delete :destroy, params: {id: wiki.to_param}, session: valid_session - }.to change(Wiki, :count).by(-1) - end - - it "redirects to the wikis list" do - wiki = Wiki.create! valid_attributes - delete :destroy, params: {id: wiki.to_param}, session: valid_session - expect(response).to redirect_to(wikis_url) - end - end - -end diff --git a/spec/models/comentario_spec.rb b/spec/models/wiki_comment_spec.rb similarity index 100% rename from spec/models/comentario_spec.rb rename to spec/models/wiki_comment_spec.rb diff --git a/spec/models/wiki_entry_spec.rb b/spec/models/wiki_entry_spec.rb new file mode 100644 index 00000000..f2f5243c --- /dev/null +++ b/spec/models/wiki_entry_spec.rb @@ -0,0 +1,18 @@ +require 'rails_helper' +RSpec.describe Wiki, type: :model do + describe "#create" do + it 'should create a new process when the attributes are valid' + it 'should not create a new process when the sei_process_code is not a valid code' + it 'should not create a new process when there is no assigned user' + it 'should not create a new process when the process_status_id is invalid' + it 'should not create a new process when trying to attach an invalid file ' + end + + describe "#update" do + it 'should update the process when the attributes are valid' + it 'should not update the process when the sei_process_code is not a valid code' + it 'should not update the process when there is no assigned user' + it 'should not update the process when the process_status_id is invalid' + it 'should not update the process when trying to attach an invalid file' + end +end \ No newline at end of file diff --git a/spec/models/wiki_spec.rb b/spec/models/wiki_spec.rb deleted file mode 100644 index e9607704..00000000 --- a/spec/models/wiki_spec.rb +++ /dev/null @@ -1,5 +0,0 @@ -require 'rails_helper' - -RSpec.describe Wiki, type: :model do - pending "add some examples to (or delete) #{__FILE__}" -end From db08f33ad49bc445a6819fd46d90d80035595675 Mon Sep 17 00:00:00 2001 From: aliceborges_42 Date: Wed, 11 Nov 2020 22:41:39 -0300 Subject: [PATCH 21/45] muda migrations - liga comment e wiki --- db/migrate/20201111004117_create_wikis.rb | 4 ++-- db/migrate/20201111010011_create_comentarios.rb | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/db/migrate/20201111004117_create_wikis.rb b/db/migrate/20201111004117_create_wikis.rb index df60b96c..59b012a4 100644 --- a/db/migrate/20201111004117_create_wikis.rb +++ b/db/migrate/20201111004117_create_wikis.rb @@ -1,6 +1,6 @@ -class CreateWikis < ActiveRecord::Migration[5.2] +class CreateWikiEntries < ActiveRecord::Migration[5.2] def change - create_table :wikis do |t| + create_table :wiki_entries do |t| t.string :title t.text :content diff --git a/db/migrate/20201111010011_create_comentarios.rb b/db/migrate/20201111010011_create_comentarios.rb index 16c22e2d..4f06043b 100644 --- a/db/migrate/20201111010011_create_comentarios.rb +++ b/db/migrate/20201111010011_create_comentarios.rb @@ -1,6 +1,7 @@ -class CreateComentarios < ActiveRecord::Migration[5.2] +class CreateWikiComments < ActiveRecord::Migration[5.2] def change - create_table :comentarios do |t| + create_table :wiki_comments do |t| + t.references :wiki_entry t.text :content t.timestamps From 33f9ce20d427cf6fa38a216624a1fedfefd23252 Mon Sep 17 00:00:00 2001 From: aliceborges_42 Date: Wed, 11 Nov 2020 22:42:24 -0300 Subject: [PATCH 22/45] help --- .../require 'rails_helper'.rb | 76 +++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 features/step_definitions/require 'rails_helper'.rb diff --git a/features/step_definitions/require 'rails_helper'.rb b/features/step_definitions/require 'rails_helper'.rb new file mode 100644 index 00000000..8d43b4e9 --- /dev/null +++ b/features/step_definitions/require 'rails_helper'.rb @@ -0,0 +1,76 @@ +require 'rails_helper' + +RSpec.describe Wiki, type: :model do + describe "#create" do + it 'should create a new process when the attributes are valid' + it 'should not create a new process when the sei_process_code is not a valid code' + it 'should not create a new process when there is no assigned user' + it 'should not create a new process when the process_status_id is invalid' + it 'should not create a new process when trying to attach an invalid file ' + end + + describe "#update" do + it 'should update the process when the attributes are valid' + it 'should not update the process when the sei_process_code is not a valid code' + it 'should not update the process when there is no assigned user' + it 'should not update the process when the process_status_id is invalid' + it 'should not update the process when trying to attach an invalid file' + end +end + + + +#controller +require 'rails_helper' +require 'capybara/rails' + +RSpec.describe WikisController, type: :controller do + describe "#create" do + it 'calls the create method from the Wiki model' + describe "valid params" do + it 'saves the process in DB' + it "responds with an success HTTP status" + it 'redirects to process index page' + end + describe "invalid params" do + it "doesn't save the process in DB" + it "responds with an error HTTP status" + end + end + + describe "#update" do + it 'calls the update method from an instance of the Wiki model' + describe "valid params" do + it 'updates the process data in the DB' + it "responds with an success HTTP status" + it 'redirects to process index page' + end + describe "invalid params" do + it "doesn't update the process data in the DB" + it "responds with an error HTTP status" + end + end + + describe "#show" do + describe "valid process" do + it "responds with an success HTTP status" + it 'redirects to process show page' + end + describe "invalid process" do + it "responds with an error HTTP status" + end + end + + describe "add comment" do + it "calls the create method from the Comentarios model" + describe "valid params" do + it 'saves the comment in DB' + it "responds with an success HTTP status" + it 'redirects to comment index page' + end + describe "invalid params" do + it "doesn't save the comment in DB" + it "responds with an error HTTP status" + end + end +end From 79a765e443c194db48ae2b96816d779219e8c62c Mon Sep 17 00:00:00 2001 From: aliceborges_42 Date: Thu, 12 Nov 2020 22:34:33 -0300 Subject: [PATCH 23/45] renomeia migrates --- app/controllers/wiki_comments_controller.rb | 2 +- ...rb => 20201111004117_create_wiki_entries.rb} | 0 ...b => 20201111010011_create_wiki_comments.rb} | 0 db/schema.rb | 17 ++++++++++++++++- 4 files changed, 17 insertions(+), 2 deletions(-) rename db/migrate/{20201111004117_create_wikis.rb => 20201111004117_create_wiki_entries.rb} (100%) rename db/migrate/{20201111010011_create_comentarios.rb => 20201111010011_create_wiki_comments.rb} (100%) diff --git a/app/controllers/wiki_comments_controller.rb b/app/controllers/wiki_comments_controller.rb index 3af2b429..05827d59 100644 --- a/app/controllers/wiki_comments_controller.rb +++ b/app/controllers/wiki_comments_controller.rb @@ -64,7 +64,7 @@ def destroy private # Use callbacks to share common setup or constraints between actions. def set_comment - @comment = Comment.find(params[:id]) + @comment = WikiComment.find(params[:id]) end # Never trust parameters from the scary internet, only allow the white list through. diff --git a/db/migrate/20201111004117_create_wikis.rb b/db/migrate/20201111004117_create_wiki_entries.rb similarity index 100% rename from db/migrate/20201111004117_create_wikis.rb rename to db/migrate/20201111004117_create_wiki_entries.rb diff --git a/db/migrate/20201111010011_create_comentarios.rb b/db/migrate/20201111010011_create_wiki_comments.rb similarity index 100% rename from db/migrate/20201111010011_create_comentarios.rb rename to db/migrate/20201111010011_create_wiki_comments.rb diff --git a/db/schema.rb b/db/schema.rb index 96d61d72..53c608be 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # 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_11_010011) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -30,4 +30,19 @@ t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true end + create_table "wiki_comments", force: :cascade do |t| + t.bigint "wiki_entry_id" + t.text "content" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["wiki_entry_id"], name: "index_wiki_comments_on_wiki_entry_id" + end + + create_table "wiki_entries", force: :cascade do |t| + t.string "title" + t.text "content" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + end From 83b51ebeb38e924e0c93b281eec3393e2dfba27d Mon Sep 17 00:00:00 2001 From: clarice42 Date: Fri, 13 Nov 2020 17:01:52 -0300 Subject: [PATCH 24/45] =?UTF-8?q?Renomeia=20vari=C3=A1veis,=20views=20e=20?= =?UTF-8?q?rotas?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/wiki_comments_controller.rb | 2 +- app/controllers/wiki_entries_controller.rb | 4 +-- app/models/wiki_entry.rb | 2 +- .../comentarios/_comentario.json.jbuilder | 2 -- app/views/comentarios/edit.html.erb | 6 ---- app/views/comentarios/index.html.erb | 27 ---------------- app/views/comentarios/index.json.jbuilder | 1 - app/views/comentarios/new.html.erb | 5 --- app/views/comentarios/show.html.erb | 9 ------ app/views/comentarios/show.json.jbuilder | 1 - .../_form.html.erb | 8 ++--- .../wiki_comments/_wiki_comment.json.jbuilder | 2 ++ app/views/wiki_comments/edit.html.erb | 6 ++++ app/views/wiki_comments/index.html.erb | 27 ++++++++++++++++ app/views/wiki_comments/index.json.jbuilder | 1 + app/views/wiki_comments/new.html.erb | 5 +++ app/views/wiki_comments/show.html.erb | 9 ++++++ app/views/wiki_comments/show.json.jbuilder | 1 + .../{wikis => wiki_entries}/_form.html.erb | 8 ++--- .../wiki_entries/_wiki_entry.json.jbuilder | 2 ++ app/views/wiki_entries/edit.html.erb | 6 ++++ app/views/wiki_entries/index.html.erb | 31 +++++++++++++++++++ app/views/wiki_entries/index.json.jbuilder | 1 + app/views/wiki_entries/new.html.erb | 5 +++ app/views/wiki_entries/show.html.erb | 14 +++++++++ app/views/wiki_entries/show.json.jbuilder | 1 + app/views/wikis/_wiki.json.jbuilder | 2 -- app/views/wikis/edit.html.erb | 6 ---- app/views/wikis/index.html.erb | 29 ----------------- app/views/wikis/index.json.jbuilder | 1 - app/views/wikis/new.html.erb | 5 --- app/views/wikis/show.html.erb | 14 --------- app/views/wikis/show.json.jbuilder | 1 - config/routes.rb | 4 +-- 34 files changed, 125 insertions(+), 123 deletions(-) delete mode 100644 app/views/comentarios/_comentario.json.jbuilder delete mode 100644 app/views/comentarios/edit.html.erb delete mode 100644 app/views/comentarios/index.html.erb delete mode 100644 app/views/comentarios/index.json.jbuilder delete mode 100644 app/views/comentarios/new.html.erb delete mode 100644 app/views/comentarios/show.html.erb delete mode 100644 app/views/comentarios/show.json.jbuilder rename app/views/{comentarios => wiki_comments}/_form.html.erb (52%) create mode 100644 app/views/wiki_comments/_wiki_comment.json.jbuilder create mode 100644 app/views/wiki_comments/edit.html.erb create mode 100644 app/views/wiki_comments/index.html.erb create mode 100644 app/views/wiki_comments/index.json.jbuilder create mode 100644 app/views/wiki_comments/new.html.erb create mode 100644 app/views/wiki_comments/show.html.erb create mode 100644 app/views/wiki_comments/show.json.jbuilder rename app/views/{wikis => wiki_entries}/_form.html.erb (61%) create mode 100644 app/views/wiki_entries/_wiki_entry.json.jbuilder create mode 100644 app/views/wiki_entries/edit.html.erb create mode 100644 app/views/wiki_entries/index.html.erb create mode 100644 app/views/wiki_entries/index.json.jbuilder create mode 100644 app/views/wiki_entries/new.html.erb create mode 100644 app/views/wiki_entries/show.html.erb create mode 100644 app/views/wiki_entries/show.json.jbuilder delete mode 100644 app/views/wikis/_wiki.json.jbuilder delete mode 100644 app/views/wikis/edit.html.erb delete mode 100644 app/views/wikis/index.html.erb delete mode 100644 app/views/wikis/index.json.jbuilder delete mode 100644 app/views/wikis/new.html.erb delete mode 100644 app/views/wikis/show.html.erb delete mode 100644 app/views/wikis/show.json.jbuilder diff --git a/app/controllers/wiki_comments_controller.rb b/app/controllers/wiki_comments_controller.rb index 05827d59..0ab05c4c 100644 --- a/app/controllers/wiki_comments_controller.rb +++ b/app/controllers/wiki_comments_controller.rb @@ -56,7 +56,7 @@ def update def destroy @comment.destroy respond_to do |format| - format.html { redirect_to comments_url, notice: 'Comment was successfully destroyed.' } + format.html { redirect_to wiki_comments_url, notice: 'Comment was successfully destroyed.' } format.json { head :no_content } end end diff --git a/app/controllers/wiki_entries_controller.rb b/app/controllers/wiki_entries_controller.rb index 4dc31d10..0e50ee7b 100644 --- a/app/controllers/wiki_entries_controller.rb +++ b/app/controllers/wiki_entries_controller.rb @@ -28,7 +28,7 @@ def create respond_to do |format| if @entry.save - format.html { redirect_to @entry notice: 'Wiki was successfully created.' } + format.html { redirect_to @entry, notice: 'Wiki was successfully created.' } format.json { render :show, status: :created, location: @entry} else format.html { render :new } @@ -42,7 +42,7 @@ def create def update respond_to do |format| if @entry.update(entry_params) - format.html { redirect_to @entry notice: 'Wiki was successfully updated.' } + format.html { redirect_to @entry, notice: 'Wiki was successfully updated.' } format.json { render :show, status: :ok, location: @entry} else format.html { render :edit } diff --git a/app/models/wiki_entry.rb b/app/models/wiki_entry.rb index 6ace5ba4..95f1a2bf 100644 --- a/app/models/wiki_entry.rb +++ b/app/models/wiki_entry.rb @@ -1,3 +1,3 @@ class WikiEntry < ApplicationRecord - has_one_attached :document + #has_one_attached :document end diff --git a/app/views/comentarios/_comentario.json.jbuilder b/app/views/comentarios/_comentario.json.jbuilder deleted file mode 100644 index db67448b..00000000 --- a/app/views/comentarios/_comentario.json.jbuilder +++ /dev/null @@ -1,2 +0,0 @@ -json.extract! comentario, :id, :content, :created_at, :updated_at -json.url comentario_url(comentario, format: :json) diff --git a/app/views/comentarios/edit.html.erb b/app/views/comentarios/edit.html.erb deleted file mode 100644 index 0d68e5fd..00000000 --- a/app/views/comentarios/edit.html.erb +++ /dev/null @@ -1,6 +0,0 @@ -

Editing Comentario

- -<%= render 'form', comentario: @comentario %> - -<%= link_to 'Show', @comentario %> | -<%= link_to 'Back', comentarios_path %> diff --git a/app/views/comentarios/index.html.erb b/app/views/comentarios/index.html.erb deleted file mode 100644 index e0155f7c..00000000 --- a/app/views/comentarios/index.html.erb +++ /dev/null @@ -1,27 +0,0 @@ -

<%= notice %>

- -

Comentarios

- - - - - - - - - - - <% @comentarios.each do |comentario| %> - - - - - - - <% end %> - -
Content
<%= comentario.content %><%= link_to 'Show', comentario %><%= link_to 'Edit', edit_comentario_path(comentario) %><%= link_to 'Destroy', comentario, method: :delete, data: { confirm: 'Are you sure?' } %>
- -
- -<%= link_to 'New Comentario', new_comentario_path %> diff --git a/app/views/comentarios/index.json.jbuilder b/app/views/comentarios/index.json.jbuilder deleted file mode 100644 index 4bf60503..00000000 --- a/app/views/comentarios/index.json.jbuilder +++ /dev/null @@ -1 +0,0 @@ -json.array! @comentarios, partial: "comentarios/comentario", as: :comentario diff --git a/app/views/comentarios/new.html.erb b/app/views/comentarios/new.html.erb deleted file mode 100644 index adc8b541..00000000 --- a/app/views/comentarios/new.html.erb +++ /dev/null @@ -1,5 +0,0 @@ -

New Comentario

- -<%= render 'form', comentario: @comentario %> - -<%= link_to 'Back', comentarios_path %> diff --git a/app/views/comentarios/show.html.erb b/app/views/comentarios/show.html.erb deleted file mode 100644 index 42097ae5..00000000 --- a/app/views/comentarios/show.html.erb +++ /dev/null @@ -1,9 +0,0 @@ -

<%= notice %>

- -

- Content: - <%= @comentario.content %> -

- -<%= link_to 'Edit', edit_comentario_path(@comentario) %> | -<%= link_to 'Back', comentarios_path %> diff --git a/app/views/comentarios/show.json.jbuilder b/app/views/comentarios/show.json.jbuilder deleted file mode 100644 index d084a63e..00000000 --- a/app/views/comentarios/show.json.jbuilder +++ /dev/null @@ -1 +0,0 @@ -json.partial! "comentarios/comentario", comentario: @comentario diff --git a/app/views/comentarios/_form.html.erb b/app/views/wiki_comments/_form.html.erb similarity index 52% rename from app/views/comentarios/_form.html.erb rename to app/views/wiki_comments/_form.html.erb index be21c7a2..d63eb567 100644 --- a/app/views/comentarios/_form.html.erb +++ b/app/views/wiki_comments/_form.html.erb @@ -1,10 +1,10 @@ -<%= form_with(model: comentario, local: true) do |form| %> - <% if comentario.errors.any? %> +<%= form_with(model: comment, local: true) do |form| %> + <% if comment.errors.any? %>
-

<%= pluralize(comentario.errors.count, "error") %> prohibited this comentario from being saved:

+

<%= pluralize(comment.errors.count, "error") %> prohibited this comment from being saved:

    - <% comentario.errors.full_messages.each do |message| %> + <% comment.errors.full_messages.each do |message| %>
  • <%= message %>
  • <% end %>
diff --git a/app/views/wiki_comments/_wiki_comment.json.jbuilder b/app/views/wiki_comments/_wiki_comment.json.jbuilder new file mode 100644 index 00000000..733c2af0 --- /dev/null +++ b/app/views/wiki_comments/_wiki_comment.json.jbuilder @@ -0,0 +1,2 @@ +json.extract! comment, :id, :content, :created_at, :updated_at +json.url wiki_comment_url(comment, format: :json) diff --git a/app/views/wiki_comments/edit.html.erb b/app/views/wiki_comments/edit.html.erb new file mode 100644 index 00000000..bbc6b001 --- /dev/null +++ b/app/views/wiki_comments/edit.html.erb @@ -0,0 +1,6 @@ +

Editing Comentario

+ +<%= render 'form', comment: @comment %> + +<%= link_to 'Show', @comment %> | +<%= link_to 'Back', wiki_comments_path %> diff --git a/app/views/wiki_comments/index.html.erb b/app/views/wiki_comments/index.html.erb new file mode 100644 index 00000000..c51eebcb --- /dev/null +++ b/app/views/wiki_comments/index.html.erb @@ -0,0 +1,27 @@ +

<%= notice %>

+ +

Comentarios

+ + + + + + + + + + + <% @comments.each do |comment| %> + + + + + + + <% end %> + +
Content
<%= comment.content %><%= link_to 'Show', comment %><%= link_to 'Edit', edit_wiki_comment_path(comment) %><%= link_to 'Destroy', comment, method: :delete, data: { confirm: 'Are you sure?' } %>
+ +
+ +<%= link_to 'New Comentario', new_wiki_comment_path %> diff --git a/app/views/wiki_comments/index.json.jbuilder b/app/views/wiki_comments/index.json.jbuilder new file mode 100644 index 00000000..0a640ccf --- /dev/null +++ b/app/views/wiki_comments/index.json.jbuilder @@ -0,0 +1 @@ +json.array! @comments, partial: "wiki_comments/wiki_comment", as: :comment diff --git a/app/views/wiki_comments/new.html.erb b/app/views/wiki_comments/new.html.erb new file mode 100644 index 00000000..6c50a538 --- /dev/null +++ b/app/views/wiki_comments/new.html.erb @@ -0,0 +1,5 @@ +

New Comentario

+ +<%= render 'form', comment: @comment %> + +<%= link_to 'Back', wiki_comments_path %> diff --git a/app/views/wiki_comments/show.html.erb b/app/views/wiki_comments/show.html.erb new file mode 100644 index 00000000..cf1071dd --- /dev/null +++ b/app/views/wiki_comments/show.html.erb @@ -0,0 +1,9 @@ +

<%= notice %>

+ +

+ Content: + <%= @comment.content %> +

+ +<%= link_to 'Edit', edit_wiki_comment_path(@comment) %> | +<%= link_to 'Back', wiki_comments_path %> diff --git a/app/views/wiki_comments/show.json.jbuilder b/app/views/wiki_comments/show.json.jbuilder new file mode 100644 index 00000000..7de28b6d --- /dev/null +++ b/app/views/wiki_comments/show.json.jbuilder @@ -0,0 +1 @@ +json.partial! "wiki_comments/wiki_comment", comment: @comment diff --git a/app/views/wikis/_form.html.erb b/app/views/wiki_entries/_form.html.erb similarity index 61% rename from app/views/wikis/_form.html.erb rename to app/views/wiki_entries/_form.html.erb index e624566a..4155ce30 100644 --- a/app/views/wikis/_form.html.erb +++ b/app/views/wiki_entries/_form.html.erb @@ -1,10 +1,10 @@ -<%= form_with(model: wiki, local: true) do |form| %> - <% if wiki.errors.any? %> +<%= form_with(model: entry, local: true) do |form| %> + <% if entry.errors.any? %>
-

<%= pluralize(wiki.errors.count, "error") %> prohibited this wiki from being saved:

+

<%= pluralize(entry.errors.count, "error") %> prohibited this wiki from being saved:

    - <% wiki.errors.full_messages.each do |message| %> + <% entry.errors.full_messages.each do |message| %>
  • <%= message %>
  • <% end %>
diff --git a/app/views/wiki_entries/_wiki_entry.json.jbuilder b/app/views/wiki_entries/_wiki_entry.json.jbuilder new file mode 100644 index 00000000..84c89238 --- /dev/null +++ b/app/views/wiki_entries/_wiki_entry.json.jbuilder @@ -0,0 +1,2 @@ +json.extract! entry, :id, :title, :content, :created_at, :updated_at +json.url wiki_entry_url(entry, format: :json) diff --git a/app/views/wiki_entries/edit.html.erb b/app/views/wiki_entries/edit.html.erb new file mode 100644 index 00000000..2aae8669 --- /dev/null +++ b/app/views/wiki_entries/edit.html.erb @@ -0,0 +1,6 @@ +

Editing Wiki

+ +<%= render 'form', entry: @entry %> + +<%= link_to 'Show', @entry %> | +<%= link_to 'Back', wiki_entries_path %> diff --git a/app/views/wiki_entries/index.html.erb b/app/views/wiki_entries/index.html.erb new file mode 100644 index 00000000..9bb1eeae --- /dev/null +++ b/app/views/wiki_entries/index.html.erb @@ -0,0 +1,31 @@ +

<%= notice %>

+ +
Wikis
+ +
+ + + + + + + + + + + <% @entries.each do |entry| %> + + + + + + + + <% end %> + +
TitleContent
<%= entry.title %><%= entry.content %><%= link_to 'Show', entry %><%= link_to 'Edit', edit_wiki_entry_path(entry) %><%= link_to 'Destroy', entry, method: :delete, data: { confirm: 'Are you sure?' } %>
+
+ +
+ +<%= link_to 'New Wiki', new_wiki_entry_path %> diff --git a/app/views/wiki_entries/index.json.jbuilder b/app/views/wiki_entries/index.json.jbuilder new file mode 100644 index 00000000..208973c4 --- /dev/null +++ b/app/views/wiki_entries/index.json.jbuilder @@ -0,0 +1 @@ +json.array! @entries, partial: "wiki_entries/wiki_entry", as: :entry diff --git a/app/views/wiki_entries/new.html.erb b/app/views/wiki_entries/new.html.erb new file mode 100644 index 00000000..b89f6c4c --- /dev/null +++ b/app/views/wiki_entries/new.html.erb @@ -0,0 +1,5 @@ +

New Wiki

+ +<%= render 'form', entry: @entry %> + +<%= link_to 'Back', wiki_entries_path %> diff --git a/app/views/wiki_entries/show.html.erb b/app/views/wiki_entries/show.html.erb new file mode 100644 index 00000000..023f7fcb --- /dev/null +++ b/app/views/wiki_entries/show.html.erb @@ -0,0 +1,14 @@ +

<%= notice %>

+ +

+ Title: + <%= @entry.title %> +

+ +

+ Content: + <%= @entry.content %> +

+ +<%= link_to 'Edit', edit_wiki_entry_path(@entry) %> | +<%= link_to 'Back', wiki_entries_path %> diff --git a/app/views/wiki_entries/show.json.jbuilder b/app/views/wiki_entries/show.json.jbuilder new file mode 100644 index 00000000..765dc271 --- /dev/null +++ b/app/views/wiki_entries/show.json.jbuilder @@ -0,0 +1 @@ +json.partial! "wiki_entries/wiki_entry", entry: @entry diff --git a/app/views/wikis/_wiki.json.jbuilder b/app/views/wikis/_wiki.json.jbuilder deleted file mode 100644 index dccc63e2..00000000 --- a/app/views/wikis/_wiki.json.jbuilder +++ /dev/null @@ -1,2 +0,0 @@ -json.extract! wiki, :id, :title, :content, :created_at, :updated_at -json.url wiki_url(wiki, format: :json) diff --git a/app/views/wikis/edit.html.erb b/app/views/wikis/edit.html.erb deleted file mode 100644 index 1cddd4de..00000000 --- a/app/views/wikis/edit.html.erb +++ /dev/null @@ -1,6 +0,0 @@ -

Editing Wiki

- -<%= render 'form', wiki: @wiki %> - -<%= link_to 'Show', @wiki %> | -<%= link_to 'Back', wikis_path %> diff --git a/app/views/wikis/index.html.erb b/app/views/wikis/index.html.erb deleted file mode 100644 index e66bc637..00000000 --- a/app/views/wikis/index.html.erb +++ /dev/null @@ -1,29 +0,0 @@ -

<%= notice %>

- -

Wikis

- - - - - - - - - - - - <% @wikis.each do |wiki| %> - - - - - - - - <% end %> - -
TitleContent
<%= wiki.title %><%= wiki.content %><%= link_to 'Show', wiki %><%= link_to 'Edit', edit_wiki_path(wiki) %><%= link_to 'Destroy', wiki, method: :delete, data: { confirm: 'Are you sure?' } %>
- -
- -<%= link_to 'New Wiki', new_wiki_path %> diff --git a/app/views/wikis/index.json.jbuilder b/app/views/wikis/index.json.jbuilder deleted file mode 100644 index cc9cfcab..00000000 --- a/app/views/wikis/index.json.jbuilder +++ /dev/null @@ -1 +0,0 @@ -json.array! @wikis, partial: "wikis/wiki", as: :wiki diff --git a/app/views/wikis/new.html.erb b/app/views/wikis/new.html.erb deleted file mode 100644 index 015f9522..00000000 --- a/app/views/wikis/new.html.erb +++ /dev/null @@ -1,5 +0,0 @@ -

New Wiki

- -<%= render 'form', wiki: @wiki %> - -<%= link_to 'Back', wikis_path %> diff --git a/app/views/wikis/show.html.erb b/app/views/wikis/show.html.erb deleted file mode 100644 index 3d2b7c42..00000000 --- a/app/views/wikis/show.html.erb +++ /dev/null @@ -1,14 +0,0 @@ -

<%= notice %>

- -

- Title: - <%= @wiki.title %> -

- -

- Content: - <%= @wiki.content %> -

- -<%= link_to 'Edit', edit_wiki_path(@wiki) %> | -<%= link_to 'Back', wikis_path %> diff --git a/app/views/wikis/show.json.jbuilder b/app/views/wikis/show.json.jbuilder deleted file mode 100644 index 52e94a6f..00000000 --- a/app/views/wikis/show.json.jbuilder +++ /dev/null @@ -1 +0,0 @@ -json.partial! "wikis/wiki", wiki: @wiki diff --git a/config/routes.rb b/config/routes.rb index fbd3d414..ace99628 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,8 +1,8 @@ # frozen_string_literal: true Rails.application.routes.draw do - resources :comentarios - resources :wikis + resources :wiki_comments + resources :wiki_entries get 'home/index' devise_for :users # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html From 438329eedef44982d002de73f8b64a6be7f7a67d Mon Sep 17 00:00:00 2001 From: clarice42 Date: Fri, 13 Nov 2020 17:02:12 -0300 Subject: [PATCH 25/45] Adiciona css para as views [:WIP] --- app/assets/stylesheets/scaffolds.scss | 12 ++++----- app/assets/stylesheets/wikis.scss | 37 +++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 6 deletions(-) diff --git a/app/assets/stylesheets/scaffolds.scss b/app/assets/stylesheets/scaffolds.scss index 60451880..30786e12 100644 --- a/app/assets/stylesheets/scaffolds.scss +++ b/app/assets/stylesheets/scaffolds.scss @@ -32,13 +32,13 @@ a { } } -th { - padding-bottom: 5px; -} +//th { +// padding-bottom: 5px; +//} -td { - padding: 0 5px 7px; -} +//td { +// padding: 0 5px 7px; +//} div { &.field, &.actions { diff --git a/app/assets/stylesheets/wikis.scss b/app/assets/stylesheets/wikis.scss index 6534d6dd..7d2f3550 100644 --- a/app/assets/stylesheets/wikis.scss +++ b/app/assets/stylesheets/wikis.scss @@ -1,3 +1,40 @@ // Place all the styles related to the Wikis controller here. // They will automatically be included in application.css. // You can use Sass (SCSS) here: http://sass-lang.com/ + +.title { + color: #000; + font-size: 40px; + font-family: Arial, sans-serif; + font-weight: bold; + margin-bottom: 15px; + text-align: center; +} + +.listEntries { + width: 100%; + + & > table { + table-layout: fixed; + border-collapse: separate; + border-spacing: 0 15px; + margin: 15px 0; + width: 100%; + overflow-wrap: break-word; + + & > thead > tr > th { + color: #000; + font-size: 30px; + } + + & > tbody > tr > td { + color: #000; + font-size: 20px; + margin-left: 150px; + + & > td { + text-align: center; + } + } + } +} \ No newline at end of file From b95c31aa9b62196237585798977d056f64b628f2 Mon Sep 17 00:00:00 2001 From: aliceborges_42 Date: Fri, 13 Nov 2020 17:02:39 -0300 Subject: [PATCH 26/45] =?UTF-8?q?deleta=20arquios=20desnecess=C3=A1rios?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../comentarios/_comentario.json.jbuilder | 2 - app/views/comentarios/_form.html.erb | 22 ----------- app/views/comentarios/edit.html.erb | 6 --- app/views/comentarios/index.html.erb | 27 ------------- app/views/comentarios/index.json.jbuilder | 1 - app/views/comentarios/new.html.erb | 5 --- app/views/comentarios/show.html.erb | 9 ----- app/views/comentarios/show.json.jbuilder | 1 - app/views/wikis/_form.html.erb | 27 ------------- app/views/wikis/_wiki.json.jbuilder | 2 - app/views/wikis/edit.html.erb | 6 --- app/views/wikis/index.html.erb | 29 -------------- app/views/wikis/index.json.jbuilder | 1 - app/views/wikis/new.html.erb | 5 --- app/views/wikis/show.html.erb | 14 ------- app/views/wikis/show.json.jbuilder | 1 - spec/requests/comentarios_spec.rb | 10 ----- spec/requests/wikis_spec.rb | 10 ----- spec/routing/comentarios_routing_spec.rb | 38 ------------------- spec/routing/wikis_routing_spec.rb | 38 ------------------- spec/views/comentarios/edit.html.erb_spec.rb | 18 --------- spec/views/comentarios/index.html.erb_spec.rb | 19 ---------- spec/views/comentarios/new.html.erb_spec.rb | 18 --------- spec/views/comentarios/show.html.erb_spec.rb | 14 ------- spec/views/home/index.html.erb_spec.rb | 5 --- spec/views/wikis/edit.html.erb_spec.rb | 21 ---------- spec/views/wikis/index.html.erb_spec.rb | 22 ----------- spec/views/wikis/new.html.erb_spec.rb | 21 ---------- spec/views/wikis/show.html.erb_spec.rb | 16 -------- 29 files changed, 408 deletions(-) delete mode 100644 app/views/comentarios/_comentario.json.jbuilder delete mode 100644 app/views/comentarios/_form.html.erb delete mode 100644 app/views/comentarios/edit.html.erb delete mode 100644 app/views/comentarios/index.html.erb delete mode 100644 app/views/comentarios/index.json.jbuilder delete mode 100644 app/views/comentarios/new.html.erb delete mode 100644 app/views/comentarios/show.html.erb delete mode 100644 app/views/comentarios/show.json.jbuilder delete mode 100644 app/views/wikis/_form.html.erb delete mode 100644 app/views/wikis/_wiki.json.jbuilder delete mode 100644 app/views/wikis/edit.html.erb delete mode 100644 app/views/wikis/index.html.erb delete mode 100644 app/views/wikis/index.json.jbuilder delete mode 100644 app/views/wikis/new.html.erb delete mode 100644 app/views/wikis/show.html.erb delete mode 100644 app/views/wikis/show.json.jbuilder delete mode 100644 spec/requests/comentarios_spec.rb delete mode 100644 spec/requests/wikis_spec.rb delete mode 100644 spec/routing/comentarios_routing_spec.rb delete mode 100644 spec/routing/wikis_routing_spec.rb delete mode 100644 spec/views/comentarios/edit.html.erb_spec.rb delete mode 100644 spec/views/comentarios/index.html.erb_spec.rb delete mode 100644 spec/views/comentarios/new.html.erb_spec.rb delete mode 100644 spec/views/comentarios/show.html.erb_spec.rb delete mode 100644 spec/views/home/index.html.erb_spec.rb delete mode 100644 spec/views/wikis/edit.html.erb_spec.rb delete mode 100644 spec/views/wikis/index.html.erb_spec.rb delete mode 100644 spec/views/wikis/new.html.erb_spec.rb delete mode 100644 spec/views/wikis/show.html.erb_spec.rb diff --git a/app/views/comentarios/_comentario.json.jbuilder b/app/views/comentarios/_comentario.json.jbuilder deleted file mode 100644 index db67448b..00000000 --- a/app/views/comentarios/_comentario.json.jbuilder +++ /dev/null @@ -1,2 +0,0 @@ -json.extract! comentario, :id, :content, :created_at, :updated_at -json.url comentario_url(comentario, format: :json) diff --git a/app/views/comentarios/_form.html.erb b/app/views/comentarios/_form.html.erb deleted file mode 100644 index be21c7a2..00000000 --- a/app/views/comentarios/_form.html.erb +++ /dev/null @@ -1,22 +0,0 @@ -<%= form_with(model: comentario, local: true) do |form| %> - <% if comentario.errors.any? %> -
-

<%= pluralize(comentario.errors.count, "error") %> prohibited this comentario from being saved:

- -
    - <% comentario.errors.full_messages.each do |message| %> -
  • <%= message %>
  • - <% end %> -
-
- <% end %> - -
- <%= form.label :content %> - <%= form.text_area :content %> -
- -
- <%= form.submit %> -
-<% end %> diff --git a/app/views/comentarios/edit.html.erb b/app/views/comentarios/edit.html.erb deleted file mode 100644 index 0d68e5fd..00000000 --- a/app/views/comentarios/edit.html.erb +++ /dev/null @@ -1,6 +0,0 @@ -

Editing Comentario

- -<%= render 'form', comentario: @comentario %> - -<%= link_to 'Show', @comentario %> | -<%= link_to 'Back', comentarios_path %> diff --git a/app/views/comentarios/index.html.erb b/app/views/comentarios/index.html.erb deleted file mode 100644 index e0155f7c..00000000 --- a/app/views/comentarios/index.html.erb +++ /dev/null @@ -1,27 +0,0 @@ -

<%= notice %>

- -

Comentarios

- - - - - - - - - - - <% @comentarios.each do |comentario| %> - - - - - - - <% end %> - -
Content
<%= comentario.content %><%= link_to 'Show', comentario %><%= link_to 'Edit', edit_comentario_path(comentario) %><%= link_to 'Destroy', comentario, method: :delete, data: { confirm: 'Are you sure?' } %>
- -
- -<%= link_to 'New Comentario', new_comentario_path %> diff --git a/app/views/comentarios/index.json.jbuilder b/app/views/comentarios/index.json.jbuilder deleted file mode 100644 index 4bf60503..00000000 --- a/app/views/comentarios/index.json.jbuilder +++ /dev/null @@ -1 +0,0 @@ -json.array! @comentarios, partial: "comentarios/comentario", as: :comentario diff --git a/app/views/comentarios/new.html.erb b/app/views/comentarios/new.html.erb deleted file mode 100644 index adc8b541..00000000 --- a/app/views/comentarios/new.html.erb +++ /dev/null @@ -1,5 +0,0 @@ -

New Comentario

- -<%= render 'form', comentario: @comentario %> - -<%= link_to 'Back', comentarios_path %> diff --git a/app/views/comentarios/show.html.erb b/app/views/comentarios/show.html.erb deleted file mode 100644 index 42097ae5..00000000 --- a/app/views/comentarios/show.html.erb +++ /dev/null @@ -1,9 +0,0 @@ -

<%= notice %>

- -

- Content: - <%= @comentario.content %> -

- -<%= link_to 'Edit', edit_comentario_path(@comentario) %> | -<%= link_to 'Back', comentarios_path %> diff --git a/app/views/comentarios/show.json.jbuilder b/app/views/comentarios/show.json.jbuilder deleted file mode 100644 index d084a63e..00000000 --- a/app/views/comentarios/show.json.jbuilder +++ /dev/null @@ -1 +0,0 @@ -json.partial! "comentarios/comentario", comentario: @comentario diff --git a/app/views/wikis/_form.html.erb b/app/views/wikis/_form.html.erb deleted file mode 100644 index e624566a..00000000 --- a/app/views/wikis/_form.html.erb +++ /dev/null @@ -1,27 +0,0 @@ -<%= form_with(model: wiki, local: true) do |form| %> - <% if wiki.errors.any? %> -
-

<%= pluralize(wiki.errors.count, "error") %> prohibited this wiki from being saved:

- -
    - <% wiki.errors.full_messages.each do |message| %> -
  • <%= message %>
  • - <% end %> -
-
- <% end %> - -
- <%= form.label :title %> - <%= form.text_field :title %> -
- -
- <%= form.label :content %> - <%= form.text_area :content %> -
- -
- <%= form.submit %> -
-<% end %> diff --git a/app/views/wikis/_wiki.json.jbuilder b/app/views/wikis/_wiki.json.jbuilder deleted file mode 100644 index dccc63e2..00000000 --- a/app/views/wikis/_wiki.json.jbuilder +++ /dev/null @@ -1,2 +0,0 @@ -json.extract! wiki, :id, :title, :content, :created_at, :updated_at -json.url wiki_url(wiki, format: :json) diff --git a/app/views/wikis/edit.html.erb b/app/views/wikis/edit.html.erb deleted file mode 100644 index 1cddd4de..00000000 --- a/app/views/wikis/edit.html.erb +++ /dev/null @@ -1,6 +0,0 @@ -

Editing Wiki

- -<%= render 'form', wiki: @wiki %> - -<%= link_to 'Show', @wiki %> | -<%= link_to 'Back', wikis_path %> diff --git a/app/views/wikis/index.html.erb b/app/views/wikis/index.html.erb deleted file mode 100644 index e66bc637..00000000 --- a/app/views/wikis/index.html.erb +++ /dev/null @@ -1,29 +0,0 @@ -

<%= notice %>

- -

Wikis

- - - - - - - - - - - - <% @wikis.each do |wiki| %> - - - - - - - - <% end %> - -
TitleContent
<%= wiki.title %><%= wiki.content %><%= link_to 'Show', wiki %><%= link_to 'Edit', edit_wiki_path(wiki) %><%= link_to 'Destroy', wiki, method: :delete, data: { confirm: 'Are you sure?' } %>
- -
- -<%= link_to 'New Wiki', new_wiki_path %> diff --git a/app/views/wikis/index.json.jbuilder b/app/views/wikis/index.json.jbuilder deleted file mode 100644 index cc9cfcab..00000000 --- a/app/views/wikis/index.json.jbuilder +++ /dev/null @@ -1 +0,0 @@ -json.array! @wikis, partial: "wikis/wiki", as: :wiki diff --git a/app/views/wikis/new.html.erb b/app/views/wikis/new.html.erb deleted file mode 100644 index 015f9522..00000000 --- a/app/views/wikis/new.html.erb +++ /dev/null @@ -1,5 +0,0 @@ -

New Wiki

- -<%= render 'form', wiki: @wiki %> - -<%= link_to 'Back', wikis_path %> diff --git a/app/views/wikis/show.html.erb b/app/views/wikis/show.html.erb deleted file mode 100644 index 3d2b7c42..00000000 --- a/app/views/wikis/show.html.erb +++ /dev/null @@ -1,14 +0,0 @@ -

<%= notice %>

- -

- Title: - <%= @wiki.title %> -

- -

- Content: - <%= @wiki.content %> -

- -<%= link_to 'Edit', edit_wiki_path(@wiki) %> | -<%= link_to 'Back', wikis_path %> diff --git a/app/views/wikis/show.json.jbuilder b/app/views/wikis/show.json.jbuilder deleted file mode 100644 index 52e94a6f..00000000 --- a/app/views/wikis/show.json.jbuilder +++ /dev/null @@ -1 +0,0 @@ -json.partial! "wikis/wiki", wiki: @wiki diff --git a/spec/requests/comentarios_spec.rb b/spec/requests/comentarios_spec.rb deleted file mode 100644 index 8feac886..00000000 --- a/spec/requests/comentarios_spec.rb +++ /dev/null @@ -1,10 +0,0 @@ -require 'rails_helper' - -RSpec.describe "Comentarios", type: :request do - describe "GET /comentarios" do - it "works! (now write some real specs)" do - get comentarios_path - expect(response).to have_http_status(200) - end - end -end diff --git a/spec/requests/wikis_spec.rb b/spec/requests/wikis_spec.rb deleted file mode 100644 index 8eb4eca7..00000000 --- a/spec/requests/wikis_spec.rb +++ /dev/null @@ -1,10 +0,0 @@ -require 'rails_helper' - -RSpec.describe "Wikis", type: :request do - describe "GET /wikis" do - it "works! (now write some real specs)" do - get wikis_path - expect(response).to have_http_status(200) - end - end -end diff --git a/spec/routing/comentarios_routing_spec.rb b/spec/routing/comentarios_routing_spec.rb deleted file mode 100644 index 48161e10..00000000 --- a/spec/routing/comentarios_routing_spec.rb +++ /dev/null @@ -1,38 +0,0 @@ -require "rails_helper" - -RSpec.describe ComentariosController, type: :routing do - describe "routing" do - it "routes to #index" do - expect(:get => "/comentarios").to route_to("comentarios#index") - end - - it "routes to #new" do - expect(:get => "/comentarios/new").to route_to("comentarios#new") - end - - it "routes to #show" do - expect(:get => "/comentarios/1").to route_to("comentarios#show", :id => "1") - end - - it "routes to #edit" do - expect(:get => "/comentarios/1/edit").to route_to("comentarios#edit", :id => "1") - end - - - it "routes to #create" do - expect(:post => "/comentarios").to route_to("comentarios#create") - end - - it "routes to #update via PUT" do - expect(:put => "/comentarios/1").to route_to("comentarios#update", :id => "1") - end - - it "routes to #update via PATCH" do - expect(:patch => "/comentarios/1").to route_to("comentarios#update", :id => "1") - end - - it "routes to #destroy" do - expect(:delete => "/comentarios/1").to route_to("comentarios#destroy", :id => "1") - end - end -end diff --git a/spec/routing/wikis_routing_spec.rb b/spec/routing/wikis_routing_spec.rb deleted file mode 100644 index b646b44a..00000000 --- a/spec/routing/wikis_routing_spec.rb +++ /dev/null @@ -1,38 +0,0 @@ -require "rails_helper" - -RSpec.describe WikisController, type: :routing do - describe "routing" do - it "routes to #index" do - expect(:get => "/wikis").to route_to("wikis#index") - end - - it "routes to #new" do - expect(:get => "/wikis/new").to route_to("wikis#new") - end - - it "routes to #show" do - expect(:get => "/wikis/1").to route_to("wikis#show", :id => "1") - end - - it "routes to #edit" do - expect(:get => "/wikis/1/edit").to route_to("wikis#edit", :id => "1") - end - - - it "routes to #create" do - expect(:post => "/wikis").to route_to("wikis#create") - end - - it "routes to #update via PUT" do - expect(:put => "/wikis/1").to route_to("wikis#update", :id => "1") - end - - it "routes to #update via PATCH" do - expect(:patch => "/wikis/1").to route_to("wikis#update", :id => "1") - end - - it "routes to #destroy" do - expect(:delete => "/wikis/1").to route_to("wikis#destroy", :id => "1") - end - end -end diff --git a/spec/views/comentarios/edit.html.erb_spec.rb b/spec/views/comentarios/edit.html.erb_spec.rb deleted file mode 100644 index 925b3ca9..00000000 --- a/spec/views/comentarios/edit.html.erb_spec.rb +++ /dev/null @@ -1,18 +0,0 @@ -require 'rails_helper' - -RSpec.describe "comentarios/edit", type: :view do - before(:each) do - @comentario = assign(:comentario, Comentario.create!( - :content => "MyText" - )) - end - - it "renders the edit comentario form" do - render - - assert_select "form[action=?][method=?]", comentario_path(@comentario), "post" do - - assert_select "textarea[name=?]", "comentario[content]" - end - end -end diff --git a/spec/views/comentarios/index.html.erb_spec.rb b/spec/views/comentarios/index.html.erb_spec.rb deleted file mode 100644 index ba8b6191..00000000 --- a/spec/views/comentarios/index.html.erb_spec.rb +++ /dev/null @@ -1,19 +0,0 @@ -require 'rails_helper' - -RSpec.describe "comentarios/index", type: :view do - before(:each) do - assign(:comentarios, [ - Comentario.create!( - :content => "MyText" - ), - Comentario.create!( - :content => "MyText" - ) - ]) - end - - it "renders a list of comentarios" do - render - assert_select "tr>td", :text => "MyText".to_s, :count => 2 - end -end diff --git a/spec/views/comentarios/new.html.erb_spec.rb b/spec/views/comentarios/new.html.erb_spec.rb deleted file mode 100644 index fadd290c..00000000 --- a/spec/views/comentarios/new.html.erb_spec.rb +++ /dev/null @@ -1,18 +0,0 @@ -require 'rails_helper' - -RSpec.describe "comentarios/new", type: :view do - before(:each) do - assign(:comentario, Comentario.new( - :content => "MyText" - )) - end - - it "renders new comentario form" do - render - - assert_select "form[action=?][method=?]", comentarios_path, "post" do - - assert_select "textarea[name=?]", "comentario[content]" - end - end -end diff --git a/spec/views/comentarios/show.html.erb_spec.rb b/spec/views/comentarios/show.html.erb_spec.rb deleted file mode 100644 index 5aa80791..00000000 --- a/spec/views/comentarios/show.html.erb_spec.rb +++ /dev/null @@ -1,14 +0,0 @@ -require 'rails_helper' - -RSpec.describe "comentarios/show", type: :view do - before(:each) do - @comentario = assign(:comentario, Comentario.create!( - :content => "MyText" - )) - end - - it "renders attributes in

" do - render - expect(rendered).to match(/MyText/) - end -end diff --git a/spec/views/home/index.html.erb_spec.rb b/spec/views/home/index.html.erb_spec.rb deleted file mode 100644 index 75bb045b..00000000 --- a/spec/views/home/index.html.erb_spec.rb +++ /dev/null @@ -1,5 +0,0 @@ -require 'rails_helper' - -RSpec.describe "home/index.html.erb", type: :view do - pending "add some examples to (or delete) #{__FILE__}" -end diff --git a/spec/views/wikis/edit.html.erb_spec.rb b/spec/views/wikis/edit.html.erb_spec.rb deleted file mode 100644 index 4a6621ad..00000000 --- a/spec/views/wikis/edit.html.erb_spec.rb +++ /dev/null @@ -1,21 +0,0 @@ -require 'rails_helper' - -RSpec.describe "wikis/edit", type: :view do - before(:each) do - @wiki = assign(:wiki, Wiki.create!( - :title => "MyString", - :content => "MyText" - )) - end - - it "renders the edit wiki form" do - render - - assert_select "form[action=?][method=?]", wiki_path(@wiki), "post" do - - assert_select "input[name=?]", "wiki[title]" - - assert_select "textarea[name=?]", "wiki[content]" - end - end -end diff --git a/spec/views/wikis/index.html.erb_spec.rb b/spec/views/wikis/index.html.erb_spec.rb deleted file mode 100644 index c26abe01..00000000 --- a/spec/views/wikis/index.html.erb_spec.rb +++ /dev/null @@ -1,22 +0,0 @@ -require 'rails_helper' - -RSpec.describe "wikis/index", type: :view do - before(:each) do - assign(:wikis, [ - Wiki.create!( - :title => "Title", - :content => "MyText" - ), - Wiki.create!( - :title => "Title", - :content => "MyText" - ) - ]) - end - - it "renders a list of wikis" do - render - assert_select "tr>td", :text => "Title".to_s, :count => 2 - assert_select "tr>td", :text => "MyText".to_s, :count => 2 - end -end diff --git a/spec/views/wikis/new.html.erb_spec.rb b/spec/views/wikis/new.html.erb_spec.rb deleted file mode 100644 index 48d1bd06..00000000 --- a/spec/views/wikis/new.html.erb_spec.rb +++ /dev/null @@ -1,21 +0,0 @@ -require 'rails_helper' - -RSpec.describe "wikis/new", type: :view do - before(:each) do - assign(:wiki, Wiki.new( - :title => "MyString", - :content => "MyText" - )) - end - - it "renders new wiki form" do - render - - assert_select "form[action=?][method=?]", wikis_path, "post" do - - assert_select "input[name=?]", "wiki[title]" - - assert_select "textarea[name=?]", "wiki[content]" - end - end -end diff --git a/spec/views/wikis/show.html.erb_spec.rb b/spec/views/wikis/show.html.erb_spec.rb deleted file mode 100644 index 63ec2686..00000000 --- a/spec/views/wikis/show.html.erb_spec.rb +++ /dev/null @@ -1,16 +0,0 @@ -require 'rails_helper' - -RSpec.describe "wikis/show", type: :view do - before(:each) do - @wiki = assign(:wiki, Wiki.create!( - :title => "Title", - :content => "MyText" - )) - end - - it "renders attributes in

" do - render - expect(rendered).to match(/Title/) - expect(rendered).to match(/MyText/) - end -end From b7f01e3fa6da360b4854defa71e09d29786ef9c3 Mon Sep 17 00:00:00 2001 From: aliceborges_42 Date: Fri, 13 Nov 2020 17:05:23 -0300 Subject: [PATCH 27/45] =?UTF-8?q?adiciona=20valida=C3=A7=C3=B5es=20em=20Wi?= =?UTF-8?q?kiEntry?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/wiki_entry.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/models/wiki_entry.rb b/app/models/wiki_entry.rb index 6ace5ba4..7dea6dc8 100644 --- a/app/models/wiki_entry.rb +++ b/app/models/wiki_entry.rb @@ -1,3 +1,5 @@ class WikiEntry < ApplicationRecord has_one_attached :document + validates :title, presence: true + validates :content, presence: true end From c9637ec75e701b0986ec26b627ed09f6cd7ada34 Mon Sep 17 00:00:00 2001 From: aliceborges_42 Date: Fri, 13 Nov 2020 17:07:39 -0300 Subject: [PATCH 28/45] refatora testes model --- spec/models/wiki_comment_spec.rb | 2 +- spec/models/wiki_entry_spec.rb | 46 ++++++++++++++++++++++---------- 2 files changed, 33 insertions(+), 15 deletions(-) diff --git a/spec/models/wiki_comment_spec.rb b/spec/models/wiki_comment_spec.rb index 1a4ccf48..a0a09063 100644 --- a/spec/models/wiki_comment_spec.rb +++ b/spec/models/wiki_comment_spec.rb @@ -1,5 +1,5 @@ require 'rails_helper' -RSpec.describe Comentario, type: :model do +RSpec.describe WikiComment, type: :model do pending "add some examples to (or delete) #{__FILE__}" end diff --git a/spec/models/wiki_entry_spec.rb b/spec/models/wiki_entry_spec.rb index f2f5243c..4ceecd85 100644 --- a/spec/models/wiki_entry_spec.rb +++ b/spec/models/wiki_entry_spec.rb @@ -1,18 +1,36 @@ require 'rails_helper' -RSpec.describe Wiki, type: :model do - describe "#create" do - it 'should create a new process when the attributes are valid' - it 'should not create a new process when the sei_process_code is not a valid code' - it 'should not create a new process when there is no assigned user' - it 'should not create a new process when the process_status_id is invalid' - it 'should not create a new process when trying to attach an invalid file ' - end +RSpec.describe WikiEntry, type: :model do + + let(:valid_attributes) { + {id: 1, title: 'title', content:'content'} + } + + let(:document) { + Rack::Test::UploadedFile.new(Rails.root.join("spec/support/assets/document.xml")) + } + + subject(:entry) { + WikiEntry.create(valid_attributes) + } - describe "#update" do - it 'should update the process when the attributes are valid' - it 'should not update the process when the sei_process_code is not a valid code' - it 'should not update the process when there is no assigned user' - it 'should not update the process when the process_status_id is invalid' - it 'should not update the process when trying to attach an invalid file' + describe "Validations" do + + it "is valid with the valid attributes" do + expect(WikiEntry.new(valid_attributes)).to be_valid + end + + it "is valid with a valid document" do + expect(WikiEntry.new(valid_attributes.merge({document: document}))).to be_valid + end + + it "is not valid without a title" do + expect(WikiEntry.new({id: 1, title: '', content: 'content'})).to_not be_valid + end + + it "is not valid without a content" do + expect(WikiEntry.new({id: 1, title: 'title', content: ''})).to_not be_valid + end + end + end \ No newline at end of file From c9ef62499214830a22aef6d9c4c968aca5ef627f Mon Sep 17 00:00:00 2001 From: aliceborges_42 Date: Fri, 13 Nov 2020 17:08:26 -0300 Subject: [PATCH 29/45] adiciona active storage --- ...te_active_storage_tables.active_storage.rb | 27 +++++++++++++++++++ db/schema.rb | 24 ++++++++++++++++- 2 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20201113193124_create_active_storage_tables.active_storage.rb diff --git a/db/migrate/20201113193124_create_active_storage_tables.active_storage.rb b/db/migrate/20201113193124_create_active_storage_tables.active_storage.rb new file mode 100644 index 00000000..0b2ce257 --- /dev/null +++ b/db/migrate/20201113193124_create_active_storage_tables.active_storage.rb @@ -0,0 +1,27 @@ +# This migration comes from active_storage (originally 20170806125915) +class CreateActiveStorageTables < ActiveRecord::Migration[5.2] + def change + create_table :active_storage_blobs do |t| + t.string :key, null: false + t.string :filename, null: false + t.string :content_type + t.text :metadata + t.bigint :byte_size, null: false + t.string :checksum, null: false + t.datetime :created_at, null: false + + t.index [ :key ], unique: true + end + + create_table :active_storage_attachments do |t| + t.string :name, null: false + t.references :record, null: false, polymorphic: true, index: false + t.references :blob, null: false + + t.datetime :created_at, null: false + + t.index [ :record_type, :record_id, :name, :blob_id ], name: "index_active_storage_attachments_uniqueness", unique: true + t.foreign_key :active_storage_blobs, column: :blob_id + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 53c608be..3a73fab7 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,11 +10,32 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2020_11_11_010011) do +ActiveRecord::Schema.define(version: 2020_11_13_193124) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" + create_table "active_storage_attachments", force: :cascade do |t| + t.string "name", null: false + t.string "record_type", null: false + t.bigint "record_id", null: false + t.bigint "blob_id", null: false + t.datetime "created_at", null: false + t.index ["blob_id"], name: "index_active_storage_attachments_on_blob_id" + t.index ["record_type", "record_id", "name", "blob_id"], name: "index_active_storage_attachments_uniqueness", unique: true + end + + create_table "active_storage_blobs", force: :cascade do |t| + t.string "key", null: false + t.string "filename", null: false + t.string "content_type" + t.text "metadata" + t.bigint "byte_size", null: false + t.string "checksum", null: false + t.datetime "created_at", null: false + t.index ["key"], name: "index_active_storage_blobs_on_key", unique: true + end + create_table "users", force: :cascade do |t| t.string "email", default: "", null: false t.string "encrypted_password", default: "", null: false @@ -45,4 +66,5 @@ t.datetime "updated_at", null: false end + add_foreign_key "active_storage_attachments", "active_storage_blobs", column: "blob_id" end From 98509771aa86254596309fe59d07c2b046869b49 Mon Sep 17 00:00:00 2001 From: aliceborges_42 Date: Fri, 13 Nov 2020 17:08:47 -0300 Subject: [PATCH 30/45] documento de teste --- spec/support/assets/document.xml | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 spec/support/assets/document.xml diff --git a/spec/support/assets/document.xml b/spec/support/assets/document.xml new file mode 100644 index 00000000..e69de29b From 49a163ad32d812aef18193e5500970129f4ef10c Mon Sep 17 00:00:00 2001 From: aliceborges_42 Date: Fri, 13 Nov 2020 17:15:41 -0300 Subject: [PATCH 31/45] adiciona testes controller e cucumber --- app/controllers/wiki_entries_controller.rb | 4 ++-- features/step_definitions/shared_steps.rb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/controllers/wiki_entries_controller.rb b/app/controllers/wiki_entries_controller.rb index 4dc31d10..0e50ee7b 100644 --- a/app/controllers/wiki_entries_controller.rb +++ b/app/controllers/wiki_entries_controller.rb @@ -28,7 +28,7 @@ def create respond_to do |format| if @entry.save - format.html { redirect_to @entry notice: 'Wiki was successfully created.' } + format.html { redirect_to @entry, notice: 'Wiki was successfully created.' } format.json { render :show, status: :created, location: @entry} else format.html { render :new } @@ -42,7 +42,7 @@ def create def update respond_to do |format| if @entry.update(entry_params) - format.html { redirect_to @entry notice: 'Wiki was successfully updated.' } + format.html { redirect_to @entry, notice: 'Wiki was successfully updated.' } format.json { render :show, status: :ok, location: @entry} else format.html { render :edit } diff --git a/features/step_definitions/shared_steps.rb b/features/step_definitions/shared_steps.rb index 74d55fa3..a7e5b699 100644 --- a/features/step_definitions/shared_steps.rb +++ b/features/step_definitions/shared_steps.rb @@ -1,5 +1,5 @@ Quando(/(?:clico|clicar) no botão "([^"]*)"/) do |botao| - pending # Write code here that turns the phrase above into concrete actions + click_button botao end Então(/recebo uma mensagem de (sucesso|erro)/) do |status| @@ -11,7 +11,7 @@ end Quando(/preencho o campo "([^"]*)" com "([^"]*)"/) do |campo, valor| - pending # Write code here that turns the phrase above into concrete actions + fill_in campo, with: valor end Dado(/(?:esteja na|redirecionado para a) página "([^"]*)"/) do |pagina| From 7d97ec4cbfc00e669f319eacf07a0de092c82183 Mon Sep 17 00:00:00 2001 From: nayarasilva Date: Fri, 13 Nov 2020 20:19:03 -0300 Subject: [PATCH 32/45] =?UTF-8?q?Refatorando=20testes=20e=20criando=20rela?= =?UTF-8?q?=C3=A7=C3=A3o=20wiki=5Fcomments?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/wiki_comments_controller.rb | 17 +++-- app/controllers/wiki_entries_controller.rb | 7 +- app/models/wiki_comment.rb | 1 + app/models/wiki_entry.rb | 1 + app/views/wiki_comments/_form.html.erb | 38 +++++----- app/views/wiki_comments/edit.html.erb | 5 +- app/views/wiki_comments/new.html.erb | 6 +- app/views/wiki_entries/_form.html.erb | 6 +- app/views/wiki_entries/index.html.erb | 14 ++-- app/views/wiki_entries/show.html.erb | 32 +++++--- config/routes.rb | 6 +- ...cesso.feature => anexar_documento.feature} | 0 ....feature => anexar_documento_novo.feature} | 0 features/consultar_entrada_wiki.feature | 15 ++++ features/consultar_processo.feature | 21 ----- ...sso.feature => criar_entrada_wiki.feature} | 11 ++- ...ki.feature => editar_entrada_wiki.feature} | 15 ++-- features/step_definitions/processos_steps.rb | 6 -- .../require 'rails_helper'.rb | 76 ------------------- features/step_definitions/shared_steps.rb | 37 +++++++-- features/support/env.rb | 5 ++ 21 files changed, 139 insertions(+), 180 deletions(-) rename features/{anexar_processo.feature => anexar_documento.feature} (100%) rename features/{anexar_novo_processo.feature => anexar_documento_novo.feature} (100%) create mode 100644 features/consultar_entrada_wiki.feature delete mode 100644 features/consultar_processo.feature rename features/{criar_processo.feature => criar_entrada_wiki.feature} (64%) rename features/{editar_processo_wiki.feature => editar_entrada_wiki.feature} (57%) delete mode 100644 features/step_definitions/processos_steps.rb delete mode 100644 features/step_definitions/require 'rails_helper'.rb diff --git a/app/controllers/wiki_comments_controller.rb b/app/controllers/wiki_comments_controller.rb index 0ab05c4c..823ff77d 100644 --- a/app/controllers/wiki_comments_controller.rb +++ b/app/controllers/wiki_comments_controller.rb @@ -1,5 +1,6 @@ class WikiCommentsController < ApplicationController before_action :set_comment, only: [:show, :edit, :update, :destroy] + before_action :set_entry, only:[:index, :new, :create] # GET /comments # GET /comments.json @@ -24,11 +25,12 @@ def edit # POST /comments # POST /comments.json def create - @comment = WikiComment.new(comment_params) - + + @comment = WikiComment.new(comment_params.merge({entry: @entry})) + respond_to do |format| if @comment.save - format.html { redirect_to @comment, notice: 'Comment was successfully created.' } + format.html { redirect_to @comment.entry, notice: 'Comment was successfully created.' } format.json { render :show, status: :created, location: @comment } else format.html { render :new } @@ -42,7 +44,7 @@ def create def update respond_to do |format| if @comment.update(comment_params) - format.html { redirect_to @comment, notice: 'Comment was successfully updated.' } + format.html { redirect_to @comment.entry, notice: 'Comment was successfully updated.' } format.json { render :show, status: :ok, location: @comment } else format.html { render :edit } @@ -56,7 +58,7 @@ def update def destroy @comment.destroy respond_to do |format| - format.html { redirect_to wiki_comments_url, notice: 'Comment was successfully destroyed.' } + format.html { redirect_to @comment.entry, notice: 'Comment was successfully destroyed.' } format.json { head :no_content } end end @@ -67,6 +69,11 @@ def set_comment @comment = WikiComment.find(params[:id]) end + + def set_entry + @entry = WikiEntry.find(params[:wiki_entry_id]) + end + # Never trust parameters from the scary internet, only allow the white list through. def comment_params params.require(:wiki_comment).permit(:content) diff --git a/app/controllers/wiki_entries_controller.rb b/app/controllers/wiki_entries_controller.rb index 0e50ee7b..3453a02c 100644 --- a/app/controllers/wiki_entries_controller.rb +++ b/app/controllers/wiki_entries_controller.rb @@ -10,6 +10,7 @@ def index # GET /wikis/1 # GET /wikis/1.json def show + end # GET /wikis/new @@ -28,10 +29,10 @@ def create respond_to do |format| if @entry.save - format.html { redirect_to @entry, notice: 'Wiki was successfully created.' } + format.html { redirect_to @entry, notice: 'Página foi criada com sucesso!' } format.json { render :show, status: :created, location: @entry} else - format.html { render :new } + format.html { render :new} format.json { render json: @entry.errors, status: :unprocessable_entity } end end @@ -42,7 +43,7 @@ def create def update respond_to do |format| if @entry.update(entry_params) - format.html { redirect_to @entry, notice: 'Wiki was successfully updated.' } + format.html { redirect_to @entry, notice: 'Página foi criada com sucesso!' } format.json { render :show, status: :ok, location: @entry} else format.html { render :edit } diff --git a/app/models/wiki_comment.rb b/app/models/wiki_comment.rb index eaa5375e..e439f5de 100644 --- a/app/models/wiki_comment.rb +++ b/app/models/wiki_comment.rb @@ -1,2 +1,3 @@ class WikiComment < ApplicationRecord + belongs_to :entry, class_name: "WikiEntry", foreign_key: "wiki_entry_id" end diff --git a/app/models/wiki_entry.rb b/app/models/wiki_entry.rb index 7dea6dc8..63576825 100644 --- a/app/models/wiki_entry.rb +++ b/app/models/wiki_entry.rb @@ -1,5 +1,6 @@ class WikiEntry < ApplicationRecord has_one_attached :document + has_many :comments, class_name:"WikiComment" validates :title, presence: true validates :content, presence: true end diff --git a/app/views/wiki_comments/_form.html.erb b/app/views/wiki_comments/_form.html.erb index d63eb567..9b5166cf 100644 --- a/app/views/wiki_comments/_form.html.erb +++ b/app/views/wiki_comments/_form.html.erb @@ -1,22 +1,22 @@ -<%= form_with(model: comment, local: true) do |form| %> - <% if comment.errors.any? %> -

-

<%= pluralize(comment.errors.count, "error") %> prohibited this comment from being saved:

+<% if comment.errors.any? %> +
+

<%= pluralize(comment.errors.count, "error") %> prohibited this comment from being saved:

-
    - <% comment.errors.full_messages.each do |message| %> -
  • <%= message %>
  • - <% end %> -
-
- <% end %> - -
- <%= form.label :content %> - <%= form.text_area :content %> -
- -
- <%= form.submit %> +
    + <% comment.errors.full_messages.each do |message| %> +
  • <%= message %>
  • + <% end %> +
<% end %> + +<%= form.hidden_field :wiki_entry_id, value:entry.id %> + +
+ <%= form.label :content %> + <%= form.text_area :content %> +
+ +
+ <%= form.submit %> +
diff --git a/app/views/wiki_comments/edit.html.erb b/app/views/wiki_comments/edit.html.erb index bbc6b001..dad224e4 100644 --- a/app/views/wiki_comments/edit.html.erb +++ b/app/views/wiki_comments/edit.html.erb @@ -1,6 +1,7 @@

Editing Comentario

-<%= render 'form', comment: @comment %> - +<%= form_for @comment, url: comment_path(@comment), method: :put do |form|%> +<%= render 'form', form:form, comment: @comment, entry:@entry%> +<%end%> <%= link_to 'Show', @comment %> | <%= link_to 'Back', wiki_comments_path %> diff --git a/app/views/wiki_comments/new.html.erb b/app/views/wiki_comments/new.html.erb index 6c50a538..c85271aa 100644 --- a/app/views/wiki_comments/new.html.erb +++ b/app/views/wiki_comments/new.html.erb @@ -1,5 +1,7 @@

New Comentario

-<%= render 'form', comment: @comment %> +<%= form_for @comment, url: wiki_entry_comments_path(@entry), method: :post do |form|%> +<%= render 'form', form:form, comment: @comment, entry:@entry %> +<%end%> -<%= link_to 'Back', wiki_comments_path %> +<%= link_to 'Back', wiki_entry_path(@entry) %> diff --git a/app/views/wiki_entries/_form.html.erb b/app/views/wiki_entries/_form.html.erb index 4155ce30..8080291f 100644 --- a/app/views/wiki_entries/_form.html.erb +++ b/app/views/wiki_entries/_form.html.erb @@ -12,16 +12,16 @@ <% end %>
- <%= form.label :title %> + <%= form.label :title, "Título"%> <%= form.text_field :title %>
- <%= form.label :content %> + <%= form.label :content, "Conteúdo"%> <%= form.text_area :content %>
- <%= form.submit %> + <%= form.submit "Confirmar"%>
<% end %> diff --git a/app/views/wiki_entries/index.html.erb b/app/views/wiki_entries/index.html.erb index 9bb1eeae..c5b4ff20 100644 --- a/app/views/wiki_entries/index.html.erb +++ b/app/views/wiki_entries/index.html.erb @@ -1,13 +1,13 @@

<%= notice %>

-
Wikis
+
Wiki de Atendimento
- - + + @@ -17,9 +17,9 @@ - - - + + + <% end %> @@ -28,4 +28,4 @@
-<%= link_to 'New Wiki', new_wiki_entry_path %> +<%= link_to 'Adicionar processo', new_wiki_entry_path %> diff --git a/app/views/wiki_entries/show.html.erb b/app/views/wiki_entries/show.html.erb index 023f7fcb..2811822e 100644 --- a/app/views/wiki_entries/show.html.erb +++ b/app/views/wiki_entries/show.html.erb @@ -1,14 +1,22 @@

<%= notice %>

-

- Title: - <%= @entry.title %> -

- -

- Content: - <%= @entry.content %> -

- -<%= link_to 'Edit', edit_wiki_entry_path(@entry) %> | -<%= link_to 'Back', wiki_entries_path %> +
+ Título: + <%= @entry.title %> +
+ +
+ Conteúdo: + <%= @entry.content %> +
+ +<%= link_to 'Editar', edit_wiki_entry_path(@entry) %> | +<%= link_to 'Voltar', wiki_entries_path %>| +<%= link_to 'Adicionar comentário', new_wiki_entry_comment_path(@entry) %> + +<%@entry.comments.each do |comment| %> +
+

<%=comment.content%>

+
+ +<%end%> \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index ace99628..f1af1977 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,8 +1,10 @@ # frozen_string_literal: true Rails.application.routes.draw do - resources :wiki_comments - resources :wiki_entries + resources :wiki_entries do + resources :comments, controller:"wiki_comments", shallow:true + resources :wiki_comments, shallow:true + end get 'home/index' devise_for :users # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html diff --git a/features/anexar_processo.feature b/features/anexar_documento.feature similarity index 100% rename from features/anexar_processo.feature rename to features/anexar_documento.feature diff --git a/features/anexar_novo_processo.feature b/features/anexar_documento_novo.feature similarity index 100% rename from features/anexar_novo_processo.feature rename to features/anexar_documento_novo.feature diff --git a/features/consultar_entrada_wiki.feature b/features/consultar_entrada_wiki.feature new file mode 100644 index 00000000..fe4e50a4 --- /dev/null +++ b/features/consultar_entrada_wiki.feature @@ -0,0 +1,15 @@ +#language: pt +Funcionalidade: Consultar processo de atendimento na Wiki + Como um secretário, + Quero consultar uma entrada na Wiki sobre um processo de atendimento, + Para que eu possa me informar sobre como um processo é realizado + + Contexto: + Dado que eu esteja conectado como usuario "usuario_secretario@secretario.com", "123456", "secretario" + E que esteja na página "Wiki de Atendimento" + E eu clicar no botão "Exibir" + + Cenário: Consultar um processo de atendimento existente + Então sou redirecionado para a página "Processo" + E devo poder visualizar o "Título" + E devo poder visualizar o "Conteúdo" diff --git a/features/consultar_processo.feature b/features/consultar_processo.feature deleted file mode 100644 index 8ab80278..00000000 --- a/features/consultar_processo.feature +++ /dev/null @@ -1,21 +0,0 @@ -#language: pt -Funcionalidade: Consultar processo de atendimento na Wiki - Como um secretário, - Quero consultar uma entrada na Wiki sobre um processo de atendimento, - Para que eu possa me informar sobre como um processo é realizado - - Contexto: - Dado que eu esteja conectado como usuario "usuario_secretario@secretario.com", "123456", "secretario" - E que esteja na página "processos de atendimento" - E seleciono um processo - E eu clicar no botão "Ver detalhes" - - Cenário: Consultar um processo de atendimento existente - Então sou redirecionado para a página "informações do processo" - E devo poder visualizar o "número SEI" - E devo poder visualizar a "responsável" - E devo poder visualizar o "status" - E devo poder visualizar os "documentos" - - Cenário: Consultar um processo de atendimento inexistente - Então recebo uma mensagem de erro diff --git a/features/criar_processo.feature b/features/criar_entrada_wiki.feature similarity index 64% rename from features/criar_processo.feature rename to features/criar_entrada_wiki.feature index 19840f9f..bd2f3bf0 100644 --- a/features/criar_processo.feature +++ b/features/criar_entrada_wiki.feature @@ -8,18 +8,17 @@ Funcionalidade: Cadastrar um novo processo na Wiki de atendimento Contexto: Dado que eu esteja conectado como usuario "secretary@secretary.com", "admin123", "secretary" - E que esteja na página "processos de atendimento" + E que esteja na página "Wiki de Atendimento" E clico no botão "Adicionar processo" Cenário: Preenche campos com informações válidas(caminho feliz) - Quando eu preencho o campo "número SEI" com "0423-123456/2017" - E preencho o campo "reponsável" com "Genaína Rodrigues" - E seleciono o "status" "em andamento" + Quando eu preencho o campo "Título" com "Trancar Semestre" + E preencho o campo "Conteúdo" com "Como fazer para trancar o semestre" E clico no botão "Confirmar" - Então sou redirecionado para a página "processos de atendimento" + Então sou redirecionado para a página "Processo" E recebo uma mensagem de sucesso Cenário: Preenche campos com informações inválidas - Quando eu preencho o campo "número SEI" com "alilicece" + Quando eu preencho o campo "Título" com "Trancar Semestre" E clico no botão "Confirmar" Então recebo uma mensagem de erro \ No newline at end of file diff --git a/features/editar_processo_wiki.feature b/features/editar_entrada_wiki.feature similarity index 57% rename from features/editar_processo_wiki.feature rename to features/editar_entrada_wiki.feature index c5b75b92..cf2e5f69 100644 --- a/features/editar_processo_wiki.feature +++ b/features/editar_entrada_wiki.feature @@ -9,19 +9,18 @@ Funcionalidade: Editar processo de atendimento Contexto: Dado que eu esteja conectado como usuario "alicinha@gatinha.com", "123456", "secretario" - E que esteja na página "processos de atendimento" - E eu seleciono um processo - E eu clico no botão "Editar processo" + E que esteja na página "Wiki de Atendimento" + E eu clico no botão "Editar" Cenário: Preenche campos com informações válidas - Quando eu preencho o campo "número SEI" com "0423-123456/2017" - E preencho o campo "reponsável" com "Genaína Rodrigues" - E seleciono o "status" "em andamento" + Quando eu preencho o campo "Título" com "Registrar Estágio" + E preencho o campo "Conteúdo" com "Como registrar o estágio do aluno" E clico no botão "Confirmar" - Então sou redirecionado para a página "processos de atendimento" + Então sou redirecionado para a página "Wiki de Atendimento" E recebo uma mensagem de sucesso Cenário: Preenche campos com informações inválidas - Quando eu preencho o campo "número SEI" com "alilicece" + Quando eu preencho o campo "Título" com "Registrar Estágio" + E não preencho o campo "Conteúdo" E clico no botão "Confirmar" Então recebo uma mensagem de erro \ No newline at end of file diff --git a/features/step_definitions/processos_steps.rb b/features/step_definitions/processos_steps.rb deleted file mode 100644 index 29a5d769..00000000 --- a/features/step_definitions/processos_steps.rb +++ /dev/null @@ -1,6 +0,0 @@ -Dado(/seleciono um processo/) do - pending # Write code here that turns the phrase above into concrete actions -end - - - \ No newline at end of file diff --git a/features/step_definitions/require 'rails_helper'.rb b/features/step_definitions/require 'rails_helper'.rb deleted file mode 100644 index 8d43b4e9..00000000 --- a/features/step_definitions/require 'rails_helper'.rb +++ /dev/null @@ -1,76 +0,0 @@ -require 'rails_helper' - -RSpec.describe Wiki, type: :model do - describe "#create" do - it 'should create a new process when the attributes are valid' - it 'should not create a new process when the sei_process_code is not a valid code' - it 'should not create a new process when there is no assigned user' - it 'should not create a new process when the process_status_id is invalid' - it 'should not create a new process when trying to attach an invalid file ' - end - - describe "#update" do - it 'should update the process when the attributes are valid' - it 'should not update the process when the sei_process_code is not a valid code' - it 'should not update the process when there is no assigned user' - it 'should not update the process when the process_status_id is invalid' - it 'should not update the process when trying to attach an invalid file' - end -end - - - -#controller -require 'rails_helper' -require 'capybara/rails' - -RSpec.describe WikisController, type: :controller do - describe "#create" do - it 'calls the create method from the Wiki model' - describe "valid params" do - it 'saves the process in DB' - it "responds with an success HTTP status" - it 'redirects to process index page' - end - describe "invalid params" do - it "doesn't save the process in DB" - it "responds with an error HTTP status" - end - end - - describe "#update" do - it 'calls the update method from an instance of the Wiki model' - describe "valid params" do - it 'updates the process data in the DB' - it "responds with an success HTTP status" - it 'redirects to process index page' - end - describe "invalid params" do - it "doesn't update the process data in the DB" - it "responds with an error HTTP status" - end - end - - describe "#show" do - describe "valid process" do - it "responds with an success HTTP status" - it 'redirects to process show page' - end - describe "invalid process" do - it "responds with an error HTTP status" - end - end - - describe "add comment" do - it "calls the create method from the Comentarios model" - describe "valid params" do - it 'saves the comment in DB' - it "responds with an success HTTP status" - it 'redirects to comment index page' - end - describe "invalid params" do - it "doesn't save the comment in DB" - it "responds with an error HTTP status" - end - end -end diff --git a/features/step_definitions/shared_steps.rb b/features/step_definitions/shared_steps.rb index a7e5b699..85fabef6 100644 --- a/features/step_definitions/shared_steps.rb +++ b/features/step_definitions/shared_steps.rb @@ -1,21 +1,42 @@ Quando(/(?:clico|clicar) no botão "([^"]*)"/) do |botao| - click_button botao + click_on botao end Então(/recebo uma mensagem de (sucesso|erro)/) do |status| - pending # Write code here that turns the phrase above into concrete actions -end + if(status == "sucesso") + find(".notice", text:"Página foi criada com sucesso!") -Quando(/não preencho o campo "([^"]*)"/) do |campo| - pending # Write code here that turns the phrase above into concrete actions + elsif(status == "erro") + find("#error_explanation") + else + raise StandardError.new("Mensagem não encontrada") + end end Quando(/preencho o campo "([^"]*)" com "([^"]*)"/) do |campo, valor| fill_in campo, with: valor end -Dado(/(?:esteja na|redirecionado para a) página "([^"]*)"/) do |pagina| - pending +Quando(/não preencho o campo "([^"]*)"/) do |campo| + fill_in campo, with: "" +end + +Dado(/redirecionado para a página "([^"]*)"/) do |pagina| + case(pagina) + when "Wiki de Atendimento" + page.current_path == wiki_entries_path + when "Processo" + page.current_path == wiki_entry_path(id: WikiEntry.last.id) + end +end + +Dado(/esteja na página "([^"]*)"/) do |pagina| + case(pagina) + when "Wiki de Atendimento" + visit wiki_entries_path + when "Processo" + visit wiki_entry_path(id: WikiEntry.last.id) + end end Dado(/esteja conectado como usuario "([^"]*)", "([^"]*)", "([^"]*)"/) do |usuario, senha, funcao| @@ -30,7 +51,7 @@ end Quando(/visualizar (?:o|a|os|as) "([^"]*)"/) do |elemento| - pending + find(".attribute:has(strong)", text: elemento).find(".value").text != "" end Quando(/seleciono (?:o|a|os|as) "([^"]*)" "([^"]*)"/) do |campo, valor| diff --git a/features/support/env.rb b/features/support/env.rb index 003fb131..84c3a064 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -58,3 +58,8 @@ # See https://github.com/cucumber/cucumber-rails/blob/master/features/choose_javascript_database_strategy.feature Cucumber::Rails::Database.javascript_strategy = :truncation + +Before do + WikiEntry.create(title:"Titulo qualquer", content:"um conteúdo") + +end From 111d5ed4f6062dff59611c24129cfc1043735ea1 Mon Sep 17 00:00:00 2001 From: aliceborges_42 Date: Fri, 13 Nov 2020 20:30:41 -0300 Subject: [PATCH 33/45] adiciona rspec model comment --- spec/models/wiki_comment_spec.rb | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/spec/models/wiki_comment_spec.rb b/spec/models/wiki_comment_spec.rb index a0a09063..6c636d1a 100644 --- a/spec/models/wiki_comment_spec.rb +++ b/spec/models/wiki_comment_spec.rb @@ -1,5 +1,24 @@ require 'rails_helper' RSpec.describe WikiComment, type: :model do - pending "add some examples to (or delete) #{__FILE__}" + let(:valid_attributes) { + {id: 1, content:'content'} + } + + subject(:entry) { + WikiComment.create(valid_attributes) + } + + describe "Validations" do + + it "is valid with the valid attributes" do + expect(WikiComment.new(valid_attributes)).to be_valid + end + + it "is not valid without a content" do + expect(WikiComment.new({id: 1, content: ''})).to_not be_valid + end + + end + end From e3398d566e9bd05003169ea2d614170c7f21b5e8 Mon Sep 17 00:00:00 2001 From: aliceborges_42 Date: Sun, 15 Nov 2020 18:58:39 -0300 Subject: [PATCH 34/45] =?UTF-8?q?adiciona=20atributos=20v=C3=A1lidos=20e?= =?UTF-8?q?=20inv=C3=A1lidos=20rspec=20controllers?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- spec/controllers/wiki_comments_controller_spec.rb | 8 ++++---- spec/controllers/wiki_entries_controller_spec.rb | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/spec/controllers/wiki_comments_controller_spec.rb b/spec/controllers/wiki_comments_controller_spec.rb index c1cd5b2c..d9cd7a2e 100644 --- a/spec/controllers/wiki_comments_controller_spec.rb +++ b/spec/controllers/wiki_comments_controller_spec.rb @@ -4,11 +4,11 @@ let(:valid_attributes) { - skip("Add a hash of attributes valid for your model") + {content: "Engenharia de Software"} } let(:invalid_attributes) { - skip("Add a hash of attributes invalid for your model") + {content: ""} } let(:valid_session) { {} } @@ -68,14 +68,14 @@ describe "PUT #update" do context "with valid params" do let(:new_attributes) { - skip("Add a hash of attributes valid for your model") + {content: "Sprint 2"} } it "updates the requested comentario" do put :update, params: {id: comment.id, wiki_comment: new_attributes}, session: valid_session comment.reload - skip("Add assertions for updated state") + expect(comment).to eq(new_attributes) end it "redirects to the comentario" do diff --git a/spec/controllers/wiki_entries_controller_spec.rb b/spec/controllers/wiki_entries_controller_spec.rb index e22f2db2..bb23f42c 100644 --- a/spec/controllers/wiki_entries_controller_spec.rb +++ b/spec/controllers/wiki_entries_controller_spec.rb @@ -3,11 +3,11 @@ RSpec.describe WikiEntriesController, type: :controller do let(:valid_attributes) { - skip("Add a hash of attributes valid for your model") + {title: "Processo de trancamento", content: "o processo de trancamento é assim"} } let(:invalid_attributes) { - skip("Add a hash of attributes invalid for your model") + {title: "", content: "o processo de trancamento é assim"} } let(:valid_session) { {} } @@ -67,7 +67,7 @@ describe "PUT #update" do context "with valid params" do let(:new_attributes) { - skip("Add a hash of attributes valid for your model") + {title: "Processo de matrícula", content: "Aluno se matricula"} } it "updates the requested wiki" do From 3728555ac67f26f5f192bbf5392c9afb44bad528 Mon Sep 17 00:00:00 2001 From: aliceborges_42 Date: Sun, 15 Nov 2020 21:46:06 -0300 Subject: [PATCH 35/45] Faz TDD de controllers --- Gemfile | 1 + Gemfile.lock | 6 ++ app/controllers/wiki_comments_controller.rb | 2 +- app/models/wiki_comment.rb | 1 + app/models/wiki_entry.rb | 2 +- app/views/wiki_entries/show.html.erb | 1 + .../wiki_comments_controller_spec.rb | 70 ++++++++++--------- .../wiki_entries_controller_spec.rb | 51 ++++++++------ spec/factories.rb | 18 +++++ spec/helpers/comentarios_helper_spec.rb | 15 ---- spec/helpers/home_helper_spec.rb | 15 ---- spec/helpers/wikis_helper_spec.rb | 15 ---- spec/models/wiki_comment_spec.rb | 8 +-- spec/rails_helper.rb | 23 +++++- spec/support/factory_bot.rb | 3 + 15 files changed, 123 insertions(+), 108 deletions(-) create mode 100644 spec/factories.rb delete mode 100644 spec/helpers/comentarios_helper_spec.rb delete mode 100644 spec/helpers/home_helper_spec.rb delete mode 100644 spec/helpers/wikis_helper_spec.rb create mode 100644 spec/support/factory_bot.rb diff --git a/Gemfile b/Gemfile index e33df326..8676d700 100644 --- a/Gemfile +++ b/Gemfile @@ -42,6 +42,7 @@ group :development, :test do # Call 'byebug' anywhere in the code to stop execution and get a debugger console gem 'byebug', platforms: [:mri, :mingw, :x64_mingw] gem 'rspec-rails' + gem 'factory_bot_rails' end diff --git a/Gemfile.lock b/Gemfile.lock index b6223e46..49b3f561 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -104,6 +104,11 @@ GEM diff-lcs (1.3) erubi (1.9.0) execjs (2.7.0) + factory_bot (6.1.0) + activesupport (>= 5.0.0) + factory_bot_rails (6.1.0) + factory_bot (~> 6.1.0) + railties (>= 5.0.0) ffi (1.11.1) gherkin (5.1.0) globalid (0.4.2) @@ -263,6 +268,7 @@ DEPENDENCIES cucumber-rails-training-wheels database_cleaner devise + factory_bot_rails jbuilder (~> 2.5) launchy listen (>= 3.0.5, < 3.2) diff --git a/app/controllers/wiki_comments_controller.rb b/app/controllers/wiki_comments_controller.rb index 823ff77d..35a24e25 100644 --- a/app/controllers/wiki_comments_controller.rb +++ b/app/controllers/wiki_comments_controller.rb @@ -45,7 +45,7 @@ def update respond_to do |format| if @comment.update(comment_params) format.html { redirect_to @comment.entry, notice: 'Comment was successfully updated.' } - format.json { render :show, status: :ok, location: @comment } + format.json { render :show, status: :ok, location: @comment.entry } else format.html { render :edit } format.json { render json: @comment.errors, status: :unprocessable_entity } diff --git a/app/models/wiki_comment.rb b/app/models/wiki_comment.rb index e439f5de..ad360238 100644 --- a/app/models/wiki_comment.rb +++ b/app/models/wiki_comment.rb @@ -1,3 +1,4 @@ class WikiComment < ApplicationRecord belongs_to :entry, class_name: "WikiEntry", foreign_key: "wiki_entry_id" + validates :content, presence: true end diff --git a/app/models/wiki_entry.rb b/app/models/wiki_entry.rb index 63576825..219af744 100644 --- a/app/models/wiki_entry.rb +++ b/app/models/wiki_entry.rb @@ -1,6 +1,6 @@ class WikiEntry < ApplicationRecord has_one_attached :document has_many :comments, class_name:"WikiComment" - validates :title, presence: true + validates :title, presence: true, uniqueness: true validates :content, presence: true end diff --git a/app/views/wiki_entries/show.html.erb b/app/views/wiki_entries/show.html.erb index 2811822e..50606b53 100644 --- a/app/views/wiki_entries/show.html.erb +++ b/app/views/wiki_entries/show.html.erb @@ -16,6 +16,7 @@ <%@entry.comments.each do |comment| %>
+

Comentário #<%=comment.id%>

<%=comment.content%>

diff --git a/spec/controllers/wiki_comments_controller_spec.rb b/spec/controllers/wiki_comments_controller_spec.rb index d9cd7a2e..cc9e1be8 100644 --- a/spec/controllers/wiki_comments_controller_spec.rb +++ b/spec/controllers/wiki_comments_controller_spec.rb @@ -2,65 +2,70 @@ RSpec.describe WikiCommentsController, type: :controller do - + let!(:entry) { + WikiEntry.create!({title:"Processo de desligamento", content: "Aluno será desligado"}) + } + let(:valid_attributes) { - {content: "Engenharia de Software"} + {content: "Engenharia de Software", entry: entry} } let(:invalid_attributes) { - {content: ""} + {content: "", entry: ""} } - let(:valid_session) { {} } + after(:each) { + WikiComment.delete_all + } - subject(:comment) { WikiComment.create! valid_attributes } + let!(:comment) { WikiComment.create!(valid_attributes) } describe "GET #index" do it "returns a success response" do - get :index, params: {}, session: valid_session + get :index, params:{wiki_entry_id: entry.id} expect(response).to be_successful end end describe "GET #show" do it "returns a success response" do - get :show, params: {id: comment.id}, session: valid_session + get :show, params: {id: comment.id} expect(response).to be_successful end end describe "GET #new" do it "returns a success response" do - get :new, params: {}, session: valid_session + get :new, params:{wiki_entry_id: entry.id} expect(response).to be_successful end end describe "GET #edit" do it "returns a success response" do - get :edit, params: {id: comment.id}, session: valid_session + get :edit, params: {id: comment.id} expect(response).to be_successful end end describe "POST #create" do context "with valid params" do - it "creates a new Comentario" do + it "creates a new Comment" do expect { - post :create, params: {wiki_comment: valid_attributes}, session: valid_session + post :create, params: {wiki_comment: valid_attributes, wiki_entry_id: entry.id} }.to change(WikiComment, :count).by(1) end - it "redirects to the created comentario" do - post :create, params: {wiki_comment: valid_attributes}, session: valid_session - expect(response).to redirect_to(WikiComment.last) + it "redirects to the comment's entry" do + post :create, params: {wiki_comment: valid_attributes, wiki_entry_id: entry.id} + expect(response).to redirect_to(entry) end end context "with invalid params" do - it "redirects to new page" do - post :create, params: {wiki_comment: invalid_attributes}, session: valid_session - expect(response).to redirect_to(new_wiki_comment_path(comment.id)) + it "renders the 'new' page with an error" do + post :create, params: {wiki_comment: invalid_attributes, wiki_entry_id: entry.id} + expect(response).to have_http_status(:ok) end end end @@ -68,42 +73,43 @@ describe "PUT #update" do context "with valid params" do let(:new_attributes) { - {content: "Sprint 2"} + {content: "Sprint 2", entry: entry} } - it "updates the requested comentario" do + it "updates the requested comment" do - put :update, params: {id: comment.id, wiki_comment: new_attributes}, session: valid_session + put :update, params: {id: comment.id, wiki_comment: new_attributes} comment.reload - expect(comment).to eq(new_attributes) + expect(comment.content).to eq(new_attributes[:content]) + expect(comment.entry).to eq(new_attributes[:entry]) end - it "redirects to the comentario" do + it "redirects to the comment's entry" do - put :update, params: {id: comment.id, wiki_comment: valid_attributes}, session: valid_session - expect(response).to redirect_to(comment) + put :update, params: {id: comment.id, wiki_comment: new_attributes} + expect(response).to redirect_to(comment.entry) end end context "with invalid params" do - it "redirects to the edit page" do + it "renders the edit page with an error" do - put :update, params: {id: comment.id, wiki_comment: invalid_attributes}, session: valid_session - expect(response).to redirect_to(edit_wiki_comment_path(comment.id)) + put :update, params: {id: comment.id, wiki_comment: invalid_attributes} + expect(response).to have_http_status(:ok) end end end describe "DELETE #destroy" do - it "destroys the requested comentario" do + it "destroys the requested comment" do expect { - delete :destroy, params: {id: comment.id}, session: valid_session + delete :destroy, params: {id: comment.id} }.to change(WikiComment, :count).by(-1) end - it "redirects to the comentarios list" do - delete :destroy, params: {id: comment.id}, session: valid_session - expect(response).to redirect_to(wiki_comments_url) + it "redirects to the entry page" do + delete :destroy, params: {id: comment.id} + expect(response).to redirect_to(entry) end end diff --git a/spec/controllers/wiki_entries_controller_spec.rb b/spec/controllers/wiki_entries_controller_spec.rb index bb23f42c..56b6d159 100644 --- a/spec/controllers/wiki_entries_controller_spec.rb +++ b/spec/controllers/wiki_entries_controller_spec.rb @@ -10,56 +10,58 @@ {title: "", content: "o processo de trancamento é assim"} } - let(:valid_session) { {} } + after(:each) { + WikiEntry.delete_all + } - subject(:entry) { WikiEntry.create! valid_attributes } + let(:entry) { WikiEntry.create! valid_attributes } describe "GET #index" do it "returns a success response" do - get :index, params: {}, session: valid_session + get :index expect(response).to be_successful end end describe "GET #show" do it "returns a success response" do - get :show, params: {id: entry.id}, session: valid_session + get :show, params: {id: entry.id} expect(response).to be_successful end end describe "GET #new" do it "returns a success response" do - get :new, params: {}, session: valid_session + get :new expect(response).to be_successful end end describe "GET #edit" do it "returns a success response" do - get :edit, params: {id: entry.id}, session: valid_session + get :edit, params: {id: entry.id} expect(response).to be_successful end end describe "POST #create" do context "with valid params" do - it "creates a new Wiki" do + it "creates a new Entry" do expect { - post :create, params: {wiki_entry: valid_attributes}, session: valid_session + post :create, params: {wiki_entry: valid_attributes} }.to change(WikiEntry, :count).by(1) end - it "redirects to the created wiki" do - post :create, params: {wiki_entry: valid_attributes}, session: valid_session + it "redirects to the created entry" do + post :create, params: {wiki_entry: valid_attributes} expect(response).to redirect_to(WikiEntry.last) end end context "with invalid params" do it "redirects to new wiki entry page" do - post :create, params: {wiki_entry: invalid_attributes}, session: valid_session - expect(response).to redirect_to(new_wiki_entry_path(entry.id)) + post :create, params: {wiki_entry: invalid_attributes} + expect(response).to have_http_status(:ok) end end end @@ -67,41 +69,44 @@ describe "PUT #update" do context "with valid params" do let(:new_attributes) { - {title: "Processo de matrícula", content: "Aluno se matricula"} + {title: "Processo de mat", content: "Aluno se matr"} } - it "updates the requested wiki" do + it "updates the requested entry" do - put :update, params: {id: entry.id, wiki_entry: new_attributes}, session: valid_session + put :update, params: {id: entry.id, wiki_entry: new_attributes} entry.reload - skip("Add assertions for updated state") + expect(entry.title).to eq(new_attributes[:title]) + expect(entry.content).to eq(new_attributes[:content]) + end - it "redirects to the wiki" do + it "redirects to the entry" do - put :update, params: {id: entry.id, wiki_entry: valid_attributes}, session: valid_session - expect(response).to redirect_to(wiki) + put :update, params: {id: entry.id, wiki_entry: valid_attributes} + expect(response).to redirect_to(entry) end end context "with invalid params" do it "redirects to edit wiki entry page" do - put :update, params: {id: entry.id, wiki_entry: invalid_attributes}, session: valid_session - expect(response).to redirect_to(edit_wiki_entry_path(entry.id)) + put :update, params: {id: entry.id, wiki_entry: invalid_attributes} + expect(response).to have_http_status(:ok) end end end describe "DELETE #destroy" do it "destroys the requested wiki" do + entry expect { - delete :destroy, params: {id: entry.id}, session: valid_session + delete :destroy, params: {id: entry.id} }.to change(WikiEntry, :count).by(-1) end it "redirects to the wikis list" do - delete :destroy, params: {id: entry.id}, session: valid_session + delete :destroy, params: {id: entry.id} expect(response).to redirect_to(wiki_entries_url) end end diff --git a/spec/factories.rb b/spec/factories.rb new file mode 100644 index 00000000..5b95c862 --- /dev/null +++ b/spec/factories.rb @@ -0,0 +1,18 @@ +FactoryBot.define do + factory :comment, class: WikiComment do + content {"Processo deferido"} + entry + to_create do |instance| + instance.attributes = WikiComment.find_or_create_by(content: instance.content, entry: instance.entry).attributes + instance.reload + end + end + factory :entry, class: WikiEntry do + title {"Processo de matricula"} + content {"Aluno se matricula"} + to_create do |instance| + instance.attributes = WikiEntry.find_or_create_by(title: instance.title, content: instance.content).attributes + instance.reload + end + end +end \ No newline at end of file diff --git a/spec/helpers/comentarios_helper_spec.rb b/spec/helpers/comentarios_helper_spec.rb deleted file mode 100644 index 3f6b4a2f..00000000 --- a/spec/helpers/comentarios_helper_spec.rb +++ /dev/null @@ -1,15 +0,0 @@ -require 'rails_helper' - -# Specs in this file have access to a helper object that includes -# the ComentariosHelper. For example: -# -# describe ComentariosHelper 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 ComentariosHelper, type: :helper do - pending "add some examples to (or delete) #{__FILE__}" -end diff --git a/spec/helpers/home_helper_spec.rb b/spec/helpers/home_helper_spec.rb deleted file mode 100644 index e537d8d9..00000000 --- a/spec/helpers/home_helper_spec.rb +++ /dev/null @@ -1,15 +0,0 @@ -require 'rails_helper' - -# Specs in this file have access to a helper object that includes -# the HomeHelper. For example: -# -# describe HomeHelper 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 HomeHelper, type: :helper do - pending "add some examples to (or delete) #{__FILE__}" -end diff --git a/spec/helpers/wikis_helper_spec.rb b/spec/helpers/wikis_helper_spec.rb deleted file mode 100644 index 2bb13034..00000000 --- a/spec/helpers/wikis_helper_spec.rb +++ /dev/null @@ -1,15 +0,0 @@ -require 'rails_helper' - -# Specs in this file have access to a helper object that includes -# the WikisHelper. For example: -# -# describe WikisHelper 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 WikisHelper, type: :helper do - pending "add some examples to (or delete) #{__FILE__}" -end diff --git a/spec/models/wiki_comment_spec.rb b/spec/models/wiki_comment_spec.rb index 6c636d1a..b86c699d 100644 --- a/spec/models/wiki_comment_spec.rb +++ b/spec/models/wiki_comment_spec.rb @@ -2,13 +2,13 @@ RSpec.describe WikiComment, type: :model do let(:valid_attributes) { - {id: 1, content:'content'} + {id: 1, content:'content', entry: entry} } - subject(:entry) { - WikiComment.create(valid_attributes) + let(:entry) { + WikiEntry.create({ title: "Processo de religamento", content: "aluno deve ser religado" }) } - + describe "Validations" do it "is valid with the valid attributes" do diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index b06351ba..ede03668 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -22,7 +22,7 @@ # directory. Alternatively, in the individual `*_spec.rb` files, manually # require only the support files necessary. # -# Dir[Rails.root.join('spec', 'support', '**', '*.rb')].each { |f| require f } +Dir[Rails.root.join('spec', 'support', '**', '*.rb')].each { |f| require f } # Checks for pending migrations and applies them before tests are run. # If you are not using ActiveRecord, you can remove these lines. @@ -34,7 +34,7 @@ end RSpec.configure do |config| # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures - config.fixture_path = "#{::Rails.root}/spec/fixtures" + #config.fixture_path = "#{::Rails.root}/spec/fixtures" # If you're not using ActiveRecord, or you'd prefer not to run each of your # examples within a transaction, remove the following line or assign false @@ -60,4 +60,23 @@ config.filter_rails_from_backtrace! # arbitrary gems may also be filtered via: # config.filter_gems_from_backtrace("gem name") + # config.before(:suite) do + # DatabaseCleaner.clean_with(:truncation) + # end + + # config.before(:each) do + # DatabaseCleaner.strategy = :transaction + # end + + # config.before(:each, :js => true) do + # DatabaseCleaner.strategy = :truncation + # end + + # config.before(:each) do + # DatabaseCleaner.start + # end + + # config.after(:each) do + # DatabaseCleaner.clean + # end end diff --git a/spec/support/factory_bot.rb b/spec/support/factory_bot.rb new file mode 100644 index 00000000..329748fc --- /dev/null +++ b/spec/support/factory_bot.rb @@ -0,0 +1,3 @@ +RSpec.configure do |config| + config.include FactoryBot::Syntax::Methods +end \ No newline at end of file From 63c30a565daaf5437c54e21cbcfd8a7ccbe93ca2 Mon Sep 17 00:00:00 2001 From: aliceborges_42 Date: Sun, 15 Nov 2020 23:04:47 -0300 Subject: [PATCH 36/45] Testes cucumber e rspec passando --- Gemfile | 1 + Gemfile.lock | 3 +++ app/controllers/wiki_comments_controller.rb | 6 +++--- app/controllers/wiki_entries_controller.rb | 2 +- app/models/wiki_entry.rb | 13 +++++++++++++ app/views/wiki_comments/_form.html.erb | 6 +++--- app/views/wiki_entries/_form.html.erb | 5 +++++ features/adicionar_comentario_wiki.feature | 9 ++++----- features/anexar_documento.feature | 16 +++++++--------- features/anexar_documento_novo.feature | 18 +++++++++--------- features/step_definitions/processos_steps.rb | 4 ++++ features/step_definitions/shared_steps.rb | 12 ++++++------ .../support/assets/Pabllo_Vittar_seu_crime.mp4 | 0 features/support/assets/document.xml | 0 spec/models/wiki_entry_spec.rb | 3 ++- .../support/assets/Pabllo_Vittar_seu_crime.mp4 | 0 16 files changed, 61 insertions(+), 37 deletions(-) create mode 100644 features/step_definitions/processos_steps.rb create mode 100644 features/support/assets/Pabllo_Vittar_seu_crime.mp4 create mode 100644 features/support/assets/document.xml create mode 100644 spec/support/assets/Pabllo_Vittar_seu_crime.mp4 diff --git a/Gemfile b/Gemfile index 8676d700..bcc208c7 100644 --- a/Gemfile +++ b/Gemfile @@ -71,3 +71,4 @@ end # Windows does not include zoneinfo files, so bundle the tzinfo-data gem gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby] +gem 'activestorage-validator' \ No newline at end of file diff --git a/Gemfile.lock b/Gemfile.lock index 49b3f561..99d27857 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -37,6 +37,8 @@ GEM actionpack (= 5.2.3) activerecord (= 5.2.3) marcel (~> 0.3.1) + activestorage-validator (0.1.3) + rails (>= 5.2.0) activesupport (5.2.3) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) @@ -260,6 +262,7 @@ PLATFORMS ruby DEPENDENCIES + activestorage-validator bootsnap (>= 1.1.0) byebug capybara (>= 2.15) diff --git a/app/controllers/wiki_comments_controller.rb b/app/controllers/wiki_comments_controller.rb index 35a24e25..2ccc0fcc 100644 --- a/app/controllers/wiki_comments_controller.rb +++ b/app/controllers/wiki_comments_controller.rb @@ -30,7 +30,7 @@ def create respond_to do |format| if @comment.save - format.html { redirect_to @comment.entry, notice: 'Comment was successfully created.' } + format.html { redirect_to @comment.entry, notice: 'Comentário foi criado com sucesso.' } format.json { render :show, status: :created, location: @comment } else format.html { render :new } @@ -44,7 +44,7 @@ def create def update respond_to do |format| if @comment.update(comment_params) - format.html { redirect_to @comment.entry, notice: 'Comment was successfully updated.' } + format.html { redirect_to @comment.entry, notice: 'Comentário foi editado com sucesso.' } format.json { render :show, status: :ok, location: @comment.entry } else format.html { render :edit } @@ -58,7 +58,7 @@ def update def destroy @comment.destroy respond_to do |format| - format.html { redirect_to @comment.entry, notice: 'Comment was successfully destroyed.' } + format.html { redirect_to @comment.entry, notice: 'Comentário foi excluído com sucesso.' } format.json { head :no_content } end end diff --git a/app/controllers/wiki_entries_controller.rb b/app/controllers/wiki_entries_controller.rb index 3453a02c..430c91ab 100644 --- a/app/controllers/wiki_entries_controller.rb +++ b/app/controllers/wiki_entries_controller.rb @@ -70,6 +70,6 @@ def set_entry # Never trust parameters from the scary internet, only allow the white list through. def entry_params - params.require(:wiki_entry).permit(:title, :content) + params.require(:wiki_entry).permit(:title, :content, :document) end end diff --git a/app/models/wiki_entry.rb b/app/models/wiki_entry.rb index 219af744..dec0d41a 100644 --- a/app/models/wiki_entry.rb +++ b/app/models/wiki_entry.rb @@ -3,4 +3,17 @@ class WikiEntry < ApplicationRecord has_many :comments, class_name:"WikiComment" validates :title, presence: true, uniqueness: true validates :content, presence: true + #validates :document, blob: {content_type: ["application/pdf", "text/html", "application/xml", "image/apng", "image/png", "image/jpeg", "text/plain", "text/xml", "text/csv" ]} + + validate :correct_document_mime_type + + VALID_DOCUMENT_TYPES = ["application/pdf", "text/html", "application/xml", "image/apng", "image/png", "image/jpeg", "text/plain", "text/xml", "text/csv" ] + + private + + def correct_document_mime_type + if document.attached? && !document.content_type.in?(VALID_DOCUMENT_TYPES) + errors.add(:document, "#{document.content_type} não é válido") + end + end end diff --git a/app/views/wiki_comments/_form.html.erb b/app/views/wiki_comments/_form.html.erb index 9b5166cf..7c1bf227 100644 --- a/app/views/wiki_comments/_form.html.erb +++ b/app/views/wiki_comments/_form.html.erb @@ -1,6 +1,6 @@ <% if comment.errors.any? %>
-

<%= pluralize(comment.errors.count, "error") %> prohibited this comment from being saved:

+

<%= pluralize(comment.errors.count, "error") %> proibiram esse cometário de ser salvo:

    <% comment.errors.full_messages.each do |message| %> @@ -13,10 +13,10 @@ <%= form.hidden_field :wiki_entry_id, value:entry.id %>
    - <%= form.label :content %> + <%= form.label :content, "Conteúdo" %> <%= form.text_area :content %>
    - <%= form.submit %> + <%= form.submit "Confirmar" %>
    diff --git a/app/views/wiki_entries/_form.html.erb b/app/views/wiki_entries/_form.html.erb index 8080291f..18a77f2b 100644 --- a/app/views/wiki_entries/_form.html.erb +++ b/app/views/wiki_entries/_form.html.erb @@ -21,6 +21,11 @@ <%= form.text_area :content %>
+
+ <%= form.label :document, "Documento"%> + <%= form.file_field :document %> +
+
<%= form.submit "Confirmar"%>
diff --git a/features/adicionar_comentario_wiki.feature b/features/adicionar_comentario_wiki.feature index b35b7aab..64fde137 100644 --- a/features/adicionar_comentario_wiki.feature +++ b/features/adicionar_comentario_wiki.feature @@ -10,17 +10,16 @@ Funcionalidade: Adicionar comentário a um processo de atendimento Contexto: Dado que eu esteja conectado como usuario "alicinha@gatinha.com", "123456", "secretario" - E que esteja na página "processos de atendimento" - E eu seleciono um processo + E que esteja na página "Processo" E eu clico no botão "Adicionar comentário" Cenário: Preenche campo de comentário - Quando eu preencho o campo "comentário" com "Processo acompanhado também pela professora Maristela Holanda" + Quando eu preencho o campo "Conteúdo" com "Processo acompanhado também pela professora Maristela Holanda" E clico no botão "Confirmar" - Então sou redirecionado para a página "processos de atendimento" + Então sou redirecionado para a página "Wiki de Atendimento" E recebo uma mensagem de sucesso Cenário: Deixa o campo de comentário vazio - Quando eu não preencho o campo "comentário" + Quando eu não preencho o campo "Conteúdo" E clico no botão "Confirmar" Então recebo uma mensagem de erro \ No newline at end of file diff --git a/features/anexar_documento.feature b/features/anexar_documento.feature index 2b55a654..d3c06d79 100644 --- a/features/anexar_documento.feature +++ b/features/anexar_documento.feature @@ -7,18 +7,16 @@ Funcionalidade: Anexar arquivo a um processo existente Contexto: Dado que eu esteja conectado como usuario "alicinha@gatinha.com", "123456", "secretario" - E que esteja na página "processos de atendimentoo" - E seleciono um processo - E clico no botão "Editar processo" + E que esteja na página "Wiki de Atendimento" + E clico no botão "Editar" Cenário: Anexar um arquivo válido - Quando eu clico no botão "Adicionar documento" - E envio o arquivo "documento.pdf" + Quando envio o arquivo "document.xml" E clico no botão "Confirmar" - Então sou redirecionado para a página "processos de atendimentoo" + Então sou redirecionado para a página "Processo" E recebo uma mensagem de sucesso - Cenário: Anexar arquivo nválido - Quando eu clico no botão "Adicionar documento" - E envio o arquivo "Pabllo_Vittar_seu_crime.mp4" + Cenário: Anexar arquivo inválido + Quando envio o arquivo "Pabllo_Vittar_seu_crime.mp4" + E clico no botão "Confirmar" Então recebo uma mensagem de erro \ No newline at end of file diff --git a/features/anexar_documento_novo.feature b/features/anexar_documento_novo.feature index a52826ce..6a97a082 100644 --- a/features/anexar_documento_novo.feature +++ b/features/anexar_documento_novo.feature @@ -1,23 +1,23 @@ #language:pt -Funcionalidade: Anexar arquivo a um processo existente +Funcionalidade: Anexar arquivo a um novo processo Como um secretário, para que eu possa detalhar mais os processos da Wiki, eu gostaria de anexar um ou mais documentos em um processo já existente Contexto: Dado que eu esteja conectado como usuario "usuario_secretario@secretario.com", "123456", "secretario" - E que esteja na página "processos de atendimento" + E que esteja na página "Wiki de Atendimento" E clico no botão "Adicionar processo" - Cenário: Anexar um arquivo válido - Quando eu clico no botão "Adicionar documento" - E envio o arquivo "documento.pdf" + Cenário: Anexar um arquivo válido + Quando preencho os campos do processo com informações válidas + E envio o arquivo "document.xml" E clico no botão "Confirmar" - Então sou redirecionado para a página "processos de atendimento" + Então sou redirecionado para a página "Processo" E recebo uma mensagem de sucesso - Cenário: Anexar arquivo nválido - Quando eu clico no botão "Adicionar documento" - E envio o arquivo "Pabllo_Vittar_seu_crime.mp4" + Cenário: Anexar arquivo inválido + Quando envio o arquivo "Pabllo_Vittar_seu_crime.mp4" + E clico no botão "Confirmar" Então recebo uma mensagem de erro \ No newline at end of file diff --git a/features/step_definitions/processos_steps.rb b/features/step_definitions/processos_steps.rb new file mode 100644 index 00000000..ca08aec1 --- /dev/null +++ b/features/step_definitions/processos_steps.rb @@ -0,0 +1,4 @@ +Quando ("preencho os campos do processo com informações válidas") do + fill_in "Título", with: "Gugu" + fill_in "Conteúdo", with: "Dada" +end \ No newline at end of file diff --git a/features/step_definitions/shared_steps.rb b/features/step_definitions/shared_steps.rb index 85fabef6..230afcb7 100644 --- a/features/step_definitions/shared_steps.rb +++ b/features/step_definitions/shared_steps.rb @@ -4,7 +4,7 @@ Então(/recebo uma mensagem de (sucesso|erro)/) do |status| if(status == "sucesso") - find(".notice", text:"Página foi criada com sucesso!") + find(".notice", text:/sucesso/) elsif(status == "erro") find("#error_explanation") @@ -27,6 +27,8 @@ page.current_path == wiki_entries_path when "Processo" page.current_path == wiki_entry_path(id: WikiEntry.last.id) + else + raise StandardError.new("A página não foi encontrada.") end end @@ -36,6 +38,8 @@ visit wiki_entries_path when "Processo" visit wiki_entry_path(id: WikiEntry.last.id) + else + raise StandardError.new("A página não foi encontrada.") end end @@ -54,11 +58,7 @@ find(".attribute:has(strong)", text: elemento).find(".value").text != "" end -Quando(/seleciono (?:o|a|os|as) "([^"]*)" "([^"]*)"/) do |campo, valor| - pending -end - Quando(/envio o arquivo "([^"]*)"/) do |arquivo| - pending # Write code here that turns the phrase above into concrete actions + page.attach_file "Documento", File.join(Rails.root + "features/support/assets/", arquivo) end \ No newline at end of file diff --git a/features/support/assets/Pabllo_Vittar_seu_crime.mp4 b/features/support/assets/Pabllo_Vittar_seu_crime.mp4 new file mode 100644 index 00000000..e69de29b diff --git a/features/support/assets/document.xml b/features/support/assets/document.xml new file mode 100644 index 00000000..e69de29b diff --git a/spec/models/wiki_entry_spec.rb b/spec/models/wiki_entry_spec.rb index 4ceecd85..ac5ec9de 100644 --- a/spec/models/wiki_entry_spec.rb +++ b/spec/models/wiki_entry_spec.rb @@ -5,6 +5,7 @@ {id: 1, title: 'title', content:'content'} } + let(:document) { Rack::Test::UploadedFile.new(Rails.root.join("spec/support/assets/document.xml")) } @@ -30,7 +31,7 @@ it "is not valid without a content" do expect(WikiEntry.new({id: 1, title: 'title', content: ''})).to_not be_valid end - + end end \ No newline at end of file diff --git a/spec/support/assets/Pabllo_Vittar_seu_crime.mp4 b/spec/support/assets/Pabllo_Vittar_seu_crime.mp4 new file mode 100644 index 00000000..e69de29b From 36bf8bc2f0668e58f2dbae7e641ac428d30fd322 Mon Sep 17 00:00:00 2001 From: nayarasilva Date: Mon, 23 Nov 2020 22:05:58 -0300 Subject: [PATCH 37/45] =?UTF-8?q?Adicionando=20a=20gema=20simplecov=20e=20?= =?UTF-8?q?seus=20require=20para=20verifica=C3=A7=C3=A3o=20de=20cobertura?= =?UTF-8?q?=20de=20rspec?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .simplecov | 13 +++++++++++++ Gemfile | 4 ++++ Gemfile.lock | 8 ++++++++ spec/rails_helper.rb | 1 + spec/spec_helper.rb | 2 ++ test/test_helper.rb | 2 ++ 6 files changed, 30 insertions(+) create mode 100644 .simplecov diff --git a/.simplecov b/.simplecov new file mode 100644 index 00000000..83134b61 --- /dev/null +++ b/.simplecov @@ -0,0 +1,13 @@ +SimpleCov.start 'rails' do + # any custom configs like groups and filters can be here at a central place + enable_coverage :branch + add_filter "app/channels/application_cable/connection.rb" + add_filter "app/jobs/application_job.rb" + add_filter "app/mailers/application_mailer.rb" + add_filter "app/channels/application_cable/channel.rb" + add_filter "app/controllers/application_controller.rb" + add_filter "app/controllers/home_controller.rb" + + + +end diff --git a/Gemfile b/Gemfile index bcc208c7..3fba21a6 100644 --- a/Gemfile +++ b/Gemfile @@ -36,6 +36,10 @@ gem 'jbuilder', '~> 2.5' # gem 'capistrano-rails', group: :development # Reduces boot times through caching; required in config/boot.rb +#Documentation +gem 'rdoc', '~> 4.2', '>= 4.2.2' +#Coverage of tests +gem 'simplecov', require: false, group: :test gem 'bootsnap', '>= 1.1.0', require: false group :development, :test do diff --git a/Gemfile.lock b/Gemfile.lock index 99d27857..c719af43 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -104,6 +104,7 @@ GEM responders warden (~> 1.2.3) diff-lcs (1.3) + docile (1.3.2) erubi (1.9.0) execjs (2.7.0) factory_bot (6.1.0) @@ -181,6 +182,7 @@ GEM rb-fsevent (0.10.3) rb-inotify (0.10.0) ffi (~> 1.0) + rdoc (4.3.0) regexp_parser (1.6.0) responders (3.0.0) actionpack (>= 5.0) @@ -220,6 +222,10 @@ GEM rubyzip (>= 1.2.2) shoulda-matchers (4.1.2) activesupport (>= 4.2.0) + simplecov (0.19.1) + docile (~> 1.1) + simplecov-html (~> 0.11) + simplecov-html (0.12.3) spring (2.1.0) spring-watcher-listen (2.0.1) listen (>= 2.7, < 4.0) @@ -278,10 +284,12 @@ DEPENDENCIES pg (>= 0.18, < 2.0) puma (~> 3.12) rails (~> 5.2.3) + rdoc (~> 4.2, >= 4.2.2) rspec-rails sass-rails (~> 5.0) selenium-webdriver shoulda-matchers + simplecov spring spring-watcher-listen (~> 2.0.0) turbolinks (~> 5) diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index ede03668..e34e1e1c 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -1,3 +1,4 @@ +require 'simplecov' # This file is copied to spec/ when you run 'rails generate rspec:install' require 'spec_helper' ENV['RAILS_ENV'] ||= 'test' diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index ce33d66d..0953b42a 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,3 +1,5 @@ +require 'simplecov' + # 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/test/test_helper.rb b/test/test_helper.rb index 3ab84e3d..58e4e2fd 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -1,3 +1,5 @@ +require 'simplecov' +SimpleCov.start ENV['RAILS_ENV'] ||= 'test' require_relative '../config/environment' require 'rails/test_help' From aa1eeae3cd08311a0080ebf2622b2564275ffaa0 Mon Sep 17 00:00:00 2001 From: nayarasilva Date: Mon, 23 Nov 2020 22:07:54 -0300 Subject: [PATCH 38/45] =?UTF-8?q?Relat=C3=B3rios=20de=20complexidade=20cic?= =?UTF-8?q?lom=C3=A1tica=20todos=20com=20complexidade=20<10?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wiki_comments_controller.rb_cyclo.html | 84 + .../wiki_entries_controller.rb_cyclo.html | 84 + app/models/wiki_comment.rb_cyclo.html | 82 + app/models/wiki_entry.rb_cyclo.html | 82 + coverage/.last_run.json | 5 + coverage/.resultset.json | 632 +++ coverage/.resultset.json.lock | 0 .../DataTables-1.10.20/images/sort_asc.png | Bin 0 -> 160 bytes .../images/sort_asc_disabled.png | Bin 0 -> 148 bytes .../DataTables-1.10.20/images/sort_both.png | Bin 0 -> 201 bytes .../DataTables-1.10.20/images/sort_desc.png | Bin 0 -> 158 bytes .../images/sort_desc_disabled.png | Bin 0 -> 146 bytes coverage/assets/0.12.3/application.css | 1 + coverage/assets/0.12.3/application.js | 7 + coverage/assets/0.12.3/colorbox/border.png | Bin 0 -> 163 bytes coverage/assets/0.12.3/colorbox/controls.png | Bin 0 -> 2033 bytes coverage/assets/0.12.3/colorbox/loading.gif | Bin 0 -> 9427 bytes .../0.12.3/colorbox/loading_background.png | Bin 0 -> 166 bytes coverage/assets/0.12.3/favicon_green.png | Bin 0 -> 1009 bytes coverage/assets/0.12.3/favicon_red.png | Bin 0 -> 1009 bytes coverage/assets/0.12.3/favicon_yellow.png | Bin 0 -> 1009 bytes .../images/ui-bg_flat_0_aaaaaa_40x100.png | Bin 0 -> 180 bytes .../images/ui-bg_flat_75_ffffff_40x100.png | Bin 0 -> 178 bytes .../images/ui-bg_glass_55_fbf9ee_1x400.png | Bin 0 -> 120 bytes .../images/ui-bg_glass_65_ffffff_1x400.png | Bin 0 -> 105 bytes .../images/ui-bg_glass_75_dadada_1x400.png | Bin 0 -> 111 bytes .../images/ui-bg_glass_75_e6e6e6_1x400.png | Bin 0 -> 110 bytes .../images/ui-bg_glass_95_fef1ec_1x400.png | Bin 0 -> 119 bytes .../ui-bg_highlight-soft_75_cccccc_1x100.png | Bin 0 -> 101 bytes .../0.12.3/images/ui-icons_222222_256x240.png | Bin 0 -> 4369 bytes .../0.12.3/images/ui-icons_2e83ff_256x240.png | Bin 0 -> 4369 bytes .../0.12.3/images/ui-icons_454545_256x240.png | Bin 0 -> 4369 bytes .../0.12.3/images/ui-icons_888888_256x240.png | Bin 0 -> 4369 bytes .../0.12.3/images/ui-icons_cd0a0a_256x240.png | Bin 0 -> 4369 bytes coverage/assets/0.12.3/loading.gif | Bin 0 -> 7247 bytes coverage/assets/0.12.3/magnify.png | Bin 0 -> 1301 bytes coverage/index.html | 4417 +++++++++++++++++ index_cyclo.html | 83 + 38 files changed, 5477 insertions(+) create mode 100644 app/controllers/wiki_comments_controller.rb_cyclo.html create mode 100644 app/controllers/wiki_entries_controller.rb_cyclo.html create mode 100644 app/models/wiki_comment.rb_cyclo.html create mode 100644 app/models/wiki_entry.rb_cyclo.html create mode 100644 coverage/.last_run.json create mode 100644 coverage/.resultset.json create mode 100644 coverage/.resultset.json.lock create mode 100644 coverage/assets/0.12.3/DataTables-1.10.20/images/sort_asc.png create mode 100644 coverage/assets/0.12.3/DataTables-1.10.20/images/sort_asc_disabled.png create mode 100644 coverage/assets/0.12.3/DataTables-1.10.20/images/sort_both.png create mode 100644 coverage/assets/0.12.3/DataTables-1.10.20/images/sort_desc.png create mode 100644 coverage/assets/0.12.3/DataTables-1.10.20/images/sort_desc_disabled.png create mode 100644 coverage/assets/0.12.3/application.css create mode 100644 coverage/assets/0.12.3/application.js create mode 100644 coverage/assets/0.12.3/colorbox/border.png create mode 100644 coverage/assets/0.12.3/colorbox/controls.png create mode 100644 coverage/assets/0.12.3/colorbox/loading.gif create mode 100644 coverage/assets/0.12.3/colorbox/loading_background.png create mode 100644 coverage/assets/0.12.3/favicon_green.png create mode 100644 coverage/assets/0.12.3/favicon_red.png create mode 100644 coverage/assets/0.12.3/favicon_yellow.png create mode 100644 coverage/assets/0.12.3/images/ui-bg_flat_0_aaaaaa_40x100.png create mode 100644 coverage/assets/0.12.3/images/ui-bg_flat_75_ffffff_40x100.png create mode 100644 coverage/assets/0.12.3/images/ui-bg_glass_55_fbf9ee_1x400.png create mode 100644 coverage/assets/0.12.3/images/ui-bg_glass_65_ffffff_1x400.png create mode 100644 coverage/assets/0.12.3/images/ui-bg_glass_75_dadada_1x400.png create mode 100644 coverage/assets/0.12.3/images/ui-bg_glass_75_e6e6e6_1x400.png create mode 100644 coverage/assets/0.12.3/images/ui-bg_glass_95_fef1ec_1x400.png create mode 100644 coverage/assets/0.12.3/images/ui-bg_highlight-soft_75_cccccc_1x100.png create mode 100644 coverage/assets/0.12.3/images/ui-icons_222222_256x240.png create mode 100644 coverage/assets/0.12.3/images/ui-icons_2e83ff_256x240.png create mode 100644 coverage/assets/0.12.3/images/ui-icons_454545_256x240.png create mode 100644 coverage/assets/0.12.3/images/ui-icons_888888_256x240.png create mode 100644 coverage/assets/0.12.3/images/ui-icons_cd0a0a_256x240.png create mode 100644 coverage/assets/0.12.3/loading.gif create mode 100644 coverage/assets/0.12.3/magnify.png create mode 100644 coverage/index.html create mode 100644 index_cyclo.html diff --git a/app/controllers/wiki_comments_controller.rb_cyclo.html b/app/controllers/wiki_comments_controller.rb_cyclo.html new file mode 100644 index 00000000..9015e79c --- /dev/null +++ b/app/controllers/wiki_comments_controller.rb_cyclo.html @@ -0,0 +1,84 @@ +Cyclometric Complexity + + +
+

Class : WikiCommentsController

+
Total Complexity: 25
+
Total Lines: 80
+
TitleContentTítuloConteúdo
<%= entry.title %> <%= entry.content %><%= link_to 'Show', entry %><%= link_to 'Edit', edit_wiki_entry_path(entry) %><%= link_to 'Destroy', entry, method: :delete, data: { confirm: 'Are you sure?' } %><%= link_to 'Exibir', entry %><%= link_to 'Editar', edit_wiki_entry_path(entry) %><%= link_to 'Excluir', entry, method: :delete, data: { confirm: 'Are you sure?' } %>
+ + + +
MethodComplexity# Lines
create713
update710
+
+ + diff --git a/app/controllers/wiki_entries_controller.rb_cyclo.html b/app/controllers/wiki_entries_controller.rb_cyclo.html new file mode 100644 index 00000000..d0e0f594 --- /dev/null +++ b/app/controllers/wiki_entries_controller.rb_cyclo.html @@ -0,0 +1,84 @@ +Cyclometric Complexity + + +
+

Class : WikiEntriesController

+
Total Complexity: 24
+
Total Lines: 74
+ + + + +
MethodComplexity# Lines
create712
update710
+
+ + diff --git a/app/models/wiki_comment.rb_cyclo.html b/app/models/wiki_comment.rb_cyclo.html new file mode 100644 index 00000000..18ccae99 --- /dev/null +++ b/app/models/wiki_comment.rb_cyclo.html @@ -0,0 +1,82 @@ +Cyclometric Complexity + + +
+

Class : WikiComment

+
Total Complexity: 0
+
Total Lines: 3
+ + +
MethodComplexity# Lines
+
+ + diff --git a/app/models/wiki_entry.rb_cyclo.html b/app/models/wiki_entry.rb_cyclo.html new file mode 100644 index 00000000..165abb72 --- /dev/null +++ b/app/models/wiki_entry.rb_cyclo.html @@ -0,0 +1,82 @@ +Cyclometric Complexity + + +
+

Class : WikiEntry

+
Total Complexity: 2
+
Total Lines: 18
+ + +
MethodComplexity# Lines
+
+ + diff --git a/coverage/.last_run.json b/coverage/.last_run.json new file mode 100644 index 00000000..35f3f3c9 --- /dev/null +++ b/coverage/.last_run.json @@ -0,0 +1,5 @@ +{ + "result": { + "covered_percent": 94.17 + } +} diff --git a/coverage/.resultset.json b/coverage/.resultset.json new file mode 100644 index 00000000..c831758e --- /dev/null +++ b/coverage/.resultset.json @@ -0,0 +1,632 @@ +{ + "Cucumber Features": { + "coverage": { + "/home/nayara/Documentos/secretaria_ppgi/app/models/wiki_comment.rb": { + "lines": [ + 1, + 1, + 1, + null + ], + "branches": { + } + }, + "/home/nayara/Documentos/secretaria_ppgi/app/models/application_record.rb": { + "lines": [ + 1, + 1, + null + ], + "branches": { + } + }, + "/home/nayara/Documentos/secretaria_ppgi/app/models/wiki_entry.rb": { + "lines": [ + 1, + 1, + 1, + 1, + 1, + null, + null, + 1, + null, + 1, + null, + 1, + null, + 1, + 19, + 2, + null, + null, + null + ], + "branches": { + "[:if, 0, 15, 8, 17, 11]": { + "[:then, 1, 16, 8, 16, 73]": 2, + "[:else, 2, 15, 8, 17, 11]": 17 + } + } + }, + "/home/nayara/Documentos/secretaria_ppgi/app/models/user.rb": { + "lines": [ + null, + null, + 1, + 1, + 1, + null, + null, + null, + 1, + null, + null, + 1, + null + ], + "branches": { + } + }, + "/home/nayara/Documentos/secretaria_ppgi/app/controllers/application_controller.rb": { + "lines": [ + null, + null, + 1, + 1, + null, + 1, + null, + 1, + 31, + null, + null + ], + "branches": { + } + }, + "/home/nayara/Documentos/secretaria_ppgi/app/helpers/application_helper.rb": { + "lines": [ + 1, + null + ], + "branches": { + } + }, + "/home/nayara/Documentos/secretaria_ppgi/app/helpers/comentarios_helper.rb": { + "lines": [ + 1, + null + ], + "branches": { + } + }, + "/home/nayara/Documentos/secretaria_ppgi/app/helpers/home_helper.rb": { + "lines": [ + 1, + null + ], + "branches": { + } + }, + "/home/nayara/Documentos/secretaria_ppgi/app/helpers/wikis_helper.rb": { + "lines": [ + 1, + null + ], + "branches": { + } + }, + "/home/nayara/Documentos/secretaria_ppgi/app/controllers/wiki_entries_controller.rb": { + "lines": [ + 1, + 1, + null, + null, + null, + 1, + 9, + null, + null, + null, + null, + 1, + null, + null, + null, + null, + 1, + 4, + null, + null, + null, + 1, + null, + null, + null, + null, + 1, + 4, + null, + 4, + 4, + 4, + 2, + null, + 4, + 2, + null, + null, + null, + null, + null, + null, + 1, + 4, + 4, + 4, + 2, + null, + 4, + 2, + null, + null, + null, + null, + null, + null, + 1, + 0, + 0, + 0, + 0, + null, + null, + null, + 1, + null, + 1, + 16, + null, + null, + null, + 1, + 8, + null, + null + ], + "branches": { + "[:if, 0, 31, 6, 37, 9]": { + "[:then, 1, 32, 8, 33, 71]": 2, + "[:else, 2, 35, 8, 36, 81]": 2 + }, + "[:if, 3, 45, 6, 51, 9]": { + "[:then, 4, 46, 8, 47, 66]": 2, + "[:else, 5, 49, 8, 50, 81]": 2 + } + } + }, + "/home/nayara/Documentos/secretaria_ppgi/app/controllers/wiki_comments_controller.rb": { + "lines": [ + 1, + 1, + 1, + null, + null, + null, + 1, + 0, + null, + null, + null, + null, + 1, + null, + null, + null, + 1, + 2, + null, + null, + null, + 1, + null, + null, + null, + null, + 1, + null, + 2, + null, + 2, + 2, + 2, + 1, + null, + 2, + 1, + null, + null, + null, + null, + null, + null, + 1, + 0, + 0, + 0, + 0, + null, + 0, + 0, + null, + null, + null, + null, + null, + null, + 1, + 0, + 0, + 0, + 0, + null, + null, + null, + 1, + null, + 1, + 0, + null, + null, + null, + 1, + 4, + null, + null, + null, + 1, + 2, + null, + null + ], + "branches": { + "[:if, 0, 32, 6, 38, 9]": { + "[:then, 1, 33, 8, 34, 74]": 1, + "[:else, 2, 36, 8, 37, 83]": 1 + }, + "[:if, 3, 46, 6, 52, 9]": { + "[:then, 4, 47, 8, 48, 75]": 0, + "[:else, 5, 50, 8, 51, 83]": 0 + } + } + }, + "/home/nayara/Documentos/secretaria_ppgi/app/controllers/home_controller.rb": { + "lines": [ + 1, + 1, + null, + null + ], + "branches": { + } + } + }, + "timestamp": 1606177809 + }, + "RSpec": { + "coverage": { + "/home/nayara/Documentos/secretaria_ppgi/app/models/wiki_comment.rb": { + "lines": [ + 1, + 1, + 1, + null + ], + "branches": { + } + }, + "/home/nayara/Documentos/secretaria_ppgi/app/models/application_record.rb": { + "lines": [ + 1, + 1, + null + ], + "branches": { + } + }, + "/home/nayara/Documentos/secretaria_ppgi/app/models/wiki_entry.rb": { + "lines": [ + 1, + 1, + 1, + 1, + 1, + null, + null, + 1, + null, + 1, + null, + 1, + null, + 1, + 30, + 0, + null, + null, + null + ], + "branches": { + "[:if, 0, 15, 8, 17, 11]": { + "[:then, 1, 16, 8, 16, 73]": 0, + "[:else, 2, 15, 8, 17, 11]": 30 + } + } + }, + "/home/nayara/Documentos/secretaria_ppgi/app/models/user.rb": { + "lines": [ + null, + null, + 1, + 1, + 1, + null, + null, + null, + 1, + null, + null, + 1, + null + ], + "branches": { + } + }, + "/home/nayara/Documentos/secretaria_ppgi/app/helpers/application_helper.rb": { + "lines": [ + 1, + null + ], + "branches": { + } + }, + "/home/nayara/Documentos/secretaria_ppgi/app/helpers/comentarios_helper.rb": { + "lines": [ + 1, + null + ], + "branches": { + } + }, + "/home/nayara/Documentos/secretaria_ppgi/app/helpers/home_helper.rb": { + "lines": [ + 1, + null + ], + "branches": { + } + }, + "/home/nayara/Documentos/secretaria_ppgi/app/helpers/wikis_helper.rb": { + "lines": [ + 1, + null + ], + "branches": { + } + }, + "/home/nayara/Documentos/secretaria_ppgi/app/controllers/wiki_comments_controller.rb": { + "lines": [ + 1, + 1, + 1, + null, + null, + null, + 1, + 1, + null, + null, + null, + null, + 1, + null, + null, + null, + 1, + 1, + null, + null, + null, + 1, + null, + null, + null, + null, + 1, + null, + 3, + null, + 3, + 3, + 4, + 2, + null, + 2, + 1, + null, + null, + null, + null, + null, + null, + 1, + 3, + 3, + 4, + 2, + null, + 2, + 1, + null, + null, + null, + null, + null, + null, + 1, + 2, + 2, + 4, + 2, + null, + null, + null, + 1, + null, + 1, + 7, + null, + null, + null, + 1, + 5, + null, + null, + null, + 1, + 6, + null, + null + ], + "branches": { + "[:if, 0, 32, 6, 38, 9]": { + "[:then, 1, 33, 8, 34, 74]": 2, + "[:else, 2, 36, 8, 37, 83]": 1 + }, + "[:if, 3, 46, 6, 52, 9]": { + "[:then, 4, 47, 8, 48, 75]": 2, + "[:else, 5, 50, 8, 51, 83]": 1 + } + } + }, + "/home/nayara/Documentos/secretaria_ppgi/app/controllers/application_controller.rb": { + "lines": [ + null, + null, + 1, + 1, + null, + 1, + null, + 1, + 0, + null, + null + ], + "branches": { + } + }, + "/home/nayara/Documentos/secretaria_ppgi/app/controllers/wiki_entries_controller.rb": { + "lines": [ + 1, + 1, + null, + null, + null, + 1, + 1, + null, + null, + null, + null, + 1, + null, + null, + null, + null, + 1, + 1, + null, + null, + null, + 1, + null, + null, + null, + null, + 1, + 3, + null, + 3, + 3, + 4, + 2, + null, + 2, + 1, + null, + null, + null, + null, + null, + null, + 1, + 3, + 3, + 4, + 2, + null, + 2, + 1, + null, + null, + null, + null, + null, + null, + 1, + 2, + 2, + 4, + 2, + null, + null, + null, + 1, + null, + 1, + 7, + null, + null, + null, + 1, + 6, + null, + null + ], + "branches": { + "[:if, 0, 31, 6, 37, 9]": { + "[:then, 1, 32, 8, 33, 71]": 2, + "[:else, 2, 35, 8, 36, 81]": 1 + }, + "[:if, 3, 45, 6, 51, 9]": { + "[:then, 4, 46, 8, 47, 66]": 2, + "[:else, 5, 49, 8, 50, 81]": 1 + } + } + }, + "/home/nayara/Documentos/secretaria_ppgi/app/controllers/home_controller.rb": { + "lines": [ + 0, + 0, + 0, + 0 + ], + "branches": { + } + } + }, + "timestamp": 1606178724 + } +} diff --git a/coverage/.resultset.json.lock b/coverage/.resultset.json.lock new file mode 100644 index 00000000..e69de29b diff --git a/coverage/assets/0.12.3/DataTables-1.10.20/images/sort_asc.png b/coverage/assets/0.12.3/DataTables-1.10.20/images/sort_asc.png new file mode 100644 index 0000000000000000000000000000000000000000..e1ba61a8055fcb18273f2468d335572204667b1f GIT binary patch literal 160 zcmeAS@N?(olHy`uVBq!ia0vp^!XV7S1|*9D%+3I*bWaz@5R22v2@;zYta_*?F5u6Q zWR@in#&u+WgT?Hi<}D3B3}GOXuX|8Oj3tosHiJ3*4TN zC7>_x-r1O=t(?KoTC+`+>7&2GzdqLHBg&F)2Q?&EGZ+}|Rpsc~9`m>jw35No)z4*} HQ$iB}HK{Sd literal 0 HcmV?d00001 diff --git a/coverage/assets/0.12.3/DataTables-1.10.20/images/sort_asc_disabled.png b/coverage/assets/0.12.3/DataTables-1.10.20/images/sort_asc_disabled.png new file mode 100644 index 0000000000000000000000000000000000000000..fb11dfe24a6c564cb7ddf8bc96703ebb121df1e7 GIT binary patch literal 148 zcmeAS@N?(olHy`uVBq!ia0vp^!XV7S0wixl{&NRX(Vi}jAsXkC6BcOhI9!^3NY?Do zDX;f`c1`y6n0RgO@$!H7chZT&|Jn0dmaqO^XNm-CGtk!Ur<_=Jws3;%W$<+Mb6Mw<&;$T1GdZXL literal 0 HcmV?d00001 diff --git a/coverage/assets/0.12.3/DataTables-1.10.20/images/sort_both.png b/coverage/assets/0.12.3/DataTables-1.10.20/images/sort_both.png new file mode 100644 index 0000000000000000000000000000000000000000..af5bc7c5a10b9d6d57cb641aeec752428a07f0ca GIT binary patch literal 201 zcmeAS@N?(olHy`uVBq!ia0vp^!XV7S0wixl{&NRX6FglULp08Bycxyy87-Q;~nRxO8@-UU*I^KVWyN+&SiMHu5xDOu|HNvwzODfTdXjhVyNu1 z#7^XbGKZ7LW3XeONb$RKLeE*WhqbYpIXPIqK@r4)v+qN8um%99%MPpS9d#7Ed7SL@Bp00i_>zopr0H-Zb Aj{pDw literal 0 HcmV?d00001 diff --git a/coverage/assets/0.12.3/DataTables-1.10.20/images/sort_desc.png b/coverage/assets/0.12.3/DataTables-1.10.20/images/sort_desc.png new file mode 100644 index 0000000000000000000000000000000000000000..0e156deb5f61d18f9e2ec5da4f6a8c94a5b4fb41 GIT binary patch literal 158 zcmeAS@N?(olHy`uVBq!ia0vp^!XV7S1|*9D%+3I*R8JSj5R22v2@yo z(czD9$NuDl3Ljm9c#_#4$vXUz=f1~&WY3aa=h!;z7fOEN>ySP9QA=6C-^Dmb&tuM= z4Z&=WZU;2WF>e%GI&mWJk^K!jrbro{W;-I>FeCfLGJl3}+Z^2)3Kw?+EoAU?^>bP0 Hl+XkKC^j|Q{b@g3TV7E(Grjn^aLC2o)_ptHrtUEoT$S@q)~)7U@V;W{6)!%@ u>N?4t-1qslpJw9!O?PJ&w0Cby.sorting_1,table.dataTable.order-column tbody tr>.sorting_2,table.dataTable.order-column tbody tr>.sorting_3,table.dataTable.display tbody tr>.sorting_1,table.dataTable.display tbody tr>.sorting_2,table.dataTable.display tbody tr>.sorting_3{background-color:#fafafa}table.dataTable.order-column tbody tr.selected>.sorting_1,table.dataTable.order-column tbody tr.selected>.sorting_2,table.dataTable.order-column tbody tr.selected>.sorting_3,table.dataTable.display tbody tr.selected>.sorting_1,table.dataTable.display tbody tr.selected>.sorting_2,table.dataTable.display tbody tr.selected>.sorting_3{background-color:#acbad5}table.dataTable.display tbody tr.odd>.sorting_1,table.dataTable.order-column.stripe tbody tr.odd>.sorting_1{background-color:#f1f1f1}table.dataTable.display tbody tr.odd>.sorting_2,table.dataTable.order-column.stripe tbody tr.odd>.sorting_2{background-color:#f3f3f3}table.dataTable.display tbody tr.odd>.sorting_3,table.dataTable.order-column.stripe tbody tr.odd>.sorting_3{background-color:whitesmoke}table.dataTable.display tbody tr.odd.selected>.sorting_1,table.dataTable.order-column.stripe tbody tr.odd.selected>.sorting_1{background-color:#a6b4cd}table.dataTable.display tbody tr.odd.selected>.sorting_2,table.dataTable.order-column.stripe tbody tr.odd.selected>.sorting_2{background-color:#a8b5cf}table.dataTable.display tbody tr.odd.selected>.sorting_3,table.dataTable.order-column.stripe tbody tr.odd.selected>.sorting_3{background-color:#a9b7d1}table.dataTable.display tbody tr.even>.sorting_1,table.dataTable.order-column.stripe tbody tr.even>.sorting_1{background-color:#fafafa}table.dataTable.display tbody tr.even>.sorting_2,table.dataTable.order-column.stripe tbody tr.even>.sorting_2{background-color:#fcfcfc}table.dataTable.display tbody tr.even>.sorting_3,table.dataTable.order-column.stripe tbody tr.even>.sorting_3{background-color:#fefefe}table.dataTable.display tbody tr.even.selected>.sorting_1,table.dataTable.order-column.stripe tbody tr.even.selected>.sorting_1{background-color:#acbad5}table.dataTable.display tbody tr.even.selected>.sorting_2,table.dataTable.order-column.stripe tbody tr.even.selected>.sorting_2{background-color:#aebcd6}table.dataTable.display tbody tr.even.selected>.sorting_3,table.dataTable.order-column.stripe tbody tr.even.selected>.sorting_3{background-color:#afbdd8}table.dataTable.display tbody tr:hover>.sorting_1,table.dataTable.order-column.hover tbody tr:hover>.sorting_1{background-color:#eaeaea}table.dataTable.display tbody tr:hover>.sorting_2,table.dataTable.order-column.hover tbody tr:hover>.sorting_2{background-color:#ececec}table.dataTable.display tbody tr:hover>.sorting_3,table.dataTable.order-column.hover tbody tr:hover>.sorting_3{background-color:#efefef}table.dataTable.display tbody tr:hover.selected>.sorting_1,table.dataTable.order-column.hover tbody tr:hover.selected>.sorting_1{background-color:#a2aec7}table.dataTable.display tbody tr:hover.selected>.sorting_2,table.dataTable.order-column.hover tbody tr:hover.selected>.sorting_2{background-color:#a3b0c9}table.dataTable.display tbody tr:hover.selected>.sorting_3,table.dataTable.order-column.hover tbody tr:hover.selected>.sorting_3{background-color:#a5b2cb}table.dataTable.no-footer{border-bottom:1px solid #111}table.dataTable.nowrap th,table.dataTable.nowrap td{white-space:nowrap}table.dataTable.compact thead th,table.dataTable.compact thead td{padding:4px 17px 4px 4px}table.dataTable.compact tfoot th,table.dataTable.compact tfoot td{padding:4px}table.dataTable.compact tbody th,table.dataTable.compact tbody td{padding:4px}table.dataTable th.dt-left,table.dataTable td.dt-left{text-align:left}table.dataTable th.dt-center,table.dataTable td.dt-center,table.dataTable td.dataTables_empty{text-align:center}table.dataTable th.dt-right,table.dataTable td.dt-right{text-align:right}table.dataTable th.dt-justify,table.dataTable td.dt-justify{text-align:justify}table.dataTable th.dt-nowrap,table.dataTable td.dt-nowrap{white-space:nowrap}table.dataTable thead th.dt-head-left,table.dataTable thead td.dt-head-left,table.dataTable tfoot th.dt-head-left,table.dataTable tfoot td.dt-head-left{text-align:left}table.dataTable thead th.dt-head-center,table.dataTable thead td.dt-head-center,table.dataTable tfoot th.dt-head-center,table.dataTable tfoot td.dt-head-center{text-align:center}table.dataTable thead th.dt-head-right,table.dataTable thead td.dt-head-right,table.dataTable tfoot th.dt-head-right,table.dataTable tfoot td.dt-head-right{text-align:right}table.dataTable thead th.dt-head-justify,table.dataTable thead td.dt-head-justify,table.dataTable tfoot th.dt-head-justify,table.dataTable tfoot td.dt-head-justify{text-align:justify}table.dataTable thead th.dt-head-nowrap,table.dataTable thead td.dt-head-nowrap,table.dataTable tfoot th.dt-head-nowrap,table.dataTable tfoot td.dt-head-nowrap{white-space:nowrap}table.dataTable tbody th.dt-body-left,table.dataTable tbody td.dt-body-left{text-align:left}table.dataTable tbody th.dt-body-center,table.dataTable tbody td.dt-body-center{text-align:center}table.dataTable tbody th.dt-body-right,table.dataTable tbody td.dt-body-right{text-align:right}table.dataTable tbody th.dt-body-justify,table.dataTable tbody td.dt-body-justify{text-align:justify}table.dataTable tbody th.dt-body-nowrap,table.dataTable tbody td.dt-body-nowrap{white-space:nowrap}table.dataTable,table.dataTable th,table.dataTable td{box-sizing:content-box}.dataTables_wrapper{position:relative;clear:both;*zoom:1;zoom:1}.dataTables_wrapper .dataTables_length{float:left}.dataTables_wrapper .dataTables_filter{float:right;text-align:right}.dataTables_wrapper .dataTables_filter input{margin-left:.5em}.dataTables_wrapper .dataTables_info{clear:both;float:left;padding-top:.755em}.dataTables_wrapper .dataTables_paginate{float:right;text-align:right;padding-top:.25em}.dataTables_wrapper .dataTables_paginate .paginate_button{box-sizing:border-box;display:inline-block;min-width:1.5em;padding:.5em 1em;margin-left:2px;text-align:center;text-decoration:none !important;cursor:pointer;*cursor:hand;color:#333 !important;border:1px solid transparent;border-radius:2px}.dataTables_wrapper .dataTables_paginate .paginate_button.current,.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover{color:#333 !important;border:1px solid #979797;background-color:white;background:-webkit-gradient(linear,left top,left bottom,color-stop(0,white),color-stop(100%,#dcdcdc));background:-webkit-linear-gradient(top,white 0,#dcdcdc 100%);background:-moz-linear-gradient(top,white 0,#dcdcdc 100%);background:-ms-linear-gradient(top,white 0,#dcdcdc 100%);background:-o-linear-gradient(top,white 0,#dcdcdc 100%);background:linear-gradient(to bottom,white 0,#dcdcdc 100%)}.dataTables_wrapper .dataTables_paginate .paginate_button.disabled,.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover,.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:active{cursor:default;color:#666 !important;border:1px solid transparent;background:transparent;box-shadow:none}.dataTables_wrapper .dataTables_paginate .paginate_button:hover{color:white !important;border:1px solid #111;background-color:#585858;background:-webkit-gradient(linear,left top,left bottom,color-stop(0,#585858),color-stop(100%,#111));background:-webkit-linear-gradient(top,#585858 0,#111 100%);background:-moz-linear-gradient(top,#585858 0,#111 100%);background:-ms-linear-gradient(top,#585858 0,#111 100%);background:-o-linear-gradient(top,#585858 0,#111 100%);background:linear-gradient(to bottom,#585858 0,#111 100%)}.dataTables_wrapper .dataTables_paginate .paginate_button:active{outline:0;background-color:#2b2b2b;background:-webkit-gradient(linear,left top,left bottom,color-stop(0,#2b2b2b),color-stop(100%,#0c0c0c));background:-webkit-linear-gradient(top,#2b2b2b 0,#0c0c0c 100%);background:-moz-linear-gradient(top,#2b2b2b 0,#0c0c0c 100%);background:-ms-linear-gradient(top,#2b2b2b 0,#0c0c0c 100%);background:-o-linear-gradient(top,#2b2b2b 0,#0c0c0c 100%);background:linear-gradient(to bottom,#2b2b2b 0,#0c0c0c 100%);box-shadow:inset 0 0 3px #111}.dataTables_wrapper .dataTables_paginate .ellipsis{padding:0 1em}.dataTables_wrapper .dataTables_processing{position:absolute;top:50%;left:50%;width:100%;height:40px;margin-left:-50%;margin-top:-25px;padding-top:20px;text-align:center;font-size:1.2em;background-color:white;background:-webkit-gradient(linear,left top,right top,color-stop(0,rgba(255,255,255,0)),color-stop(25%,rgba(255,255,255,0.9)),color-stop(75%,rgba(255,255,255,0.9)),color-stop(100%,rgba(255,255,255,0)));background:-webkit-linear-gradient(left,rgba(255,255,255,0) 0,rgba(255,255,255,0.9) 25%,rgba(255,255,255,0.9) 75%,rgba(255,255,255,0) 100%);background:-moz-linear-gradient(left,rgba(255,255,255,0) 0,rgba(255,255,255,0.9) 25%,rgba(255,255,255,0.9) 75%,rgba(255,255,255,0) 100%);background:-ms-linear-gradient(left,rgba(255,255,255,0) 0,rgba(255,255,255,0.9) 25%,rgba(255,255,255,0.9) 75%,rgba(255,255,255,0) 100%);background:-o-linear-gradient(left,rgba(255,255,255,0) 0,rgba(255,255,255,0.9) 25%,rgba(255,255,255,0.9) 75%,rgba(255,255,255,0) 100%);background:linear-gradient(to right,rgba(255,255,255,0) 0,rgba(255,255,255,0.9) 25%,rgba(255,255,255,0.9) 75%,rgba(255,255,255,0) 100%)}.dataTables_wrapper .dataTables_length,.dataTables_wrapper .dataTables_filter,.dataTables_wrapper .dataTables_info,.dataTables_wrapper .dataTables_processing,.dataTables_wrapper .dataTables_paginate{color:#333}.dataTables_wrapper .dataTables_scroll{clear:both}.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody{*margin-top:-1px;-webkit-overflow-scrolling:touch}.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody>table>thead>tr>th,.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody>table>thead>tr>td,.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody>table>tbody>tr>th,.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody>table>tbody>tr>td{vertical-align:middle}.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody>table>thead>tr>th>div.dataTables_sizing,.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody>table>thead>tr>td>div.dataTables_sizing,.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody>table>tbody>tr>th>div.dataTables_sizing,.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody>table>tbody>tr>td>div.dataTables_sizing{height:0;overflow:hidden;margin:0 !important;padding:0 !important}.dataTables_wrapper.no-footer .dataTables_scrollBody{border-bottom:1px solid #111}.dataTables_wrapper.no-footer div.dataTables_scrollHead table.dataTable,.dataTables_wrapper.no-footer div.dataTables_scrollBody>table{border-bottom:0}.dataTables_wrapper:after{visibility:hidden;display:block;content:"";clear:both;height:0}@media screen and (max-width:767px){.dataTables_wrapper .dataTables_info,.dataTables_wrapper .dataTables_paginate{float:none;text-align:center}.dataTables_wrapper .dataTables_paginate{margin-top:.5em}}@media screen and (max-width:640px){.dataTables_wrapper .dataTables_length,.dataTables_wrapper .dataTables_filter{float:none;text-align:center}.dataTables_wrapper .dataTables_filter{margin-top:.5em}}pre .comment,pre .template_comment,pre .diff .header,pre .javadoc{color:#998;font-style:italic}pre .keyword,pre .css .rule .keyword,pre .winutils,pre .javascript .title,pre .lisp .title{color:#000;font-weight:bold}pre .number,pre .hexcolor{color:#458}pre .string,pre .tag .value,pre .phpdoc,pre .tex .formula{color:#d14}pre .subst{color:#712}pre .constant,pre .title,pre .id{color:#900;font-weight:bold}pre .javascript .title,pre .lisp .title,pre .subst{font-weight:normal}pre .class .title,pre .haskell .label,pre .tex .command{color:#458;font-weight:bold}pre .tag,pre .tag .title,pre .rules .property,pre .django .tag .keyword{color:navy;font-weight:normal}pre .attribute,pre .variable,pre .instancevar,pre .lisp .body{color:teal}pre .regexp{color:#009926}pre .class{color:#458;font-weight:bold}pre .symbol,pre .ruby .symbol .string,pre .ruby .symbol .keyword,pre .ruby .symbol .keymethods,pre .lisp .keyword,pre .tex .special,pre .input_number{color:#990073}pre .builtin,pre .built_in,pre .lisp .title{color:#0086b3}pre .preprocessor,pre .pi,pre .doctype,pre .shebang,pre .cdata{color:#999;font-weight:bold}pre .deletion{background:#fdd}pre .addition{background:#dfd}pre .diff .change{background:#0086b3}pre .chunk{color:#aaa}pre .tex .formula{opacity:.5}.ui-helper-hidden{display:none}.ui-helper-hidden-accessible{position:absolute;left:-99999999px}.ui-helper-reset{margin:0;padding:0;border:0;outline:0;line-height:1.3;text-decoration:none;font-size:100%;list-style:none}.ui-helper-clearfix:after{content:".";display:block;height:0;clear:both;visibility:hidden}.ui-helper-clearfix{display:inline-block}/*\*/* html .ui-helper-clearfix{height:1%}.ui-helper-clearfix{display:block}/**/.ui-helper-zfix{width:100%;height:100%;top:0;left:0;position:absolute;opacity:0;filter:Alpha(Opacity=0)}.ui-state-disabled{cursor:default !important}.ui-icon{display:block;text-indent:-99999px;overflow:hidden;background-repeat:no-repeat}.ui-widget-overlay{position:absolute;top:0;left:0;width:100%;height:100%}.ui-widget{font-family:Verdana,Arial,sans-serif;font-size:1.1em}.ui-widget .ui-widget{font-size:1em}.ui-widget input,.ui-widget select,.ui-widget textarea,.ui-widget button{font-family:Verdana,Arial,sans-serif;font-size:1em}.ui-widget-content{border:1px solid #aaa;background:#fff url(images/ui-bg_flat_75_ffffff_40x100.png) 50% 50% repeat-x;color:#222}.ui-widget-content a{color:#222}.ui-widget-header{border:1px solid #aaa;background:#ccc url(images/ui-bg_highlight-soft_75_cccccc_1x100.png) 50% 50% repeat-x;color:#222;font-weight:bold}.ui-widget-header a{color:#222}.ui-state-default,.ui-widget-content .ui-state-default,.ui-widget-header .ui-state-default{border:1px solid #d3d3d3;background:#e6e6e6 url(images/ui-bg_glass_75_e6e6e6_1x400.png) 50% 50% repeat-x;font-weight:normal;color:#555}.ui-state-default a,.ui-state-default a:link,.ui-state-default a:visited{color:#555;text-decoration:none}.ui-state-hover,.ui-widget-content .ui-state-hover,.ui-widget-header .ui-state-hover,.ui-state-focus,.ui-widget-content .ui-state-focus,.ui-widget-header .ui-state-focus{border:1px solid #999;background:#dadada url(images/ui-bg_glass_75_dadada_1x400.png) 50% 50% repeat-x;font-weight:normal;color:#212121}.ui-state-hover a,.ui-state-hover a:hover{color:#212121;text-decoration:none}.ui-state-active,.ui-widget-content .ui-state-active,.ui-widget-header .ui-state-active{border:1px solid #aaa;background:#fff url(images/ui-bg_glass_65_ffffff_1x400.png) 50% 50% repeat-x;font-weight:normal;color:#212121}.ui-state-active a,.ui-state-active a:link,.ui-state-active a:visited{color:#212121;text-decoration:none}.ui-widget :active{outline:0}.ui-state-highlight,.ui-widget-content .ui-state-highlight,.ui-widget-header .ui-state-highlight{border:1px solid #fcefa1;background:#fbf9ee url(images/ui-bg_glass_55_fbf9ee_1x400.png) 50% 50% repeat-x;color:#363636}.ui-state-highlight a,.ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a{color:#363636}.ui-state-error,.ui-widget-content .ui-state-error,.ui-widget-header .ui-state-error{border:1px solid #cd0a0a;background:#fef1ec url(images/ui-bg_glass_95_fef1ec_1x400.png) 50% 50% repeat-x;color:#cd0a0a}.ui-state-error a,.ui-widget-content .ui-state-error a,.ui-widget-header .ui-state-error a{color:#cd0a0a}.ui-state-error-text,.ui-widget-content .ui-state-error-text,.ui-widget-header .ui-state-error-text{color:#cd0a0a}.ui-priority-primary,.ui-widget-content .ui-priority-primary,.ui-widget-header .ui-priority-primary{font-weight:bold}.ui-priority-secondary,.ui-widget-content .ui-priority-secondary,.ui-widget-header .ui-priority-secondary{opacity:.7;filter:Alpha(Opacity=70);font-weight:normal}.ui-state-disabled,.ui-widget-content .ui-state-disabled,.ui-widget-header .ui-state-disabled{opacity:.35;filter:Alpha(Opacity=35);background-image:none}.ui-icon{width:16px;height:16px;background-image:url(images/ui-icons_222222_256x240.png)}.ui-widget-content .ui-icon{background-image:url(images/ui-icons_222222_256x240.png)}.ui-widget-header .ui-icon{background-image:url(images/ui-icons_222222_256x240.png)}.ui-state-default .ui-icon{background-image:url(images/ui-icons_888888_256x240.png)}.ui-state-hover .ui-icon,.ui-state-focus .ui-icon{background-image:url(images/ui-icons_454545_256x240.png)}.ui-state-active .ui-icon{background-image:url(images/ui-icons_454545_256x240.png)}.ui-state-highlight .ui-icon{background-image:url(images/ui-icons_2e83ff_256x240.png)}.ui-state-error .ui-icon,.ui-state-error-text .ui-icon{background-image:url(images/ui-icons_cd0a0a_256x240.png)}.ui-icon-carat-1-n{background-position:0 0}.ui-icon-carat-1-ne{background-position:-16px 0}.ui-icon-carat-1-e{background-position:-32px 0}.ui-icon-carat-1-se{background-position:-48px 0}.ui-icon-carat-1-s{background-position:-64px 0}.ui-icon-carat-1-sw{background-position:-80px 0}.ui-icon-carat-1-w{background-position:-96px 0}.ui-icon-carat-1-nw{background-position:-112px 0}.ui-icon-carat-2-n-s{background-position:-128px 0}.ui-icon-carat-2-e-w{background-position:-144px 0}.ui-icon-triangle-1-n{background-position:0 -16px}.ui-icon-triangle-1-ne{background-position:-16px -16px}.ui-icon-triangle-1-e{background-position:-32px -16px}.ui-icon-triangle-1-se{background-position:-48px -16px}.ui-icon-triangle-1-s{background-position:-64px -16px}.ui-icon-triangle-1-sw{background-position:-80px -16px}.ui-icon-triangle-1-w{background-position:-96px -16px}.ui-icon-triangle-1-nw{background-position:-112px -16px}.ui-icon-triangle-2-n-s{background-position:-128px -16px}.ui-icon-triangle-2-e-w{background-position:-144px -16px}.ui-icon-arrow-1-n{background-position:0 -32px}.ui-icon-arrow-1-ne{background-position:-16px -32px}.ui-icon-arrow-1-e{background-position:-32px -32px}.ui-icon-arrow-1-se{background-position:-48px -32px}.ui-icon-arrow-1-s{background-position:-64px -32px}.ui-icon-arrow-1-sw{background-position:-80px -32px}.ui-icon-arrow-1-w{background-position:-96px -32px}.ui-icon-arrow-1-nw{background-position:-112px -32px}.ui-icon-arrow-2-n-s{background-position:-128px -32px}.ui-icon-arrow-2-ne-sw{background-position:-144px -32px}.ui-icon-arrow-2-e-w{background-position:-160px -32px}.ui-icon-arrow-2-se-nw{background-position:-176px -32px}.ui-icon-arrowstop-1-n{background-position:-192px -32px}.ui-icon-arrowstop-1-e{background-position:-208px -32px}.ui-icon-arrowstop-1-s{background-position:-224px -32px}.ui-icon-arrowstop-1-w{background-position:-240px -32px}.ui-icon-arrowthick-1-n{background-position:0 -48px}.ui-icon-arrowthick-1-ne{background-position:-16px -48px}.ui-icon-arrowthick-1-e{background-position:-32px -48px}.ui-icon-arrowthick-1-se{background-position:-48px -48px}.ui-icon-arrowthick-1-s{background-position:-64px -48px}.ui-icon-arrowthick-1-sw{background-position:-80px -48px}.ui-icon-arrowthick-1-w{background-position:-96px -48px}.ui-icon-arrowthick-1-nw{background-position:-112px -48px}.ui-icon-arrowthick-2-n-s{background-position:-128px -48px}.ui-icon-arrowthick-2-ne-sw{background-position:-144px -48px}.ui-icon-arrowthick-2-e-w{background-position:-160px -48px}.ui-icon-arrowthick-2-se-nw{background-position:-176px -48px}.ui-icon-arrowthickstop-1-n{background-position:-192px -48px}.ui-icon-arrowthickstop-1-e{background-position:-208px -48px}.ui-icon-arrowthickstop-1-s{background-position:-224px -48px}.ui-icon-arrowthickstop-1-w{background-position:-240px -48px}.ui-icon-arrowreturnthick-1-w{background-position:0 -64px}.ui-icon-arrowreturnthick-1-n{background-position:-16px -64px}.ui-icon-arrowreturnthick-1-e{background-position:-32px -64px}.ui-icon-arrowreturnthick-1-s{background-position:-48px -64px}.ui-icon-arrowreturn-1-w{background-position:-64px -64px}.ui-icon-arrowreturn-1-n{background-position:-80px -64px}.ui-icon-arrowreturn-1-e{background-position:-96px -64px}.ui-icon-arrowreturn-1-s{background-position:-112px -64px}.ui-icon-arrowrefresh-1-w{background-position:-128px -64px}.ui-icon-arrowrefresh-1-n{background-position:-144px -64px}.ui-icon-arrowrefresh-1-e{background-position:-160px -64px}.ui-icon-arrowrefresh-1-s{background-position:-176px -64px}.ui-icon-arrow-4{background-position:0 -80px}.ui-icon-arrow-4-diag{background-position:-16px -80px}.ui-icon-extlink{background-position:-32px -80px}.ui-icon-newwin{background-position:-48px -80px}.ui-icon-refresh{background-position:-64px -80px}.ui-icon-shuffle{background-position:-80px -80px}.ui-icon-transfer-e-w{background-position:-96px -80px}.ui-icon-transferthick-e-w{background-position:-112px -80px}.ui-icon-folder-collapsed{background-position:0 -96px}.ui-icon-folder-open{background-position:-16px -96px}.ui-icon-document{background-position:-32px -96px}.ui-icon-document-b{background-position:-48px -96px}.ui-icon-note{background-position:-64px -96px}.ui-icon-mail-closed{background-position:-80px -96px}.ui-icon-mail-open{background-position:-96px -96px}.ui-icon-suitcase{background-position:-112px -96px}.ui-icon-comment{background-position:-128px -96px}.ui-icon-person{background-position:-144px -96px}.ui-icon-print{background-position:-160px -96px}.ui-icon-trash{background-position:-176px -96px}.ui-icon-locked{background-position:-192px -96px}.ui-icon-unlocked{background-position:-208px -96px}.ui-icon-bookmark{background-position:-224px -96px}.ui-icon-tag{background-position:-240px -96px}.ui-icon-home{background-position:0 -112px}.ui-icon-flag{background-position:-16px -112px}.ui-icon-calendar{background-position:-32px -112px}.ui-icon-cart{background-position:-48px -112px}.ui-icon-pencil{background-position:-64px -112px}.ui-icon-clock{background-position:-80px -112px}.ui-icon-disk{background-position:-96px -112px}.ui-icon-calculator{background-position:-112px -112px}.ui-icon-zoomin{background-position:-128px -112px}.ui-icon-zoomout{background-position:-144px -112px}.ui-icon-search{background-position:-160px -112px}.ui-icon-wrench{background-position:-176px -112px}.ui-icon-gear{background-position:-192px -112px}.ui-icon-heart{background-position:-208px -112px}.ui-icon-star{background-position:-224px -112px}.ui-icon-link{background-position:-240px -112px}.ui-icon-cancel{background-position:0 -128px}.ui-icon-plus{background-position:-16px -128px}.ui-icon-plusthick{background-position:-32px -128px}.ui-icon-minus{background-position:-48px -128px}.ui-icon-minusthick{background-position:-64px -128px}.ui-icon-close{background-position:-80px -128px}.ui-icon-closethick{background-position:-96px -128px}.ui-icon-key{background-position:-112px -128px}.ui-icon-lightbulb{background-position:-128px -128px}.ui-icon-scissors{background-position:-144px -128px}.ui-icon-clipboard{background-position:-160px -128px}.ui-icon-copy{background-position:-176px -128px}.ui-icon-contact{background-position:-192px -128px}.ui-icon-image{background-position:-208px -128px}.ui-icon-video{background-position:-224px -128px}.ui-icon-script{background-position:-240px -128px}.ui-icon-alert{background-position:0 -144px}.ui-icon-info{background-position:-16px -144px}.ui-icon-notice{background-position:-32px -144px}.ui-icon-help{background-position:-48px -144px}.ui-icon-check{background-position:-64px -144px}.ui-icon-bullet{background-position:-80px -144px}.ui-icon-radio-off{background-position:-96px -144px}.ui-icon-radio-on{background-position:-112px -144px}.ui-icon-pin-w{background-position:-128px -144px}.ui-icon-pin-s{background-position:-144px -144px}.ui-icon-play{background-position:0 -160px}.ui-icon-pause{background-position:-16px -160px}.ui-icon-seek-next{background-position:-32px -160px}.ui-icon-seek-prev{background-position:-48px -160px}.ui-icon-seek-end{background-position:-64px -160px}.ui-icon-seek-start{background-position:-80px -160px}.ui-icon-seek-first{background-position:-80px -160px}.ui-icon-stop{background-position:-96px -160px}.ui-icon-eject{background-position:-112px -160px}.ui-icon-volume-off{background-position:-128px -160px}.ui-icon-volume-on{background-position:-144px -160px}.ui-icon-power{background-position:0 -176px}.ui-icon-signal-diag{background-position:-16px -176px}.ui-icon-signal{background-position:-32px -176px}.ui-icon-battery-0{background-position:-48px -176px}.ui-icon-battery-1{background-position:-64px -176px}.ui-icon-battery-2{background-position:-80px -176px}.ui-icon-battery-3{background-position:-96px -176px}.ui-icon-circle-plus{background-position:0 -192px}.ui-icon-circle-minus{background-position:-16px -192px}.ui-icon-circle-close{background-position:-32px -192px}.ui-icon-circle-triangle-e{background-position:-48px -192px}.ui-icon-circle-triangle-s{background-position:-64px -192px}.ui-icon-circle-triangle-w{background-position:-80px -192px}.ui-icon-circle-triangle-n{background-position:-96px -192px}.ui-icon-circle-arrow-e{background-position:-112px -192px}.ui-icon-circle-arrow-s{background-position:-128px -192px}.ui-icon-circle-arrow-w{background-position:-144px -192px}.ui-icon-circle-arrow-n{background-position:-160px -192px}.ui-icon-circle-zoomin{background-position:-176px -192px}.ui-icon-circle-zoomout{background-position:-192px -192px}.ui-icon-circle-check{background-position:-208px -192px}.ui-icon-circlesmall-plus{background-position:0 -208px}.ui-icon-circlesmall-minus{background-position:-16px -208px}.ui-icon-circlesmall-close{background-position:-32px -208px}.ui-icon-squaresmall-plus{background-position:-48px -208px}.ui-icon-squaresmall-minus{background-position:-64px -208px}.ui-icon-squaresmall-close{background-position:-80px -208px}.ui-icon-grip-dotted-vertical{background-position:0 -224px}.ui-icon-grip-dotted-horizontal{background-position:-16px -224px}.ui-icon-grip-solid-vertical{background-position:-32px -224px}.ui-icon-grip-solid-horizontal{background-position:-48px -224px}.ui-icon-gripsmall-diagonal-se{background-position:-64px -224px}.ui-icon-grip-diagonal-se{background-position:-80px -224px}.ui-corner-tl{-moz-border-radius-topleft:4px;-webkit-border-top-left-radius:4px;border-top-left-radius:4px}.ui-corner-tr{-moz-border-radius-topright:4px;-webkit-border-top-right-radius:4px;border-top-right-radius:4px}.ui-corner-bl{-moz-border-radius-bottomleft:4px;-webkit-border-bottom-left-radius:4px;border-bottom-left-radius:4px}.ui-corner-br{-moz-border-radius-bottomright:4px;-webkit-border-bottom-right-radius:4px;border-bottom-right-radius:4px}.ui-corner-top{-moz-border-radius-topleft:4px;-webkit-border-top-left-radius:4px;border-top-left-radius:4px;-moz-border-radius-topright:4px;-webkit-border-top-right-radius:4px;border-top-right-radius:4px}.ui-corner-bottom{-moz-border-radius-bottomleft:4px;-webkit-border-bottom-left-radius:4px;border-bottom-left-radius:4px;-moz-border-radius-bottomright:4px;-webkit-border-bottom-right-radius:4px;border-bottom-right-radius:4px}.ui-corner-right{-moz-border-radius-topright:4px;-webkit-border-top-right-radius:4px;border-top-right-radius:4px;-moz-border-radius-bottomright:4px;-webkit-border-bottom-right-radius:4px;border-bottom-right-radius:4px}.ui-corner-left{-moz-border-radius-topleft:4px;-webkit-border-top-left-radius:4px;border-top-left-radius:4px;-moz-border-radius-bottomleft:4px;-webkit-border-bottom-left-radius:4px;border-bottom-left-radius:4px}.ui-corner-all{-moz-border-radius:4px;-webkit-border-radius:4px;border-radius:4px}.ui-widget-overlay{background:#aaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x;opacity:.30;filter:Alpha(Opacity=30)}.ui-widget-shadow{margin:-8px 0 0 -8px;padding:8px;background:#aaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x;opacity:.30;filter:Alpha(Opacity=30);-moz-border-radius:8px;-webkit-border-radius:8px;border-radius:8px}#colorbox,#cboxOverlay,#cboxWrapper{position:absolute;top:0;left:0;z-index:9999;overflow:hidden}#cboxOverlay{position:fixed;width:100%;height:100%}#cboxMiddleLeft,#cboxBottomLeft{clear:left}#cboxContent{position:relative}#cboxLoadedContent{overflow:auto}#cboxTitle{margin:0}#cboxLoadingOverlay,#cboxLoadingGraphic{position:absolute;top:0;left:0;width:100%;height:100%}#cboxPrevious,#cboxNext,#cboxClose,#cboxSlideshow{cursor:pointer}.cboxPhoto{float:left;margin:auto;border:0;display:block;max-width:none}.cboxIframe{width:100%;height:100%;display:block;border:0}#colorbox,#cboxContent,#cboxLoadedContent{box-sizing:content-box}#cboxOverlay{background:#000}#cboxTopLeft{width:14px;height:14px;background:url(colorbox/controls.png) no-repeat 0 0}#cboxTopCenter{height:14px;background:url(colorbox/border.png) repeat-x top left}#cboxTopRight{width:14px;height:14px;background:url(colorbox/controls.png) no-repeat -36px 0}#cboxBottomLeft{width:14px;height:43px;background:url(colorbox/controls.png) no-repeat 0 -32px}#cboxBottomCenter{height:43px;background:url(colorbox/border.png) repeat-x bottom left}#cboxBottomRight{width:14px;height:43px;background:url(colorbox/controls.png) no-repeat -36px -32px}#cboxMiddleLeft{width:14px;background:url(colorbox/controls.png) repeat-y -175px 0}#cboxMiddleRight{width:14px;background:url(colorbox/controls.png) repeat-y -211px 0}#cboxContent{background:#fff;overflow:visible}.cboxIframe{background:#fff}#cboxError{padding:50px;border:1px solid #ccc}#cboxLoadedContent{margin-bottom:5px}#cboxLoadingOverlay{background:url(colorbox/loading_background.png) no-repeat center center}#cboxLoadingGraphic{background:url(colorbox/loading.gif) no-repeat center center}#cboxTitle{position:absolute;bottom:-25px;left:0;text-align:center;width:100%;font-weight:bold;color:#7c7c7c}#cboxCurrent{position:absolute;bottom:-25px;left:58px;font-weight:bold;color:#7c7c7c}#cboxPrevious,#cboxNext,#cboxClose,#cboxSlideshow{position:absolute;bottom:-29px;background:url(colorbox/controls.png) no-repeat 0 0;width:23px;height:23px;text-indent:-9999px}#cboxPrevious{left:0;background-position:-51px -25px}#cboxPrevious:hover{background-position:-51px 0}#cboxNext{left:27px;background-position:-75px -25px}#cboxNext:hover{background-position:-75px 0}#cboxClose{right:0;background-position:-100px -25px}#cboxClose:hover{background-position:-100px 0}.cboxSlideshow_on #cboxSlideshow{background-position:-125px 0;right:27px}.cboxSlideshow_on #cboxSlideshow:hover{background-position:-150px 0}.cboxSlideshow_off #cboxSlideshow{background-position:-150px -25px;right:27px}.cboxSlideshow_off #cboxSlideshow:hover{background-position:-125px 0}#loading{position:fixed;left:40%;top:50%}a{color:#333;text-decoration:none}a:hover{color:#000;text-decoration:underline}body{font-family:"Lucida Grande",Helvetica,"Helvetica Neue",Arial,sans-serif;padding:12px;background-color:#333}h1,h2,h3,h4{color:#1c2324;margin:0;padding:0;margin-bottom:12px}table{width:100%}#content{clear:left;background-color:white;border:2px solid #ddd;border-top:8px solid #ddd;padding:18px;-webkit-border-bottom-left-radius:5px;-webkit-border-bottom-right-radius:5px;-webkit-border-top-right-radius:5px;-moz-border-radius-bottomleft:5px;-moz-border-radius-bottomright:5px;-moz-border-radius-topright:5px;border-bottom-left-radius:5px;border-bottom-right-radius:5px;border-top-right-radius:5px}.dataTables_filter,.dataTables_info{padding:2px 6px}abbr.timeago{text-decoration:none;border:0;font-weight:bold}.timestamp{float:right;color:#ddd}.group_tabs{list-style:none;float:left;margin:0;padding:0}.group_tabs li{display:inline;float:left}.group_tabs li a{font-family:Helvetica,Arial,sans-serif;display:block;float:left;text-decoration:none;padding:4px 8px;background-color:#aaa;background:-webkit-gradient(linear,0 0,0 bottom,from(#ddd),to(#aaa));background:-moz-linear-gradient(#ddd,#aaa);background:linear-gradient(#ddd,#aaa);text-shadow:#e5e5e5 1px 1px 0;border-bottom:0;color:#333;font-weight:bold;margin-right:8px;border-top:1px solid #efefef;-webkit-border-top-left-radius:2px;-webkit-border-top-right-radius:2px;-moz-border-radius-topleft:2px;-moz-border-radius-topright:2px;border-top-left-radius:2px;border-top-right-radius:2px}.group_tabs li a:hover{background-color:#ccc;background:-webkit-gradient(linear,0 0,0 bottom,from(#eee),to(#aaa));background:-moz-linear-gradient(#eee,#aaa);background:linear-gradient(#eee,#aaa)}.group_tabs li a:active{padding-top:5px;padding-bottom:3px}.group_tabs li.active a{color:black;text-shadow:#fff 1px 1px 0;background-color:#ddd;background:-webkit-gradient(linear,0 0,0 bottom,from(white),to(#ddd));background:-moz-linear-gradient(white,#ddd);background:linear-gradient(white,#ddd)}.file_list{margin-bottom:18px}.file_list--responsive{overflow-x:auto;overflow-y:hidden}a.src_link{background:url("./magnify.png") no-repeat left 50%;padding-left:18px}tr,td{margin:0;padding:0}th{white-space:nowrap}th.ui-state-default{cursor:pointer}th span.ui-icon{float:left}td{padding:4px 8px}td.strong{font-weight:bold}.cell--number{text-align:right}.source_table h3,.source_table h4{padding:0;margin:0;margin-bottom:4px}.source_table .header{padding:10px}.source_table pre{margin:0;padding:0;white-space:normal;color:#000;font-family:"Monaco","Inconsolata","Consolas",monospace}.source_table code{color:#000;font-family:"Monaco","Inconsolata","Consolas",monospace}.source_table pre{background-color:#333}.source_table pre ol{margin:0;padding:0;margin-left:45px;font-size:12px;color:white}.source_table pre li{margin:0;padding:2px 6px;border-left:5px solid white}.source_table pre li code{white-space:pre;white-space:pre-wrap}.source_table pre .hits{float:right;margin-left:10px;padding:2px 4px;background-color:#444;background:-webkit-gradient(linear,0 0,0 bottom,from(#222),to(#666));background:-moz-linear-gradient(#222,#666);background:linear-gradient(#222,#666);color:white;font-family:Helvetica,"Helvetica Neue",Arial,sans-serif;font-size:10px;font-weight:bold;text-align:center;border-radius:6px}#footer{color:#ddd;font-size:12px;font-weight:bold;margin-top:12px;text-align:right}#footer a{color:#eee;text-decoration:underline}#footer a:hover{color:#fff;text-decoration:none}.green{color:#090}.red{color:#900}.yellow{color:#da0}.blue{color:blue}thead th{background:white}.source_table .covered{border-color:#090}.source_table .missed{border-color:#900}.source_table .never{border-color:black}.source_table .skipped{border-color:#fc0}.source_table .missed-branch{border-color:#bf0000}.source_table .covered:nth-child(odd){background-color:#cdf2cd}.source_table .covered:nth-child(even){background-color:#dbf2db}.source_table .missed:nth-child(odd){background-color:#f7c0c0}.source_table .missed:nth-child(even){background-color:#f7cfcf}.source_table .never:nth-child(odd){background-color:#efefef}.source_table .never:nth-child(even){background-color:#f4f4f4}.source_table .skipped:nth-child(odd){background-color:#fbf0c0}.source_table .skipped:nth-child(even){background-color:#fbffcf}.source_table .missed-branch:nth-child(odd){background-color:#cc8e8e}.source_table .missed-branch:nth-child(even){background-color:#cc6e6e} \ No newline at end of file diff --git a/coverage/assets/0.12.3/application.js b/coverage/assets/0.12.3/application.js new file mode 100644 index 00000000..e1c2ab23 --- /dev/null +++ b/coverage/assets/0.12.3/application.js @@ -0,0 +1,7 @@ +!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(T,e){"use strict";function g(e,t,n){var r,a,i=(n=n||le).createElement("script");if(i.text=e,t)for(r in Se)(a=t[r]||t.getAttribute&&t.getAttribute(r))&&i.setAttribute(r,a);n.head.appendChild(i).parentNode.removeChild(i)}function m(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?pe[ge.call(e)]||"object":typeof e}function s(e){var t=!!e&&"length"in e&&e.length,n=m(e);return!we(e)&&!xe(e)&&("array"===n||0===t||"number"==typeof t&&0D.cacheLength&&delete n[r.shift()],n[e+" "]=t}var r=[];return n}function l(e){return e[q]=!0,e}function a(e){var t=E.createElement("fieldset");try{return!!e(t)}catch(n){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function t(e,t){for(var n=e.split("|"),r=n.length;r--;)D.attrHandle[n[r]]=t}function u(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(r)return r;if(n)for(;n=n.nextSibling;)if(n===t)return-1;return e?1:-1}function r(t){return function(e){return"input"===e.nodeName.toLowerCase()&&e.type===t}}function i(n){return function(e){var t=e.nodeName.toLowerCase();return("input"===t||"button"===t)&&e.type===n}}function o(t){return function(e){return"form"in e?e.parentNode&&!1===e.disabled?"label"in e?"label"in e.parentNode?e.parentNode.disabled===t:e.disabled===t:e.isDisabled===t||e.isDisabled!==!t&&_e(e)===t:e.disabled===t:"label"in e&&e.disabled===t}}function s(o){return l(function(i){return i=+i,l(function(e,t){for(var n,r=o([],e.length,i),a=r.length;a--;)e[n=r[a]]&&(e[n]=!(t[n]=e[n]))})})}function p(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}function c(){}function g(e){for(var t=0,n=e.length,r="";t+~]|"+re+")"+re+"*"),fe=new RegExp(re+"|>"),de=new RegExp(oe),he=new RegExp("^"+ae+"$"),pe={ID:new RegExp("^#("+ae+")"),CLASS:new RegExp("^\\.("+ae+")"),TAG:new RegExp("^("+ae+"|[*])"),ATTR:new RegExp("^"+ie),PSEUDO:new RegExp("^"+oe),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+re+"*(even|odd|(([+-]|)(\\d*)n|)"+re+"*(?:([+-]|)"+re+"*(\\d+)|))"+re+"*\\)|)","i"),bool:new RegExp("^(?:"+ne+")$","i"),needsContext:new RegExp("^"+re+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+re+"*((?:-\\d)?\\d*)"+re+"*\\)|)(?=[^-]|$)","i")},ge=/HTML$/i,me=/^(?:input|select|textarea|button)$/i,ve=/^h\d$/i,ye=/^[^{]+\{\s*\[native \w/,be=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,we=/[+~]/,xe=new RegExp("\\\\([\\da-f]{1,6}"+re+"?|("+re+")|.)","ig"),Se=function(e,t,n){var r="0x"+t-65536;return r!=r||n?t:r<0?String.fromCharCode(r+65536):String.fromCharCode(r>>10|55296,1023&r|56320)},De=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,Te=function(e,t){return t?"\0"===e?"\ufffd":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},Ce=function(){L()},_e=f(function(e){return!0===e.disabled&&"fieldset"===e.nodeName.toLowerCase()},{dir:"parentNode",next:"legend"});try{Q.apply(Y=ee.call(W.childNodes),W.childNodes),Y[W.childNodes.length].nodeType}catch(Ae){Q={apply:Y.length?function(e,t){K.apply(e,ee.call(t))}:function(e,t){for(var n=e.length,r=0;e[n++]=t[r++];);e.length=n-1}}}for(v in S=w.support={},C=w.isXML=function(e){var t=e.namespaceURI,n=(e.ownerDocument||e).documentElement;return!ge.test(t||n&&n.nodeName||"HTML")},L=w.setDocument=function(e){var t,n,r=e?e.ownerDocument||e:W;return r!==E&&9===r.nodeType&&r.documentElement&&(R=(E=r).documentElement,F=!C(E),W!==E&&(n=E.defaultView)&&n.top!==n&&(n.addEventListener?n.addEventListener("unload",Ce,!1):n.attachEvent&&n.attachEvent("onunload",Ce)),S.attributes=a(function(e){return e.className="i",!e.getAttribute("className")}),S.getElementsByTagName=a(function(e){return e.appendChild(E.createComment("")),!e.getElementsByTagName("*").length}),S.getElementsByClassName=ye.test(E.getElementsByClassName),S.getById=a(function(e){return R.appendChild(e).id=q,!E.getElementsByName||!E.getElementsByName(q).length}),S.getById?(D.filter.ID=function(e){var t=e.replace(xe,Se);return function(e){return e.getAttribute("id")===t}},D.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&F){var n=t.getElementById(e);return n?[n]:[]}}):(D.filter.ID=function(e){var n=e.replace(xe,Se);return function(e){var t="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return t&&t.value===n}},D.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&F){var n,r,a,i=t.getElementById(e);if(i){if((n=i.getAttributeNode("id"))&&n.value===e)return[i];for(a=t.getElementsByName(e),r=0;i=a[r++];)if((n=i.getAttributeNode("id"))&&n.value===e)return[i]}return[]}}),D.find.TAG=S.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):S.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],a=0,i=t.getElementsByTagName(e);if("*"!==e)return i;for(;n=i[a++];)1===n.nodeType&&r.push(n);return r},D.find.CLASS=S.getElementsByClassName&&function(e,t){if("undefined"!=typeof t.getElementsByClassName&&F)return t.getElementsByClassName(e)},H=[],P=[],(S.qsa=ye.test(E.querySelectorAll))&&(a(function(e){R.appendChild(e).innerHTML="",e.querySelectorAll("[msallowcapture^='']").length&&P.push("[*^$]="+re+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||P.push("\\["+re+"*(?:value|"+ne+")"),e.querySelectorAll("[id~="+q+"-]").length||P.push("~="),e.querySelectorAll(":checked").length||P.push(":checked"),e.querySelectorAll("a#"+q+"+*").length||P.push(".#.+[+~]")}),a(function(e){e.innerHTML="";var t=E.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&P.push("name"+re+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&P.push(":enabled",":disabled"),R.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&P.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),P.push(",.*:")})),(S.matchesSelector=ye.test(M=R.matches||R.webkitMatchesSelector||R.mozMatchesSelector||R.oMatchesSelector||R.msMatchesSelector))&&a(function(e){S.disconnectedMatch=M.call(e,"*"),M.call(e,"[s!='']:x"),H.push("!=",oe)}),P=P.length&&new RegExp(P.join("|")),H=H.length&&new RegExp(H.join("|")),t=ye.test(R.compareDocumentPosition),O=t||ye.test(R.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)for(;t=t.parentNode;)if(t===e)return!0;return!1},G=t?function(e,t){if(e===t)return j=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n||(1&(n=(e.ownerDocument||e)===(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!S.sortDetached&&t.compareDocumentPosition(e)===n?e===E||e.ownerDocument===W&&O(W,e)?-1:t===E||t.ownerDocument===W&&O(W,t)?1:I?te(I,e)-te(I,t):0:4&n?-1:1)}:function(e,t){if(e===t)return j=!0,0;var n,r=0,a=e.parentNode,i=t.parentNode,o=[e],s=[t];if(!a||!i)return e===E?-1:t===E?1:a?-1:i?1:I?te(I,e)-te(I,t):0;if(a===i)return u(e,t);for(n=e;n=n.parentNode;)o.unshift(n);for(n=t;n=n.parentNode;)s.unshift(n);for(;o[r]===s[r];)r++;return r?u(o[r],s[r]):o[r]===W?-1:s[r]===W?1:0}),E},w.matches=function(e,t){return w(e,null,null,t)},w.matchesSelector=function(e,t){if((e.ownerDocument||e)!==E&&L(e),S.matchesSelector&&F&&!V[t+" "]&&(!H||!H.test(t))&&(!P||!P.test(t)))try{var n=M.call(e,t);if(n||S.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(Ae){V(t,!0)}return 0":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(xe,Se),e[3]=(e[3]||e[4]||e[5]||"").replace(xe,Se),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||w.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&w.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return pe.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&de.test(n)&&(t=_(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(xe,Se).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=U[e+" "];return t||(t=new RegExp("(^|"+re+")"+e+"("+re+"|$)"))&&U(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(n,r,a){return function(e){var t=w.attr(e,n);return null==t?"!="===r:!r||(t+="","="===r?t===a:"!="===r?t!==a:"^="===r?a&&0===t.indexOf(a):"*="===r?a&&-1:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;Te.filter=function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?Te.find.matchesSelector(r,e)?[r]:[]:Te.find.matches(e,Te.grep(t,function(e){return 1===e.nodeType}))},Te.fn.extend({find:function(e){var t,n,r=this.length,a=this;if("string"!=typeof e)return this.pushStack(Te(e).filter(function(){for(t=0;t)[^>]*|#([\w-]+))$/;(Te.fn.init=function(e,t,n){var r,a;if(!e)return this;if(n=n||je,"string"!=typeof e)return e.nodeType?(this[0]=e,this.length=1,this):we(e)?n.ready!==undefined?n.ready(e):e(Te):Te.makeArray(e,this);if(!(r="<"===e[0]&&">"===e[e.length-1]&&3<=e.length?[null,e,null]:Le.exec(e))||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof Te?t[0]:t,Te.merge(this,Te.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:le,!0)),Ie.test(r[1])&&Te.isPlainObject(t))for(r in t)we(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return(a=le.getElementById(r[2]))&&(this[0]=a,this.length=1),this}).prototype=Te.fn,je=Te(le);var Ee=/^(?:parents|prev(?:Until|All))/,Re={children:!0,contents:!0,next:!0,prev:!0};Te.fn.extend({has:function(e){var t=Te(e,this),n=t.length;return this.filter(function(){for(var e=0;e\x20\t\r\n\f]*)/i,rt=/^$|^module$|\/(?:java|ecma)script/i,at={option:[1,""],thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};at.optgroup=at.option,at.tbody=at.tfoot=at.colgroup=at.caption=at.thead,at.th=at.td;var it,ot,st=/<|&#?\w+;/;it=le.createDocumentFragment().appendChild(le.createElement("div")),(ot=le.createElement("input")).setAttribute("type","radio"),ot.setAttribute("checked","checked"),ot.setAttribute("name","t"),it.appendChild(ot),be.checkClone=it.cloneNode(!0).cloneNode(!0).lastChild.checked,it.innerHTML="",be.noCloneChecked=!!it.cloneNode(!0).lastChild.defaultValue;var lt=/^key/,ut=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,ct=/^([^.]*)(?:\.(.+)|)/;Te.event={global:{},add:function(t,e,n,r,a){var i,o,s,l,u,c,f,d,h,p,g,m=Be.get(t);if(m)for(n.handler&&(n=(i=n).handler,a=i.selector),a&&Te.find.matchesSelector(Je,a),n.guid||(n.guid=Te.guid++),(l=m.events)||(l=m.events={}),(o=m.handle)||(o=m.handle=function(e){return void 0!==Te&&Te.event.triggered!==e.type?Te.event.dispatch.apply(t,arguments):undefined}),u=(e=(e||"").match(Fe)||[""]).length;u--;)h=g=(s=ct.exec(e[u])||[])[1],p=(s[2]||"").split(".").sort(),h&&(f=Te.event.special[h]||{},h=(a?f.delegateType:f.bindType)||h,f=Te.event.special[h]||{},c=Te.extend({type:h,origType:g,data:r,handler:n,guid:n.guid,selector:a,needsContext:a&&Te.expr.match.needsContext.test(a),namespace:p.join(".")},i),(d=l[h])||((d=l[h]=[]).delegateCount=0,f.setup&&!1!==f.setup.call(t,r,p,o)||t.addEventListener&&t.addEventListener(h,o)),f.add&&(f.add.call(t,c),c.handler.guid||(c.handler.guid=n.guid)),a?d.splice(d.delegateCount++,0,c):d.push(c),Te.event.global[h]=!0)},remove:function(e,t,n,r,a){var i,o,s,l,u,c,f,d,h,p,g,m=Be.hasData(e)&&Be.get(e);if(m&&(l=m.events)){for(u=(t=(t||"").match(Fe)||[""]).length;u--;)if(h=g=(s=ct.exec(t[u])||[])[1],p=(s[2]||"").split(".").sort(),h){for(f=Te.event.special[h]||{},d=l[h=(r?f.delegateType:f.bindType)||h]||[],s=s[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),o=i=d.length;i--;)c=d[i],!a&&g!==c.origType||n&&n.guid!==c.guid||s&&!s.test(c.namespace)||r&&r!==c.selector&&("**"!==r||!c.selector)||(d.splice(i,1),c.selector&&d.delegateCount--,f.remove&&f.remove.call(e,c));o&&!d.length&&(f.teardown&&!1!==f.teardown.call(e,p,m.handle)||Te.removeEvent(e,h,m.handle),delete l[h])}else for(h in l)Te.event.remove(e,h+t[u],n,r,!0);Te.isEmptyObject(l)&&Be.remove(e,"handle events")}},dispatch:function(e){var t,n,r,a,i,o,s=Te.event.fix(e),l=new Array(arguments.length),u=(Be.get(this,"events")||{})[s.type]||[],c=Te.event.special[s.type]||{};for(l[0]=s,t=1;t\x20\t\r\n\f]*)[^>]*)\/>/gi,dt=/\s*$/g;Te.extend({htmlPrefilter:function(e){return e.replace(ft,"<$1>")},clone:function(e,t,n){var r,a,i,o,s=e.cloneNode(!0),l=Ye(e);if(!(be.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||Te.isXMLDoc(e)))for(o=w(s),r=0,a=(i=w(e)).length;r").attr(n.scriptAttrs||{}).prop({charset:n.scriptCharset,src:n.url}).on("load error",a=function(e){r.remove(),a=null,e&&t("error"===e.type?404:200,e.type)}),le.head.appendChild(r[0])},abort:function(){a&&a()}}});var an,on=[],sn=/(=)\?(?=&|$)|\?\?/;Te.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=on.pop()||Te.expando+"_"+Ot++;return this[e]=!0,e}}),Te.ajaxPrefilter("json jsonp",function(e,t,n){var r,a,i,o=!1!==e.jsonp&&(sn.test(e.url)?"url":"string"==typeof e.data&&0===(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&sn.test(e.data)&&"data");if(o||"jsonp"===e.dataTypes[0])return r=e.jsonpCallback=we(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,o?e[o]=e[o].replace(sn,"$1"+r):!1!==e.jsonp&&(e.url+=(qt.test(e.url)?"&":"?")+e.jsonp+"="+r),e.converters["script json"]=function(){return i||Te.error(r+" was not called"),i[0]},e.dataTypes[0]="json",a=T[r],T[r]=function(){i=arguments},n.always(function(){a===undefined?Te(T).removeProp(r):T[r]=a,e[r]&&(e.jsonpCallback=t.jsonpCallback,on.push(r)),i&&we(a)&&a(i[0]),i=a=undefined}),"script"}),be.createHTMLDocument=((an=le.implementation.createHTMLDocument("").body).innerHTML="
",2===an.childNodes.length),Te.parseHTML=function(e,t,n){return"string"!=typeof e?[]:("boolean"==typeof t&&(n=t,t=!1),t||(be.createHTMLDocument?((r=(t=le.implementation.createHTMLDocument("")).createElement("base")).href=le.location.href,t.head.appendChild(r)):t=le),i=!n&&[],(a=Ie.exec(e))?[t.createElement(a[1])]:(a=S([e],t,i),i&&i.length&&Te(i).remove(),Te.merge([],a.childNodes)));var r,a,i},Te.fn.load=function(e,t,n){var r,a,i,o=this,s=e.indexOf(" ");return-1").append(Te.parseHTML(e)).find(r):e)}).always(n&&function(e,t){o.each(function(){n.apply(this,i||[e.responseText,t,e])})}),this},Te.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){Te.fn[t]=function(e){return this.on(t,e)}}),Te.expr.pseudos.animated=function(t){return Te.grep(Te.timers,function(e){return t===e.elem}).length},Te.offset={setOffset:function(e,t,n){var r,a,i,o,s,l,u=Te.css(e,"position"),c=Te(e),f={};"static"===u&&(e.style.position="relative"),s=c.offset(),i=Te.css(e,"top"),l=Te.css(e,"left"),("absolute"===u||"fixed"===u)&&-1<(i+l).indexOf("auto")?(o=(r=c.position()).top,a=r.left):(o=parseFloat(i)||0,a=parseFloat(l)||0),we(t)&&(t=t.call(e,n,Te.extend({},s))),null!=t.top&&(f.top=t.top-s.top+o),null!=t.left&&(f.left=t.left-s.left+a),"using"in t?t.using.call(e,f):c.css(f)}},Te.fn.extend({offset:function(t){if(arguments.length)return t===undefined?this:this.each(function(e){Te.offset.setOffset(this,t,e)});var e,n,r=this[0];return r?r.getClientRects().length?(e=r.getBoundingClientRect(),n=r.ownerDocument.defaultView,{top:e.top+n.pageYOffset,left:e.left+n.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var e,t,n,r=this[0],a={top:0,left:0};if("fixed"===Te.css(r,"position"))t=r.getBoundingClientRect();else{for(t=this.offset(),n=r.ownerDocument,e=r.offsetParent||n.documentElement;e&&(e===n.body||e===n.documentElement)&&"static"===Te.css(e,"position");)e=e.parentNode;e&&e!==r&&1===e.nodeType&&((a=Te(e).offset()).top+=Te.css(e,"borderTopWidth",!0),a.left+=Te.css(e,"borderLeftWidth",!0))}return{top:t.top-a.top-Te.css(r,"marginTop",!0),left:t.left-a.left-Te.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){for(var e=this.offsetParent;e&&"static"===Te.css(e,"position");)e=e.offsetParent;return e||Je})}}),Te.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,a){var i="pageYOffset"===a;Te.fn[t]=function(e){return Me(this,function(e,t,n){var r;if(xe(e)?r=e:9===e.nodeType&&(r=e.defaultView),n===undefined)return r?r[a]:e[t];r?r.scrollTo(i?r.pageXOffset:n,i?n:r.pageYOffset):e[t]=n},t,e,arguments.length)}}),Te.each(["top","left"],function(e,n){Te.cssHooks[n]=M(be.pixelPosition,function(e,t){if(t)return t=H(e,n),gt.test(t)?Te(e).position()[n]+"px":t})}),Te.each({Height:"height",Width:"width"},function(o,s){Te.each({padding:"inner"+o,content:s,"":"outer"+o},function(r,i){Te.fn[i]=function(e,t){var n=arguments.length&&(r||"boolean"!=typeof e),a=r||(!0===e||!0===t?"margin":"border");return Me(this,function(e,t,n){var r;return xe(e)?0===i.indexOf("outer")?e["inner"+o]:e.document.documentElement["client"+o]:9===e.nodeType?(r=e.documentElement,Math.max(e.body["scroll"+o],r["scroll"+o],e.body["offset"+o],r["offset"+o],r["client"+o])):n===undefined?Te.css(e,t,a):Te.style(e,t,n,a)},s,n?e:undefined,n)}})}),Te.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,n){Te.fn[n]=function(e,t){return 0"}for(var i=0,o="",s=[];e.length||t.length;){var l=r().splice(0,1)[0];if(o+=x(n.substr(i,l.offset-i)),i=l.offset,"start"==l.event)o+=a(l.node),s.push(l.node);else if("stop"==l.event){var u=s.length;do{var c=s[--u];o+=""}while(c!=l.node);for(s.splice(u,1);u'+x(a[0])+""):n+=x(a[0]),r=t.lR.lastIndex,a=t.lR.exec(e)}return n+=x(e.substr(r,e.length-r))}function f(e,t){if(t.sL&&T[t.sL]){var n=D(t.sL,e);return g+=n.keyword_count,n.value}return r(e,t)}function d(e,t){var n=e.cN?'':"";e.rB?(m+=n,e.buffer=""):e.eB?(m+=x(t)+n,e.buffer=""):(m+=n,e.buffer=t),h.push(e),p+=e.r}function i(e,t,n){var r=h[h.length-1];if(n)return m+=f(r.buffer+e,r),!1;var a=l(t,r);if(a)return m+=f(r.buffer+e,r),d(a,t),a.rB;var i=u(h.length-1,t);if(i){var o=r.cN?"":"";for(r.rE?m+=f(r.buffer+e,r)+o:r.eE?m+=f(r.buffer+e,r)+o+x(t):m+=f(r.buffer+e+t,r)+o;1":"",m+=o,i--,h.length--;var s=h[h.length-1];return h.length--,h[h.length-1].buffer="",s.starts&&d(s.starts,""),r.rE}if(c(t,r))throw"Illegal"}var s=T[e],h=[s.dM],p=0,g=0,m="";try{var v=0;s.dM.buffer="";do{var y=n(t,v),b=i(y[0],y[1],y[2]);v+=y[0].length,b||(v+=y[1].length)}while(!y[2]);if(1o.keyword_count+o.r&&(o=l),l.keyword_count+l.r>i.keyword_count+i.r&&(o=i,i=l)}}var u=e.className;u.match(i.language)||(u=u?u+" "+i.language:i.language);var c=g(e);if(c.length)(f=document.createElement("pre")).innerHTML=i.value,i.value=m(c,g(f),r);if(n&&(i.value=i.value.replace(/^((<[^>]+>|\t)+)/gm,function(e,t){return t.replace(/\t/g,n)})),t&&(i.value=i.value.replace(/\n/g,"
")),/MSIE [678]/.test(navigator.userAgent)&&"CODE"==e.tagName&&"PRE"==e.parentNode.tagName){var f=e.parentNode,d=document.createElement("div");d.innerHTML="
"+i.value+"
",e=d.firstChild.firstChild,d.firstChild.cN=f.cN,f.parentNode.replaceChild(d.firstChild,f)}else e.innerHTML=i.value;e.className=u,e.dataset={},e.dataset.result={language:i.language,kw:i.keyword_count,re:i.r},o&&o.language&&(e.dataset.second_best={language:o.language,kw:o.keyword_count,re:o.r})}}function i(){if(!i.called){i.called=!0,v();for(var e=document.getElementsByTagName("pre"),t=0;t|>=|>>|>>=|>>>|>>>=|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",this.BE={b:"\\\\.",r:0},this.ASM={cN:"string",b:"'",e:"'",i:"\\n",c:[this.BE],r:0},this.QSM={cN:"string",b:'"',e:'"',i:"\\n",c:[this.BE],r:0},this.CLCM={cN:"comment",b:"//",e:"$"},this.CBLCLM={cN:"comment",b:"/\\*",e:"\\*/"},this.HCM={cN:"comment",b:"#",e:"$"},this.NM={cN:"number",b:this.NR,r:0},this.CNM={cN:"number",b:this.CNR,r:0},this.inherit=function(e,t){var n={};for(var r in e)n[r]=e[r];if(t)for(var r in t)n[r]=t[r];return n}};hljs.LANGUAGES.ruby=function(){var e="[a-zA-Z_][a-zA-Z0-9_]*(\\!|\\?)?",t="[a-zA-Z_]\\w*[!?=]?|[-+~]\\@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?",n={keyword:{and:1,"false":1,then:1,defined:1,module:1,"in":1,"return":1,redo:1,"if":1,BEGIN:1,retry:1,end:1,"for":1,"true":1,self:1,when:1,next:1,until:1,"do":1,begin:1,unless:1,END:1,rescue:1,nil:1,"else":1,"break":1,undef:1,not:1,"super":1,"class":1,"case":1,require:1,"yield":1,alias:1,"while":1,ensure:1,elsif:1,or:1,def:1},keymethods:{__id__:1,__send__:1,abort:1,abs:1,"all?":1,allocate:1,ancestors:1,"any?":1,arity:1,assoc:1,at:1,at_exit:1,autoload:1,"autoload?":1,"between?":1,binding:1,binmode:1,"block_given?":1,call:1,callcc:1,caller:1,capitalize:1,"capitalize!":1,casecmp:1,"catch":1,ceil:1,center:1,chomp:1,"chomp!":1,chop:1,"chop!":1,chr:1,"class":1,class_eval:1,"class_variable_defined?":1,class_variables:1,clear:1,clone:1,close:1,close_read:1,close_write:1,"closed?":1,coerce:1,collect:1,"collect!":1,compact:1,"compact!":1,concat:1,"const_defined?":1,const_get:1,const_missing:1,const_set:1,constants:1,count:1,crypt:1,"default":1,default_proc:1,"delete":1,"delete!":1,delete_at:1,delete_if:1,detect:1,display:1,div:1,divmod:1,downcase:1,"downcase!":1,downto:1,dump:1,dup:1,each:1,each_byte:1,each_index:1,each_key:1,each_line:1,each_pair:1,each_value:1,each_with_index:1,"empty?":1,entries:1,eof:1,"eof?":1,"eql?":1,"equal?":1,eval:1,exec:1,exit:1,"exit!":1,extend:1,fail:1,fcntl:1,fetch:1,fileno:1,fill:1,find:1,find_all:1,first:1,flatten:1,"flatten!":1,floor:1,flush:1,for_fd:1,foreach:1,fork:1,format:1,freeze:1,"frozen?":1,fsync:1,getc:1,gets:1,global_variables:1,grep:1,gsub:1,"gsub!":1,"has_key?":1,"has_value?":1,hash:1,hex:1,id:1,include:1,"include?":1,included_modules:1,index:1,indexes:1,indices:1,induced_from:1,inject:1,insert:1,inspect:1,instance_eval:1,instance_method:1,instance_methods:1,"instance_of?":1,"instance_variable_defined?":1,instance_variable_get:1,instance_variable_set:1,instance_variables:1,"integer?":1,intern:1,invert:1,ioctl:1,"is_a?":1,isatty:1,"iterator?":1,join:1,"key?":1,keys:1,"kind_of?":1,lambda:1,last:1,length:1,lineno:1,ljust:1,load:1,local_variables:1,loop:1,lstrip:1,"lstrip!":1,map:1,"map!":1,match:1,max:1,"member?":1,merge:1,"merge!":1,method:1,"method_defined?":1,method_missing:1,methods:1,min:1,module_eval:1,modulo:1,name:1,nesting:1,"new":1,next:1,"next!":1,"nil?":1,nitems:1,"nonzero?":1,object_id:1,oct:1,open:1,pack:1,partition:1,pid:1,pipe:1,pop:1,popen:1,pos:1,prec:1,prec_f:1,prec_i:1,print:1,printf:1,private_class_method:1,private_instance_methods:1,"private_method_defined?":1,private_methods:1,proc:1,protected_instance_methods:1, +"protected_method_defined?":1,protected_methods:1,public_class_method:1,public_instance_methods:1,"public_method_defined?":1,public_methods:1,push:1,putc:1,puts:1,quo:1,raise:1,rand:1,rassoc:1,read:1,read_nonblock:1,readchar:1,readline:1,readlines:1,readpartial:1,rehash:1,reject:1,"reject!":1,remainder:1,reopen:1,replace:1,require:1,"respond_to?":1,reverse:1,"reverse!":1,reverse_each:1,rewind:1,rindex:1,rjust:1,round:1,rstrip:1,"rstrip!":1,scan:1,seek:1,select:1,send:1,set_trace_func:1,shift:1,singleton_method_added:1,singleton_methods:1,size:1,sleep:1,slice:1,"slice!":1,sort:1,"sort!":1,sort_by:1,split:1,sprintf:1,squeeze:1,"squeeze!":1,srand:1,stat:1,step:1,store:1,strip:1,"strip!":1,sub:1,"sub!":1,succ:1,"succ!":1,sum:1,superclass:1,swapcase:1,"swapcase!":1,sync:1,syscall:1,sysopen:1,sysread:1,sysseek:1,system:1,syswrite:1,taint:1,"tainted?":1,tell:1,test:1,"throw":1,times:1,to_a:1,to_ary:1,to_f:1,to_hash:1,to_i:1,to_int:1,to_io:1,to_proc:1,to_s:1,to_str:1,to_sym:1,tr:1,"tr!":1,tr_s:1,"tr_s!":1,trace_var:1,transpose:1,trap:1,truncate:1,"tty?":1,type:1,ungetc:1,uniq:1,"uniq!":1,unpack:1,unshift:1,untaint:1,untrace_var:1,upcase:1,"upcase!":1,update:1,upto:1,"value?":1,values:1,values_at:1,warn:1,write:1,write_nonblock:1,"zero?":1,zip:1}},r={cN:"yardoctag",b:"@[A-Za-z]+"},a={cN:"comment",b:"#",e:"$",c:[r]},i={cN:"comment",b:"^\\=begin",e:"^\\=end",c:[r],r:10},o={cN:"comment",b:"^__END__",e:"\\n$"},s={cN:"subst",b:"#\\{",e:"}",l:e,k:n},l=[hljs.BE,s],u={cN:"string",b:"'",e:"'",c:l,r:0},c={cN:"string",b:'"',e:'"',c:l,r:0},f={cN:"string",b:"%[qw]?\\(",e:"\\)",c:l,r:10},d={cN:"string",b:"%[qw]?\\[",e:"\\]",c:l,r:10},h={cN:"string",b:"%[qw]?{",e:"}",c:l,r:10},p={cN:"string",b:"%[qw]?<",e:">",c:l,r:10},g={cN:"string",b:"%[qw]?/",e:"/",c:l,r:10},m={cN:"string",b:"%[qw]?%",e:"%",c:l,r:10},v={cN:"string",b:"%[qw]?-",e:"-",c:l,r:10},y={cN:"string",b:"%[qw]?\\|",e:"\\|",c:l,r:10},b={cN:"function",b:"\\bdef\\s+",e:" |$|;",l:e,k:n,c:[{cN:"title",b:t,l:e,k:n},{cN:"params",b:"\\(",e:"\\)",l:e,k:n},a,i,o]},w={cN:"identifier",b:e,l:e,k:n,r:0},x=[a,i,o,u,c,f,d,h,p,g,m,v,y,{cN:"class",b:"\\b(class|module)\\b",e:"$|;",k:{"class":1,module:1},c:[{cN:"title",b:"[A-Za-z_]\\w*(::\\w+)*(\\?|\\!)?",r:0},{cN:"inheritance",b:"<\\s*",c:[{cN:"parent",b:"("+hljs.IR+"::)?"+hljs.IR}]},a,i,o]},b,{cN:"constant",b:"(::)?([A-Z]\\w*(::)?)+",r:0},{cN:"symbol",b:":",c:[u,c,f,d,h,p,g,m,v,y,w],r:0},{cN:"number",b:"(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b",r:0},{cN:"number",b:"\\?\\w"},{cN:"variable",b:"(\\$\\W)|((\\$|\\@\\@?)(\\w+))"},w,{b:"("+hljs.RSR+")\\s*",c:[a,i,o,{cN:"regexp",b:"/",e:"/[a-z]*",i:"\\n",c:[hljs.BE]}],r:0}];return s.c=x,{dM:{l:e,k:n,c:b.c[1].c=x}}}(),function(c,s,o){function l(e,t,n){var r=s.createElement(e);return t&&(r.id=te+t),n&&(r.style.cssText=n),c(r)}function f(){return o.innerHeight?o.innerHeight:c(o).height()}function u(e,n){n!==Object(n)&&(n={}),this.cache={},this.el=e,this.value=function(e){var t;return this.cache[e]===undefined&&((t=c(this.el).attr("data-cbox-"+e))!==undefined?this.cache[e]=t:n[e]!==undefined?this.cache[e]=n[e]:Q[e]!==undefined&&(this.cache[e]=Q[e])),this.cache[e]},this.get=function(e){var t=this.value(e);return c.isFunction(t)?t.call(this.el,this):t}}function i(e){var t=k.length,n=(X+e)%t;return n<0?t+n:n}function d(e,t){return Math.round((/%/.test(e)?("x"===t?I.width():f())/100:1)*parseInt(e,10))}function h(e,t){return e.get("photo")||e.get("photoRegex").test(t)}function p(e,t){return e.get("retinaUrl")&&1"),w()}}function a(){S||(t=!1,I=c(o),S=l(ce).attr({id:ee,"class":!1===c.support.opacity?te+"IE":"",role:"dialog",tabindex:"-1"}).hide(),x=l(ce,"Overlay").hide(),E=c([l(ce,"LoadingOverlay")[0],l(ce,"LoadingGraphic")[0]]),D=l(ce,"Wrapper"),T=l(ce,"Content").append(R=l(ce,"Title"),F=l(ce,"Current"),M=c('
-
  • - 2 +
  • + - render :new + # POST /comments.
  • @@ -1458,7 +1450,7 @@

    - end + # Cria um comentário no banco de dados.

    @@ -1471,7 +1463,7 @@

    - end + # Método para a criação do comentário que faz a ligação da existencia desse comentário com uma Wikientry já criada, pois sem isso o comentário não pode existir.

    @@ -1484,7 +1476,7 @@

    - + # Recebe como parâmetro um texto . @@ -1497,20 +1489,20 @@

    - # PATCH/PUT /comments/1 + # Verifica se o comentario pode ser salvo e se sim renderiza a página da entry a qual o comentário pertence, caso contrário, retorna um erro.
    -
  • - +
  • + 1 - # PATCH/PUT /comments/1.json + def create
  • @@ -1523,80 +1515,80 @@

    - def update + @comment = WikiComment.new(comment_params.merge({entry: @entry}))
    -
  • - +
  • + 2 + + then: 1 + + - #Método que permite a atualização de um comentário. Esse método não está sendo utilizado no momento. + if @comment.save
  • -
  • - 3 +
  • + 1 - - then: 2 - - - if @comment.update(comment_params) + redirect_to @comment.entry, notice:'Comentário foi criado com sucesso.'
  • -
  • - 2 +
  • + + + else: 1 + + - redirect_to @comment.entry, notice: 'Comentário foi editado com sucesso.' + else
  • -
  • - +
  • + 1 - - else: 1 - - - else + render :new
  • -
  • - 1 +
  • + - render :edit + end
  • @@ -1609,7 +1601,7 @@

    - end + end @@ -1622,7 +1614,7 @@

    - end + @@ -1635,7 +1627,7 @@

    - + ## @@ -1648,7 +1640,7 @@

    - # DELETE /comments/1 + # PATCH/PUT /comments/1. @@ -1661,51 +1653,55 @@

    - # DELETE /comments/1.json + # Edita um comentário.
    -
  • - 2 +
  • + - def destroy + # Método que permite a atualização de um comentário. Esse método não está sendo utilizado no momento.
  • -
  • - 2 +
  • + 1 - @comment.destroy + def update
  • -
  • - 2 +
  • + + + then: 0 + + - redirect_to @comment.entry, notice: 'Comentário foi excluído com sucesso.' + if @comment.update(comment_params)
  • -
  • +
  • @@ -1713,33 +1709,37 @@

    - end + redirect_to @comment.entry, notice: 'Comentário foi editado com sucesso.'

  • -
  • +
  • + + else: 0 + + - + else
  • -
  • - 2 +
  • + - private + render :edit
  • @@ -1752,20 +1752,20 @@

    - # Use callbacks to share common setup or constraints between actions. + end
    -
  • - 2 +
  • + - def set_comment + end
  • @@ -1778,20 +1778,20 @@

    - #Método para localizar o comentário com a id específica +
    -
  • - 7 +
  • + - @comment = WikiComment.find(params[:id]) + ##
  • @@ -1804,7 +1804,7 @@

    - end + # DELETE /comments/1. @@ -1817,7 +1817,7 @@

    - + # Apaga um comentário do banco de dados. @@ -1830,25 +1830,25 @@

    - + # Método que permite apagar comentário e redireciona para a página de entrada com uma mensagem de sucesso.
    -
  • - 2 +
  • + 1 - def set_entry + def destroy
  • -
  • +
  • @@ -1856,20 +1856,20 @@

    - #método para localizar a WikiEntry a qual o comentário pertence e ele é chamado antes das ações index, new e create dos comentários para que seja possível recupera-los ou setá-los em relação as devidas WikiEntries + @comment.destroy

  • -
  • - 9 +
  • + - @entry = WikiEntry.find(params[:wiki_entry_id]) + redirect_to @comment.entry, notice: 'Comentário foi excluído com sucesso.'
  • @@ -1882,7 +1882,7 @@

    - end + end @@ -1900,28 +1900,28 @@

    -
  • - +
  • + 1 - # Never trust parameters from the scary internet, only allow the white list through. + private
  • -
  • - 2 +
  • + - def comment_params + ##
  • @@ -1934,13 +1934,195 @@

    - #Parametros permitidos a um comentário + # Use callbacks to share common setup or constraints between actions.
    -
  • - 8 +
  • + + + + + + + + # Método para localizar o comentário com a id específica +
  • +
    + +
    +
  • + 1 + + + + + + + def set_comment +
  • +
    + +
    +
  • + + + + + + + + @comment = WikiComment.find(params[:id]) +
  • +
    + +
    +
  • + + + + + + + + end +
  • +
    + +
    +
  • + + + + + + + + +
  • +
    + +
    +
  • + + + + + + + + # Método para localizar a WikiEntry a qual o comentário pertence e ele é chamado antes das ações index, new e create dos comentários para que seja possível recupera-los ou setá-los em relação as devidas WikiEntries +
  • +
    + +
    +
  • + 1 + + + + + + + def set_entry +
  • +
    + +
    +
  • + 4 + + + + + + + @entry = WikiEntry.find(params[:wiki_entry_id]) +
  • +
    + +
    +
  • + + + + + + + + end +
  • +
    + +
    +
  • + + + + + + + + +
  • +
    + +
    +
  • + + + + + + + + ## +
  • +
    + +
    +
  • + + + + + + + + # Never trust parameters from the scary internet, only allow the white list through. +
  • +
    + +
    +
  • + + + + + + + + # Parametros permitidos a um comentário +
  • +
    + +
    +
  • + 1 + + + + + + + def comment_params +
  • +
    + +
    +
  • + 2 @@ -1952,7 +2134,7 @@

  • -
  • +
  • @@ -1965,7 +2147,7 @@

  • -
  • +
  • @@ -1982,12 +2164,12 @@

  • -
    +

    app/controllers/wiki_entries_controller.rb

    - 100.0% + 92.0% lines covered @@ -2005,8 +2187,8 @@

    25 relevant lines. - 25 lines covered and - 0 lines missed. + 23 lines covered and + 2 lines missed.
    @@ -2023,8 +2205,34 @@

      -
    1. - 2 +
    2. + + + + + + + + ## +
    3. +
      + +
      +
    4. + + + + + + + + # Essa classe contém os métodos que manipulam as entradas da wiki de atendimento +
    5. +
      + +
      +
    6. + 1 @@ -2036,8 +2244,8 @@

    7. -
    8. - 2 +
    9. + 1 @@ -2049,7 +2257,7 @@

    10. -
    11. +
    12. @@ -2062,7 +2270,7 @@

    13. -
    14. +
    15. @@ -2070,12 +2278,12 @@

      - # GET /wikis + ##

    16. -
    17. +
    18. @@ -2083,39 +2291,52 @@

      - # GET /wikis.json + # GET /wikis.

    19. -
    20. - 2 +
    21. + - def index + # Pega todos as entradas da wiki.
    22. -
    23. +
    24. + + + + + + + # Método que mostra todas as entidades do tipo WikiEntry em uma lista e popula a página de index. +
    25. +
      + +
      +
    26. + 1 - #Método que mostra todas as entidades do tipo WikiEntry em uma lista e popula a página de index + def index
    27. -
    28. - 11 +
    29. + 10 @@ -2127,7 +2348,7 @@

    30. -
    31. +
    32. @@ -2140,7 +2361,7 @@

    33. -
    34. +
    35. @@ -2153,7 +2374,7 @@

    36. -
    37. +
    38. @@ -2161,12 +2382,12 @@

      - # GET /wikis/1 + ##

    39. -
    40. +
    41. @@ -2174,13 +2395,26 @@

      - # GET /wikis/1.json + # GET /wikis/1.

    42. -
    43. - 2 +
    44. + + + + + + + + # Mostra a view da entrada. +
    45. +
      + +
      +
    46. + 1 @@ -2192,7 +2426,7 @@

    47. -
    48. +
    49. @@ -2205,7 +2439,7 @@

    50. -
    51. +
    52. @@ -2218,7 +2452,7 @@

    53. -
    54. +
    55. @@ -2226,39 +2460,65 @@

      - # GET /wikis/new + ##

    56. -
    57. - 2 +
    58. + - def new + # GET /wikis/new.
    59. -
    60. +
    61. + + + + + + + + # Cria a entrada, mas não salva no banco de dados. +
    62. +
      + +
      +
    63. + + + + + + + # O método new cria a variável entry e faz a requisiçao http para o form de criação. +
    64. +
      + +
      +
    65. + 1 - #O método new cria a variável entry e faz a requisiçao http para o form de criação + def new
    66. -
    67. - 5 +
    68. + 4 @@ -2270,7 +2530,7 @@

    69. -
    70. +
    71. @@ -2283,7 +2543,7 @@

    72. -
    73. +
    74. @@ -2296,7 +2556,7 @@

    75. -
    76. +
    77. @@ -2304,13 +2564,26 @@

      - # GET /wikis/1/edit + ##

    78. -
    79. - 2 +
    80. + + + + + + + + # GET /wikis/1/edit. +
    81. +
      + +
      +
    82. + 1 @@ -2322,7 +2595,7 @@

    83. -
    84. +
    85. @@ -2335,7 +2608,7 @@

    86. -
    87. +
    88. @@ -2348,7 +2621,7 @@

    89. -
    90. +
    91. @@ -2356,12 +2629,12 @@

      - # POST /wikis + ##

    92. -
    93. +
    94. @@ -2369,25 +2642,25 @@

      - # POST /wikis.json + # POST /wikis.

    95. -
    96. - 2 +
    97. + - def create + # Cria uma entrada da wiki no banco de dados.
    98. -
    99. +
    100. @@ -2395,45 +2668,71 @@

      - #O Método create é chamado após preencher o form de criação e popula as informaçoes. + # O Método create é chamado após preencher o form de criação e popula as informaçoes.

    101. -
    102. - 7 +
    103. + - @entry= WikiEntry.new(entry_params) + # Se houver erros na hora da criação retorna um aviso de erros. Não preencher o título por exemplo causa um erro. De outra forma ele leva para a página de show e avisa que a página foi criada com sucesso.
    104. -
    105. +
    106. + + + + + + + # Recebe entry_params, que é constituído pelos campos título, conteúdo e documento. +
    107. +
      + +
      +
    108. + 1 - #Se houver erros na hora da criação retorna um aviso de erros. Não preencher o título por exemplo causa um erro. De outra forma ele leva para a página de show e avisa que a página foi criada com sucesso + def create
    109. -
    110. - 7 +
    111. + 4 - - then: 4 + + + @entry= WikiEntry.new(entry_params) +
    112. +
      + +
      +
    113. + 4 + + + + + + then: 2 @@ -2443,8 +2742,8 @@

    114. -
    115. - 4 +
    116. + 2 @@ -2456,14 +2755,14 @@

    117. -
    118. +
    119. - - else: 3 + + else: 2 @@ -2473,8 +2772,8 @@

    120. -
    121. - 3 +
    122. + 2 @@ -2486,7 +2785,7 @@

    123. -
    124. +
    125. @@ -2499,7 +2798,7 @@

    126. -
    127. +
    128. @@ -2507,12 +2806,12 @@

      - #end + end

    129. -
    130. +
    131. @@ -2520,12 +2819,12 @@

      - end +

    132. -
    133. +
    134. @@ -2533,12 +2832,12 @@

      - + ##

    135. -
    136. +
    137. @@ -2546,12 +2845,12 @@

      - # PATCH/PUT /wikis/1 + # PATCH/PUT /wikis/1.

    138. -
    139. +
    140. @@ -2559,45 +2858,58 @@

      - # PATCH/PUT /wikis/1.json + # Edita uma entrada e salva no banco de dados.

    141. -
    142. - 2 +
    143. + + + + + + + + # Utilizado para atualizar parte ou todos os campos da entity cuja id é passada pelo metodo http, similarmente à create ele retorna erros caso o objeto não possa ser criado. +
    144. +
      + +
      +
    145. + - def update + # Recebe entry_params, que é constituído pelos campos título, conteúdo e documento.
    146. -
    147. - +
    148. + 1 - #Utilizado para atualizar parte ou todos os campos da entity cuja id é passada pelo metodo http, similarmente à create ele retorna erros caso o objeto não possa ser criado + def update
    149. -
    150. - 7 +
    151. + 4 - - then: 4 + + then: 2 @@ -2607,27 +2919,27 @@

    152. -
    153. - 4 +
    154. + 2 - redirect_to @entry, notice: 'Página foi criada com sucesso!' + redirect_to @entry, notice: 'Página editada com sucesso!'
    155. -
    156. +
    157. - - else: 3 + + else: 2 @@ -2637,8 +2949,8 @@

    158. -
    159. - 3 +
    160. + 2 @@ -2650,7 +2962,7 @@

    161. -
    162. +
    163. @@ -2663,7 +2975,7 @@

    164. -
    165. +
    166. @@ -2676,7 +2988,7 @@

    167. -
    168. +
    169. @@ -2689,7 +3001,7 @@

    170. -
    171. +
    172. @@ -2697,12 +3009,12 @@

      - # DELETE /wikis/1 + ##

    173. -
    174. +
    175. @@ -2710,25 +3022,25 @@

      - # DELETE /wikis/1.jso + # DELETE /wikis/1.

    176. -
    177. - 2 +
    178. + - def destroy + # Apaga uma entrada do banco de dados.
    179. -
    180. +
    181. @@ -2736,13 +3048,26 @@

      - #método para excluir um objeto da tabela + # Método para excluir um objeto da tabela e redireciona para a página inicial com uma mensagem de sucesso.

    182. -
    183. - 2 +
    184. + 1 + + + + + + + def destroy +
    185. +
      + +
      +
    186. + @@ -2754,8 +3079,8 @@

    187. -
    188. - 2 +
    189. + @@ -2767,7 +3092,7 @@

    190. -
    191. +
    192. @@ -2780,7 +3105,7 @@

    193. -
    194. +
    195. @@ -2793,8 +3118,8 @@

    196. -
    197. - 2 +
    198. + 1 @@ -2806,7 +3131,7 @@

    199. -
    200. +
    201. @@ -2814,25 +3139,25 @@

      - # Use callbacks to share common setup or constraints between actions. + ##

    202. -
    203. - 2 +
    204. + - def set_entry + # Use callbacks to share common setup or constraints between actions.
    205. -
    206. +
    207. @@ -2840,13 +3165,26 @@

      - #Utilizado para localizar a Entry com a ID passada + # Utilizado para localizar a Entry com a ID passada

    208. -
    209. - 24 +
    210. + 1 + + + + + + + def set_entry +
    211. +
      + +
      +
    212. + 17 @@ -2858,7 +3196,7 @@

    213. -
    214. +
    215. @@ -2871,7 +3209,7 @@

    216. -
    217. +
    218. @@ -2884,7 +3222,7 @@

    219. -
    220. +
    221. @@ -2892,39 +3230,52 @@

      - # Never trust parameters from the scary internet, only allow the white list through. + ##

    222. -
    223. - 2 +
    224. + - def entry_params + # Never trust parameters from the scary internet, only allow the white list through.
    225. -
    226. +
    227. + + + + + + + # Definido os parametros permitidos na criação e edição do objeto. +
    228. +
      + +
      +
    229. + 1 - #definido os parametros permitidos na criação e edição do objeto + def entry_params
    230. -
    231. - 14 +
    232. + 8 @@ -2936,7 +3287,7 @@

    233. -
    234. +
    235. @@ -2949,7 +3300,7 @@

    236. -
    237. +
    238. @@ -2966,7 +3317,7 @@

    239. -
      +

      app/helpers/application_helper.rb

      @@ -3007,8 +3358,8 @@

        -
      1. - 2 +
      2. + 1 @@ -3037,7 +3388,7 @@

      3. -
        +

        app/helpers/comentarios_helper.rb

        @@ -3078,8 +3429,8 @@

          -
        1. - 2 +
        2. + 1 @@ -3108,7 +3459,7 @@

        3. -
          +

          app/helpers/home_helper.rb

          @@ -3149,8 +3500,8 @@

            -
          1. - 2 +
          2. + 1 @@ -3179,7 +3530,7 @@

          3. -
            +

            app/helpers/wikis_helper.rb

            @@ -3220,8 +3571,8 @@

              -
            1. - 2 +
            2. + 1 @@ -3250,7 +3601,7 @@

            3. -
              +

              app/models/application_record.rb

              @@ -3291,8 +3642,8 @@

                -
              1. - 2 +
              2. + 1 @@ -3304,8 +3655,8 @@

              3. -
              4. - 2 +
              5. + 1 @@ -3334,7 +3685,7 @@

              6. -
                +

                app/models/user.rb

                @@ -3396,13 +3747,26 @@

                - + ##

                -
              7. - 2 +
              8. + + + + + + + + # Essa classe valida os campos para a tabela de usuário do banco de dados +
              9. +
                + +
                +
              10. + 1 @@ -3414,8 +3778,8 @@

              11. -
              12. - 2 +
              13. + 1 @@ -3427,8 +3791,8 @@

              14. -
              15. - 2 +
              16. + 1 @@ -3440,7 +3804,7 @@

              17. -
              18. +
              19. @@ -3453,7 +3817,20 @@

              20. -
              21. +
              22. + + + + + + + + ## +
              23. +
                + +
                +
              24. @@ -3466,7 +3843,7 @@

              25. -
              26. +
              27. @@ -3479,8 +3856,8 @@

              28. -
              29. - 2 +
              30. + 1 @@ -3492,7 +3869,7 @@

              31. -
              32. +
              33. @@ -3505,7 +3882,7 @@

              34. -
              35. +
              36. @@ -3518,8 +3895,8 @@

              37. -
              38. - 2 +
              39. + 1 @@ -3531,7 +3908,7 @@

              40. -
              41. +
              42. @@ -3548,7 +3925,7 @@

              43. -
                +

                app/models/wiki_comment.rb

                @@ -3589,15 +3966,15 @@

                  -
                1. - 2 +
                2. + - class WikiComment < ApplicationRecord + ##
                3. @@ -3610,13 +3987,26 @@

                  - #Classe que cria os comentários pertencentes aos processos de Atendimento. Eles tem necessariamente que estar ligados à id de um WikiEntry e precisam ter um conteúdo + #Classe que cria os comentários pertencentes aos processos de Atendimento. Eles tem necessariamente que estar ligados à id de um WikiEntry e precisam ter um conteúdo

                -
              44. - 2 +
              45. + 1 + + + + + + + class WikiComment < ApplicationRecord +
              46. +
                + +
                +
              47. + 1 @@ -3628,8 +4018,8 @@

              48. -
              49. - 2 +
              50. + 1 @@ -3641,7 +4031,7 @@

              51. -
              52. +
              53. @@ -3658,7 +4048,7 @@

              54. -
                +

                app/models/wiki_entry.rb

                @@ -3699,15 +4089,15 @@

                  -
                1. - 2 +
                2. + - class WikiEntry < ApplicationRecord + ##
                3. @@ -3720,12 +4110,38 @@

                  - #Cria a classe de WikiEntry que são os processos de atendimento. + #Cria a classe de WikiEntry que são os processos de atendimento.

                -
              55. +
              56. + 1 + + + + + + + class WikiEntry < ApplicationRecord +
              57. +
                + +
                +
              58. + + + + + + + + ## +
              59. +
                + +
                +
              60. @@ -3738,8 +4154,8 @@

              61. -
              62. - 2 +
              63. + 1 @@ -3751,8 +4167,8 @@

              64. -
              65. - 2 +
              66. + 1 @@ -3764,8 +4180,8 @@

              67. -
              68. - 2 +
              69. + 1 @@ -3777,8 +4193,8 @@

              70. -
              71. - 2 +
              72. + 1 @@ -3790,7 +4206,7 @@

              73. -
              74. +
              75. @@ -3803,7 +4219,7 @@

              76. -
              77. +
              78. @@ -3816,8 +4232,8 @@

              79. -
              80. - 2 +
              81. + 1 @@ -3829,7 +4245,7 @@

              82. -
              83. +
              84. @@ -3842,8 +4258,8 @@

              85. -
              86. - 2 +
              87. + 1 @@ -3855,7 +4271,7 @@

              88. -
              89. +
              90. @@ -3868,8 +4284,8 @@

              91. -
              92. - 2 +
              93. + 1 @@ -3881,7 +4297,7 @@

              94. -
              95. +
              96. @@ -3894,8 +4310,8 @@

              97. -
              98. - 2 +
              99. + 1 @@ -3907,7 +4323,20 @@

              100. -
              101. +
              102. + + + + + + + + ## +
              103. +
                + +
                +
              104. @@ -3920,8 +4349,8 @@

              105. -
              106. - 50 +
              107. + 20 @@ -3930,8 +4359,8 @@

                then: 2 - - else: 48 + + else: 18 @@ -3941,7 +4370,7 @@

              108. -
              109. +
              110. 2 @@ -3954,7 +4383,7 @@

              111. -
              112. +
              113. @@ -3967,7 +4396,7 @@

              114. -
              115. +
              116. @@ -3980,7 +4409,7 @@

              117. -
              118. +