Skip to content

Commit

Permalink
test request_type with rspec
Browse files Browse the repository at this point in the history
Signed-off-by: Manoel <[email protected]>
  • Loading branch information
vieirin committed Nov 16, 2020
1 parent cb31049 commit 7050e31
Show file tree
Hide file tree
Showing 7 changed files with 194 additions and 43 deletions.
160 changes: 125 additions & 35 deletions .idea/workspace.xml

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion db/migrate/20191114162918_devise_create_users.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@ def change
## Recoverable
t.string :reset_password_token
t.datetime :reset_password_sent_at
t.string :registration_number

# information
t.string :registration
t.string :full_name
t.string :role

## Rememberable
t.datetime :remember_created_at

Expand Down
42 changes: 40 additions & 2 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,17 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 2020_11_16_023515) do
ActiveRecord::Schema.define(version: 2020_11_16_025343) do

# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"

create_table "activity_types", force: :cascade do |t|
t.string "title"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end

create_table "information", force: :cascade do |t|
t.string "title"
t.text "content"
Expand All @@ -29,6 +35,21 @@
t.datetime "updated_at", null: false
end

create_table "process_statuses", force: :cascade do |t|
t.string "title"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end

create_table "processos", force: :cascade do |t|
t.integer "user_id"
t.integer "process_status_id"
t.string "sei_process_code"
t.binary "documents"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end

create_table "request_types", force: :cascade do |t|
t.string "name"
t.string "label"
Expand Down Expand Up @@ -60,12 +81,29 @@
t.string "encrypted_password", default: "", null: false
t.string "reset_password_token"
t.datetime "reset_password_sent_at"
t.string "registration_number"
t.string "registration"
t.string "full_name"
t.string "role"
t.datetime "remember_created_at"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["email"], name: "index_users_on_email", unique: true
t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
end

create_table "wiki_entries", force: :cascade do |t|
t.string "title"
t.text "content"
t.binary "documents"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end

create_table "wiki_entry_comments", force: :cascade do |t|
t.integer "wiki_entry_id"
t.text "content"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end

end
9 changes: 9 additions & 0 deletions docker-compose-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,12 @@ services:
- 3000:3000
depends_on:
- secretaria_ppgi_db

adminer:
image: adminer
restart: always
ports:
- 8080:8080
environment:
POSTGRES_USER: test_user
POSTGRES_PASSWORD: test_pwd
5 changes: 0 additions & 5 deletions spec/models/request_type_spec.rb

This file was deleted.

13 changes: 13 additions & 0 deletions test/models/request_type_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
require 'rails_helper'

RSpec.describe RequestType, type: :model do
allowed_types = %w[general enroll_payment financial_assistance proficiency deadline_extension qualification credits_transfer graduation_enrollment general_enrollment]
it "is seeded array matching expected types" do
found_types = []
a = RequestType.find_each do |req_type|
found_types.append(req_type.name)
end
puts(found_types)
expect(found_types).to match_array(allowed_types)
end
end
1 change: 1 addition & 0 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

ENV['RAILS_ENV'] ||= 'test'
require_relative '../config/environment'
require 'rails/test_help'
Expand Down

0 comments on commit 7050e31

Please sign in to comment.