Commit ca3d418718d994f67c617a6a7a357d00cf1d2d95
Committed by
Diego Camarinha
1 parent
97887b40
Exists in
colab
and in
4 other branches
Added acceptance test for listing kalibro configurations
Now using the public/private separation Signed off by: Pedro Scocco <pedroscocco@gmail.com>
Showing
3 changed files
with
39 additions
and
1 deletions
Show diff stats
features/kalibro_configuration/listing.feature
... | ... | @@ -28,3 +28,15 @@ Feature: Configuration listing |
28 | 28 | And I am at the All Configurations page |
29 | 29 | When I click the Show link |
30 | 30 | Then the sample configuration should be there |
31 | + | |
32 | + @kalibro_configuration_restart | |
33 | + Scenario: Should show only the public or owned configurations | |
34 | + Given I am a regular user | |
35 | + And I am signed in | |
36 | + And I have a sample configuration | |
37 | + And there is a public configuration created | |
38 | + And there is a private configuration created | |
39 | + When I am at the All Configurations page | |
40 | + Then the sample configuration should be there | |
41 | + And the public configuration should be there | |
42 | + And the private configuration should not be there | ... | ... |
features/step_definitions/kalibro_configuration_steps.rb
... | ... | @@ -12,7 +12,7 @@ end |
12 | 12 | |
13 | 13 | Given(/^I have a sample configuration$/) do |
14 | 14 | @kalibro_configuration = FactoryGirl.create(:kalibro_configuration) |
15 | - FactoryGirl.create(:kalibro_configuration_attributes, {id: nil, user_id: nil, kalibro_configuration_id: @kalibro_configuration.id}) | |
15 | + FactoryGirl.create(:kalibro_configuration_attributes, user_id: FactoryGirl.create(:another_user).id, kalibro_configuration_id: @kalibro_configuration.id) | |
16 | 16 | |
17 | 17 | end |
18 | 18 | |
... | ... | @@ -58,3 +58,24 @@ Then(/^the sample configuration should be there$/) do |
58 | 58 | expect(page).to have_content(@kalibro_configuration.name) |
59 | 59 | expect(page).to have_content(@kalibro_configuration.description) |
60 | 60 | end |
61 | + | |
62 | +Given(/^there is a public configuration created$/) do | |
63 | + @public_kc = FactoryGirl.create(:public_kalibro_configuration) | |
64 | + FactoryGirl.create(:kalibro_configuration_attributes, kalibro_configuration_id: @public_kc.id) | |
65 | +end | |
66 | + | |
67 | +Given(/^there is a private configuration created$/) do | |
68 | + @private_kc = FactoryGirl.create(:another_kalibro_configuration) | |
69 | + FactoryGirl.create(:kalibro_configuration_attributes, :private, kalibro_configuration_id: @private_kc.id, user: FactoryGirl.create(:another_user, id: nil, email: "private@email.com")) | |
70 | +end | |
71 | + | |
72 | +Then(/^the public configuration should be there$/) do | |
73 | + expect(page).to have_content(@public_kc.name) | |
74 | + expect(page).to have_content(@public_kc.description) | |
75 | +end | |
76 | + | |
77 | +Then(/^the private configuration should not be there$/) do | |
78 | + expect(page).to have_no_content(@private_kc.name) | |
79 | + expect(page).to have_no_content(@private_kc.description) | |
80 | +end | |
81 | + | ... | ... |
spec/factories/kalibro_configurations.rb