-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from angiecstn/rsc_hospital_index
RSC Can See List of Hospitals
- Loading branch information
Showing
15 changed files
with
168 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class HospitalsController < ApplicationController | ||
def index | ||
@hospitals = Hospital.all | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
class Hospital < ApplicationRecord | ||
validates_presence_of :name | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
.card | ||
.inner-card | ||
.card-title | ||
%h1 Hospitals | ||
#list-item.flex | ||
- @hospitals.each do |hospital| | ||
#hospname | ||
%p= hospital.name | ||
#hosp-button | ||
%button.button Remove | ||
.add-field | ||
%input.add-field-placeholder{placeholder: "Add Hospitals"} | ||
%button.button Add |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
Rails.application.routes.draw do | ||
root controller: :jobs, action: :index | ||
resources :hospitals, only: :index | ||
scope '(:locale)', locale: /en|sv/ do | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
class CreateHospitals < ActiveRecord::Migration[5.2] | ||
def change | ||
create_table :hospitals do |t| | ||
t.string :name | ||
|
||
t.timestamps | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
# This file should contain all the record creation needed to seed the database with its default values. | ||
# The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup). | ||
# | ||
# Examples: | ||
# | ||
# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }]) | ||
# Character.create(name: 'Luke', movie: movies.first) | ||
Hospital.destroy_all | ||
|
||
Hospital.create!(name: "Karolinska") | ||
Hospital.create!(name: "Södersjukhuset") | ||
Hospital.create!(name: "Martina Children's Hospital") | ||
Hospital.create!(name: "Stockholms Sjukhem") | ||
Hospital.create!(name: "GHP Arytmi Center Stockholm") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
@javascript | ||
Feature: RSC Can See List of Hospitals | ||
As an RSC, | ||
In order to know what hospitals I have associations with, | ||
I would like to be able to see a list of hospitals in my region. | ||
|
||
Background: | ||
Given the following hospitals exists | ||
| name | | ||
| Hospital 1 | | ||
| Hospital 2 | | ||
|
||
Scenario: | ||
Given I am on the hospital page | ||
Then I should see "Hospital 1" within the ".card" section | ||
And I should not see "Hospital 3" within the ".card" section | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
Then("I should see {string} within the {string} section") do |content, section| | ||
within("##{section}") { | ||
expect(page).to have_content content | ||
} | ||
end | ||
Given("I am on the hospital page") do | ||
visit hospitals_path | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Given("the following hospitals exists") do |table| | ||
table.hashes.each do |hospital| | ||
create(:hospital, hospital) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
FactoryBot.define do | ||
factory :hospital do | ||
name { "MyString" } | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
require 'rails_helper' | ||
|
||
RSpec.describe Hospital, type: :model do | ||
describe 'DB table' do | ||
it { is_expected.to have_db_column :name } | ||
end | ||
|
||
describe 'Validations' do | ||
it { is_expected.to validate_presence_of :name } | ||
end | ||
|
||
describe 'Factory' do | ||
it 'should have valid Factory' do | ||
expect(create(:hospital)).to be_valid | ||
end | ||
end | ||
end |