Skip to content

Commit

Permalink
Evaluation criteria Specs (#25)
Browse files Browse the repository at this point in the history
* updates README

* Adds specs to Evaluation Criteria
  • Loading branch information
CharlieIGG authored Jan 11, 2020
1 parent 2187f5a commit cd23e53
Show file tree
Hide file tree
Showing 4 changed files with 98 additions and 4 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# EVALUARIUM
![alt text](./app/javascript/images/logo1.svg "Logo Title Text 1")

# Evaluarium

![](https://github.com/CharlieIGG/evaluarium/workflows/specs/badge.svg)

Expand All @@ -12,7 +14,7 @@ Typical use-cases are Startup Incubators, Accelerators, Hackathons, and other su

## Table of contents

- [EVALUARIUM](#evaluarium)
- [Evaluarium](#evaluarium)
- [Table of contents](#table-of-contents)
- [Environment URLS](#environment-urls)
- [The team](#the-team)
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/images/logo1.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion app/views/evaluation_criteria/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
)
%>
<p id="notice"><%= notice %></p>
<div class="card-columns">
<div class="card-columns rspec_evaluation_criteria_list">
<% @evaluation_criteria.each do |criterion| %>
<div class="card border-primary mb-3">
<div class="card-header text-primary font-weight-bold d-flex justify-content-between">
Expand Down
92 changes: 92 additions & 0 deletions spec/system/manage_evaluation_criteria_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# frozen_string_literal: true

require 'rails_helper'

RSpec.describe 'Manage Evaluation Criteria', type: :system do
let_it_be(:current_user) { create(:user) }

signed_in_as :current_user

context 'As a random User' do
context 'Trying to do anything' do
it 'should be bounced back to root' do
visit new_evaluation_criterium_path
expect(current_path).to eq(root_path)
end
end
end

context 'As a Superadmin' do
current_user_roles!([{ name: :superadmin }])

it 'can invite a new Evaluation Criterium successfully', js: true do
name = 'Some Name'
description = 'Some Description'
short_description = 'Some Short Description'

visit new_evaluation_criterium_path
fill_in 'Name', with: name
fill_in 'Short description', with: short_description
expect do
click_on 'Create Evaluation Criterion'
end.to change(EvaluationCriterium, :count).by(1)
new_criterium = EvaluationCriterium.last
expect(new_criterium.name).to eq(name)
expect(new_criterium.short_description).to eq(short_description)
# TODO: "ENABLE once ActionText::SystemTestHelper is added into 'stable' Rails"
# expect(new_criterium.description.body.to_plain_text).to eq(description)
end

it 'can see all evaluation_criteria' do
create_list(:evaluation_criterium, 5)
visit evaluation_criteria_path

evaluation_criterium_cards = all('.rspec_evaluation_criteria_list .card')
expect(evaluation_criterium_cards.count).to eq(5)
end

context 'managing a specific evaluation_criterium' do
let_it_be(:evaluation_criterium, reload: true) { create(:evaluation_criterium) }

context 'deleting Evaluation Crtieria' do
context 'without associated Programs' do
it 'can delete a evaluation_criterium', js: true do
pending 'Will finish this after adding Programs'
expect(true).to be(false)
end

context 'with associated Programs' do
it 'CANNOT delete a evaluation_criterium', js: true do
pending 'Will finish this after adding Programs'
expect(true).to be(false)
end
end
end
end

it 'can go to edit a evaluation_criterium' do
visit evaluation_criteria_path
evaluation_criterium_cards = all('.rspec_evaluation_criteria_list .card')
within evaluation_criterium_cards.last do
click_on 'Edit'
end
expect(current_path).to eq(edit_evaluation_criterium_path(evaluation_criterium))
end

it 'can edit an Evaluation Criterium', js: true do
new_name = 'NEW NAME'
new_description = 'NEW DESCRIPTION'
new_short_description = 'NEW SHORT DESCRIPTION'
visit edit_evaluation_criterium_path(evaluation_criterium)
fill_in 'Name', with: new_name
fill_in 'Short description', with: new_short_description
click_on 'Update Evaluation Criterion'
expect(current_path).to eq(evaluation_criteria_path)
expect(evaluation_criterium.reload.name).to eq(new_name)
expect(evaluation_criterium.short_description).to eq(new_short_description)
# TODO: "ENABLE once ActionText::SystemTestHelper is added into 'stable' Rails"
# expect(evaluation_criterium.description.body.to_plain_text).to eq(new_description)
end
end
end
end

0 comments on commit cd23e53

Please sign in to comment.