-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update controller with ability, close #4
- Loading branch information
Showing
11 changed files
with
142 additions
and
44 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 |
---|---|---|
|
@@ -13,6 +13,5 @@ | |
*/ | ||
|
||
@import "bootstrap"; | ||
@import "fontawesome_all.min"; | ||
@import "style"; | ||
@import "custom"; |
This file was deleted.
Oops, something went wrong.
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
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,11 @@ | ||
section.hero-banner-sm | ||
.container | ||
.hero-banner-sm-content | ||
h1 Редактирование задания | ||
p Старайтесь описать как можно подробнее ваше задание | ||
|
||
.container | ||
.row | ||
.col-md-9 | ||
.task | ||
=render 'form' |
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
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,50 +1,51 @@ | ||
require 'rails_helper' | ||
|
||
feature 'Create task' do | ||
describe 'Authenticated' do | ||
given(:customer) { create :user } | ||
given(:executor) { create :user, :executor } | ||
scenario 'Unauthenticated user can not create task' do | ||
visit tasks_path | ||
|
||
describe 'Customer' do | ||
background do | ||
sign_in(customer) | ||
visit tasks_path | ||
click_on 'Создать задание' | ||
end | ||
expect(page).to_not have_content 'Создать задание' | ||
end | ||
|
||
scenario 'create valid task' do | ||
fill_in 'Название задания', with: 'Тест заголовка' | ||
fill_in 'Что нужно сделать?', with: 'Тестовое наполнение' | ||
fill_in 'Цена', with: '777' | ||
click_on 'Опубликовать задание' | ||
describe 'Executor' do | ||
given(:executor) { create :user, :executor } | ||
|
||
expect(page).to have_content 'Задание создано' | ||
expect(page).to have_content 'Тест заголовка' | ||
expect(page).to have_content 'Тестовое наполнение' | ||
scenario 'can not create task' do | ||
sign_in(executor) | ||
visit tasks_path | ||
|
||
within('ul.blog-info-link') do | ||
expect(page).to have_content customer.email | ||
end | ||
end | ||
expect(page).to_not have_content 'Создать задание' | ||
end | ||
end | ||
|
||
scenario 'create not valid task' do | ||
click_on 'Опубликовать задание' | ||
describe 'Customer' do | ||
given(:customer) { create :user } | ||
|
||
expect(page).to have_content 'Заголовок не может быть пустым' | ||
end | ||
background do | ||
sign_in(customer) | ||
visit tasks_path | ||
click_on 'Создать задание' | ||
end | ||
|
||
scenario 'executor tries create task' do | ||
sign_in(executor) | ||
visit tasks_path | ||
scenario 'create valid task' do | ||
fill_in 'Название задания', with: 'Тест заголовка' | ||
fill_in 'Что нужно сделать?', with: 'Тестовое наполнение' | ||
fill_in 'Цена', with: '777' | ||
click_on 'Опубликовать задание' | ||
|
||
expect(page).to_not have_content 'Создать задание' | ||
expect(page).to have_content 'Задание создано' | ||
expect(page).to have_content 'Тест заголовка' | ||
expect(page).to have_content 'Тестовое наполнение' | ||
|
||
within 'ul.blog-info-link' do | ||
expect(page).to have_content customer.email | ||
end | ||
end | ||
end | ||
|
||
scenario 'Unauthenticated user tries create task' do | ||
visit tasks_path | ||
scenario 'can not create not valid task' do | ||
click_on 'Опубликовать задание' | ||
|
||
expect(page).to_not have_content 'Создать задание' | ||
expect(page).to have_content 'Заголовок не может быть пустым' | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
require 'rails_helper' | ||
|
||
feature 'Update task' do | ||
given!(:customer) { create :user } | ||
given(:task) { create :task, author: customer } | ||
|
||
scenario 'Unauthenticated user can not edit task' do | ||
visit task_path(task) | ||
|
||
expect(page).to_not have_content 'Изменить задание' | ||
end | ||
|
||
describe 'Executor' do | ||
given(:executor) { create :user, :executor } | ||
|
||
scenario 'Executor tries update task' do | ||
sign_in(executor) | ||
visit task_path(task) | ||
|
||
expect(page).to_not have_content 'Изменить задание' | ||
end | ||
end | ||
|
||
describe 'Customer' do | ||
describe 'As author' do | ||
background do | ||
sign_in(customer) | ||
visit task_path(task) | ||
|
||
click_on 'Изменить задание' | ||
end | ||
|
||
scenario 'can update task' do | ||
fill_in 'Название задания', with: 'Измененный заголовок' | ||
fill_in 'Что нужно сделать?', with: 'Измененное тело' | ||
fill_in 'Цена', with: '14500541' | ||
click_on 'Опубликовать задание' | ||
|
||
expect(page).to have_content 'Измененный заголовок' | ||
expect(page).to have_content 'Измененное тело' | ||
expect(page).to have_content '14500541' | ||
|
||
expect(page).to have_content 'Задание обновлено' | ||
end | ||
|
||
scenario 'can not update not valid task' do | ||
fill_in 'Название задания', with: '' | ||
fill_in 'Что нужно сделать?', with: '' | ||
fill_in 'Цена', with: '' | ||
click_on 'Опубликовать задание' | ||
|
||
expect(page).to have_content 'Заголовок не может быть пустым' | ||
end | ||
end | ||
|
||
describe 'As not author' do | ||
given!(:customer2) { create :user } | ||
|
||
scenario 'can not update task' do | ||
sign_in(customer2) | ||
visit task_path(task) | ||
|
||
expect(page).to_not have_content 'Изменить задание' | ||
end | ||
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