Skip to content

Commit

Permalink
Merge branch 'master' into sprint_2
Browse files Browse the repository at this point in the history
  • Loading branch information
vieirin committed Nov 16, 2020
2 parents a4e9d71 + c00f65f commit cb31049
Show file tree
Hide file tree
Showing 18 changed files with 135 additions and 7 deletions.
2 changes: 2 additions & 0 deletions app/models/activity_type.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
class ActivityType < ApplicationRecord
end
3 changes: 3 additions & 0 deletions app/models/process_status.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
class ProcessStatus < ApplicationRecord
validates :title, presence: true
end
2 changes: 2 additions & 0 deletions app/models/processo.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
class Processo < ApplicationRecord
end
3 changes: 1 addition & 2 deletions app/models/wiki_entry.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
class WikiEntry < ApplicationRecord
has_one :wiki_entry_comment
end
end
4 changes: 2 additions & 2 deletions app/models/wiki_entry_comment.rb
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
class WikiEntryComment < ApplicationRecord
end
class WikiEntryComment < ApplicationRecord
end
9 changes: 9 additions & 0 deletions db/migrate/20201116015420_create_process_statuses.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class CreateProcessStatuses < ActiveRecord::Migration[5.2]
def change
create_table :process_statuses do |t|
t.string :title

t.timestamps
end
end
end
12 changes: 12 additions & 0 deletions db/migrate/20201116021025_create_processos.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
class CreateProcessos < ActiveRecord::Migration[5.2]
def change
create_table :processos do |t|
t.integer :user_id
t.integer :process_status_id
t.string :sei_process_code
t.binary :documents

t.timestamps
end
end
end
9 changes: 9 additions & 0 deletions db/migrate/20201116023448_create_activity_types.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class CreateActivityTypes < ActiveRecord::Migration[5.2]
def change
create_table :activity_types do |t|
t.string :title

t.timestamps
end
end
end
11 changes: 11 additions & 0 deletions db/migrate/20201116025101_create_wiki_entries.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
class CreateWikiEntries < ActiveRecord::Migration[5.2]
def change
create_table :wiki_entries do |t|
t.string :title
t.text :content
t.binary :documents

t.timestamps
end
end
end
10 changes: 10 additions & 0 deletions db/migrate/20201116025343_create_wiki_entry_comments.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
class CreateWikiEntryComments < ActiveRecord::Migration[5.2]
def change
create_table :wiki_entry_comments do |t|
t.integer :wiki_entry_id
t.text :content

t.timestamps
end
end
end
5 changes: 3 additions & 2 deletions features/cadastrostatus.feature
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@ Funcionalidade: Como um secretário,
Dado que estou na pagina de cadastrar um status
Quando preencher em "Nome do Status:" com "Novo"
E clicar em "Concluir"
Então deveria estar de volta na pagina de cadastrar um status
E deveria aparecer "Erro ao Cadastrar Status!"
Então deveria estar de volta na pagina de secretário
E deveria aparecer "Erro ao Cadastrar Status!"

4 changes: 4 additions & 0 deletions features/step_definitions/cadastrostatus_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@
visit path_to(page_cadastro_status)
end

Então('deveria estar de volta na pagina de secretario') do |page_secretario|
visit path_to(page_secretario)
end

Então('deveria aparecer {string}') do |string|
@expected_message = string
end
5 changes: 5 additions & 0 deletions spec/models/activity_type_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
require 'rails_helper'

RSpec.describe ActivityType, type: :model do
pending "add some examples to (or delete) #{__FILE__}"
end
25 changes: 25 additions & 0 deletions spec/models/process_status_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
require 'rails_helper'

describe ProcessStatus, type: :model do
it "Valido quando nome esta presente" do
status = Status.new( title: 'Novo')
expect(status).to be_valid
end
end

describe ProcessStatus, type: :model do
it "Invalido sem o nome" do
status = Status.new( title: nil)
status.valid?
expect(status.errors[:title]).to include("Nao pode deixar espaço de nome em branco.")
end
end

describe ProcessStatus, type: :model do
it "Invalido caso ja exista um e-mail igual" do
status = Status.create( title: 'Em espera')
status = Status.new( title: 'Em espera')
status.valid?
expect(status.errors[:title]).to include('Status Repetido')
end
end
5 changes: 5 additions & 0 deletions spec/models/processo_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
require 'rails_helper'

RSpec.describe Processo, type: :model do
pending "add some examples to (or delete) #{__FILE__}"
end
2 changes: 1 addition & 1 deletion spec/models/wiki_entry_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

RSpec.describe WikiEntry, type: :model do
pending "add some examples to (or delete) #{__FILE__}"
end
end
9 changes: 9 additions & 0 deletions spec/rails_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,15 @@

# Filter lines from Rails gems in backtraces.
config.filter_rails_from_backtrace!
config.use_transactional_fixtures = false
# arbitrary gems may also be filtered via:
# config.filter_gems_from_backtrace("gem name")
end
require 'shoulda/matchers'

Shoulda::Matchers.configure do |config|
config.integrate do |with|
with.test_framework :rspec
with.library :rails
end
end
22 changes: 22 additions & 0 deletions spec/support/database_cleaner.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
RSpec.configure do |config|

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

0 comments on commit cb31049

Please sign in to comment.