Commit 09d282fffa5dbb214ef315b1388fac4f28486adf
Committed by
Rafael Manzo
1 parent
1b69db9b
Exists in
colab
and in
4 other branches
Reading group creation page
Signed-of By: Guilherme Rojas V. de Lima <guilhermehrojas@gmail.com> Signed-of By: Renan Fichberg <rfichberg@gmail.com>
Showing
4 changed files
with
75 additions
and
0 deletions
Show diff stats
... | ... | @@ -0,0 +1,15 @@ |
1 | +<%= form_for(@reading_group, :html => { role: 'form' }) do |f| %> | |
2 | + <%= render :partial => 'shared/form_errors', :locals => {:object => @reading_group} %> | |
3 | + | |
4 | + <div class="form-group"> | |
5 | + <%= f.label :name, class: 'control-label' %><br> | |
6 | + <%= f.text_field :name, class: 'form-control' %> | |
7 | + </div> | |
8 | + | |
9 | + <div class="form-group"> | |
10 | + <%= f.label :description, class: 'control-label' %><br> | |
11 | + <%= f.text_area :description, class: 'form-control' %> | |
12 | + </div> | |
13 | + | |
14 | + <%= f.submit 'Save', class: 'btn btn-primary' %> | |
15 | +<% end %> | ... | ... |
app/views/reading_groups/new.html.erb
... | ... | @@ -0,0 +1,43 @@ |
1 | +Feature: Reading Group Creation | |
2 | + In order to create new reading groups to make my own readings | |
3 | + As a regular user | |
4 | + I should be able to create reading groups | |
5 | + | |
6 | +@kalibro_restart | |
7 | +Scenario: Should not create reading groups without login | |
8 | + Given I am at the All Reading Groups page | |
9 | + Then I should not see New Reading Group | |
10 | + | |
11 | +@kalibro_restart | |
12 | +Scenario: Reading Group creation | |
13 | + Given I am a regular user | |
14 | + And I am signed in | |
15 | + And I am at the New Reading Group page | |
16 | + And I fill the Name field with "My reading group" | |
17 | + And I fill the Description field with "New reading group" | |
18 | + When I press the Save button | |
19 | + Then I should see "My reading group" | |
20 | + And I should see "New reading group" | |
21 | + And I should see "New Reading" | |
22 | + And I should see "Destroy Reading Group" | |
23 | + | |
24 | +@kalibro_restart | |
25 | +Scenario: reading group creation with already taken name | |
26 | + Given I am a regular user | |
27 | + And I am signed in | |
28 | + And I have a reading group named "Group" | |
29 | + And I am at the New Reading Group page | |
30 | + And I fill the Name field with "Group" | |
31 | + And I fill the Description field with "Same Group" | |
32 | + When I press the Save button | |
33 | + Then I should see "There's already" | |
34 | + | |
35 | +@kalibro_restart | |
36 | +Scenario: reading group creation with blank name | |
37 | + Given I am a regular user | |
38 | + And I am signed in | |
39 | + And I am at the New Reading Group page | |
40 | + And I fill the Name field with " " | |
41 | + And I fill the Description field with "Anything" | |
42 | + When I press the Save button | |
43 | + Then I should see "Name can't be blank" | |
0 | 44 | \ No newline at end of file | ... | ... |
features/step_definitions/reading_group_steps.rb
1 | 1 | require 'kalibro_gem/errors' |
2 | 2 | |
3 | +Given(/^I am at the All Reading Groups page$/) do | |
4 | + visit reading_groups_path | |
5 | +end | |
6 | + | |
7 | +Given(/^I am at the New Reading Group page$/) do | |
8 | + visit new_reading_group_path | |
9 | +end | |
10 | + | |
11 | +Given(/^I have a reading group named "(.*?)"$/) do |name| | |
12 | + @reading_group = FactoryGirl.create(:reading_group, {id: nil, name: name}) | |
13 | +end | |
14 | + | |
3 | 15 | Given(/^I own a sample reading group$/) do |
4 | 16 | @reading_group = FactoryGirl.create(:reading_group, {id: nil}) |
5 | 17 | FactoryGirl.create(:reading_group_ownership, {user_id: @user.id, reading_group_id: @reading_group.id}) | ... | ... |