Commit 1b69db9b0e4767061d2e766aaca2daa7f716139c
Committed by
Rafael Manzo
1 parent
478ef5e4
Exists in
colab
and in
4 other branches
Acceptance tests for show Reading Group Page
Signed-of By: Renan Fichberg <rfichberg@gmail.com> Signed-of By: Fellipe Souto Sampaio <fllsouto@gmail.com>
Showing
3 changed files
with
40 additions
and
16 deletions
Show diff stats
app/views/reading_groups/show.html.erb
... | ... | @@ -52,6 +52,6 @@ |
52 | 52 | |
53 | 53 | <p> |
54 | 54 | <% if reading_groups_owner? @reading_group.id %> |
55 | - <%= link_to 'Destroy reading group', reading_group_path(@reading_group.id), method: :delete, data: { confirm: 'Are you sure?' }, class: 'btn btn-danger' %> | |
55 | + <%= link_to 'Destroy Reading Group', reading_group_path(@reading_group.id), method: :delete, data: { confirm: 'Are you sure?' }, class: 'btn btn-danger' %> | |
56 | 56 | <% end %> |
57 | 57 | </p> | ... | ... |
features/reading_group/show.feature
... | ... | @@ -3,24 +3,45 @@ Feature: Show Reading Group |
3 | 3 | As a regular user |
4 | 4 | I should be able to see each of them |
5 | 5 | |
6 | -@kalibro_restart @wip | |
7 | -Scenario: Should not show the create reading link to user that doesn't own the reading group | |
6 | +@kalibro_restart | |
7 | +Scenario: Should not show the create, edit and destroy reading link to user that doesn't own the reading group | |
8 | 8 | Given I am a regular user |
9 | 9 | And I have a sample reading group |
10 | 10 | And I have a sample reading within the sample reading group |
11 | - When I am at the Sample Reading Group page | |
12 | - Then I should not see New Reading | |
13 | - And I should not see Destroy reading group | |
11 | + When I visit the Sample Reading Group page | |
12 | + Then I should be in the Sample Reading Group page | |
13 | + And I should not see New Reading | |
14 | 14 | And I should not see Edit |
15 | + And I should not see Destroy | |
15 | 16 | |
16 | -@kalibro_restart @wip | |
17 | -Scenario: Should show the create reading link to user that do own the reading group | |
17 | +@kalibro_restart | |
18 | +Scenario: Should show the links for the user that owns the reading group | |
18 | 19 | Given I am a regular user |
20 | + And I am signed in | |
19 | 21 | And I own a sample reading group |
20 | 22 | And I have a sample reading within the sample reading group |
21 | 23 | When I visit the Sample Reading Group page |
22 | 24 | Then I should be in the Sample Reading Group page |
23 | - And I should see "Destroy" | |
25 | + And I should see "New Reading" | |
24 | 26 | And I should see "Edit" |
25 | - And I should see "Destroy reading group" | |
26 | - And I should see "New reading group" | |
27 | 27 | \ No newline at end of file |
28 | + And I should see "Destroy" | |
29 | + And I should see "Destroy Reading Group" | |
30 | + | |
31 | +@kalibro_restart | |
32 | +Scenario: Should show the information of the sample reading | |
33 | + Given I have a sample reading group | |
34 | + And I have a sample reading within the sample reading group | |
35 | + When I visit the Sample Reading Group page | |
36 | + Then I should be in the Sample Reading Group page | |
37 | + And I should not see There are no readings yet! | |
38 | + And I should see "Label" | |
39 | + And I should see "Grade" | |
40 | + And I should see "Color" | |
41 | + And I should see the information of the sample reading | |
42 | + | |
43 | +@kalibro_restart | |
44 | +Scenario: Should show a message when there is no readings | |
45 | + Given I have a sample reading group | |
46 | + When I visit the Sample Reading Group page | |
47 | + Then I should be in the Sample Reading Group page | |
48 | + And I should see "There are no readings yet!" | ... | ... |
features/step_definitions/reading_group_steps.rb
... | ... | @@ -13,13 +13,16 @@ Given(/^I visit the Sample Reading Group page$/) do |
13 | 13 | visit reading_group_path(@reading_group.id) |
14 | 14 | end |
15 | 15 | |
16 | -When(/^I am at the Sample Reading Group page$/) do | |
17 | - p @reading_group | |
16 | +Then(/^I should be in the Sample Reading Group page$/) do | |
18 | 17 | page.should have_content(@reading_group.name) |
19 | 18 | page.should have_content(@reading_group.description) |
20 | 19 | end |
21 | 20 | |
22 | -Then(/^I should be in the Sample Reading Group page$/) do | |
23 | - page.should have_content(@reading_group.name) | |
24 | - page.should have_content(@reading_group.description) | |
21 | +Then(/^I should see the information of the sample reading$/) do | |
22 | + page.should have_content(@reading.label) | |
23 | + page.should have_content(@reading.grade) | |
24 | + pager = page.body | |
25 | + color = @reading.color.downcase | |
26 | + var = (pager =~ /#{color}/) | |
27 | + var.should_not be_nil | |
25 | 28 | end |
26 | 29 | \ No newline at end of file | ... | ... |