Commit 75ce408f12d77cb79df10aab30d69e11b1785dc2

Authored by Rafael Manzo
1 parent 336e34aa

Finished MezuroConfiguration Acceptance tests

app/views/mezuro_configurations/show.html.erb
@@ -11,4 +11,7 @@ @@ -11,4 +11,7 @@
11 11
12 <p> 12 <p>
13 <%= link_to 'Back', mezuro_configurations_path, class: 'btn btn-default' %> 13 <%= link_to 'Back', mezuro_configurations_path, class: 'btn btn-default' %>
  14 + <% if configuration_owner? @configuration.id %>
  15 + <%= link_to 'Destroy configuration', mezuro_configuration_path(@configuration.id), method: :delete, data: { confirm: 'Are you sure?' }, class: 'btn btn-danger' %>
  16 + <% end %>
14 </p> 17 </p>
features/mezuro_configuration/deletion.feature
@@ -17,7 +17,7 @@ Feature: Configuration Deletion @@ -17,7 +17,7 @@ Feature: Configuration Deletion
17 When I am at the Sample Configuration page 17 When I am at the Sample Configuration page
18 Then I should not see Destroy 18 Then I should not see Destroy
19 19
20 - @kalibro_restart @wip 20 + @kalibro_restart
21 Scenario: Should delete a configuration that I own 21 Scenario: Should delete a configuration that I own
22 Given I am a regular user 22 Given I am a regular user
23 And I am signed in 23 And I am signed in
features/mezuro_configuration/edition.feature
@@ -3,7 +3,7 @@ Feature: Configuration @@ -3,7 +3,7 @@ Feature: Configuration
3 As a regular user 3 As a regular user
4 I should be able to edit my configurations 4 I should be able to edit my configurations
5 5
6 - @kalibro_restarts @wip 6 + @kalibro_restart
7 Scenario: Should go to the edit page from a configuration that I own 7 Scenario: Should go to the edit page from a configuration that I own
8 Given I am a regular user 8 Given I am a regular user
9 And I am signed in 9 And I am signed in
@@ -20,7 +20,7 @@ Feature: Configuration @@ -20,7 +20,7 @@ Feature: Configuration
20 And I am at the All Configurations page 20 And I am at the All Configurations page
21 Then I should not see "Edit" within "table tr td" 21 Then I should not see "Edit" within "table tr td"
22 22
23 - @kalibro_restart @wip 23 + @kalibro_restart
24 Scenario: Should not render the edit page if the configuration doesn't belongs to the current user 24 Scenario: Should not render the edit page if the configuration doesn't belongs to the current user
25 Given I am a regular user 25 Given I am a regular user
26 And I am signed in 26 And I am signed in
@@ -29,7 +29,7 @@ Feature: Configuration @@ -29,7 +29,7 @@ Feature: Configuration
29 When I visit the sample configuration edit page 29 When I visit the sample configuration edit page
30 Then I should see "You're not allowed to do this operation" 30 Then I should see "You're not allowed to do this operation"
31 31
32 - @kalibro_restart @wip 32 + @kalibro_restart
33 Scenario: Filling up the form 33 Scenario: Filling up the form
34 Given I am a regular user 34 Given I am a regular user
35 And I am signed in 35 And I am signed in
@@ -39,7 +39,7 @@ Feature: Configuration @@ -39,7 +39,7 @@ Feature: Configuration
39 Then The field "mezuro_configuration[name]" should be filled with the sample configuration "name" 39 Then The field "mezuro_configuration[name]" should be filled with the sample configuration "name"
40 And The field "mezuro_configuration[description]" should be filled with the sample configuration "description" 40 And The field "mezuro_configuration[description]" should be filled with the sample configuration "description"
41 41
42 - @kalibro_restart @wip 42 + @kalibro_restart
43 Scenario: With valid attributes 43 Scenario: With valid attributes
44 Given I am a regular user 44 Given I am a regular user
45 And I am signed in 45 And I am signed in
@@ -51,7 +51,7 @@ Feature: Configuration @@ -51,7 +51,7 @@ Feature: Configuration
51 Then I should see "Kalibro" 51 Then I should see "Kalibro"
52 And I should see "Web Service to collect metrics" 52 And I should see "Web Service to collect metrics"
53 53
54 - @kalibro_restart @wip 54 + @kalibro_restart
55 Scenario: With configuration name already taken 55 Scenario: With configuration name already taken
56 Given I am a regular user 56 Given I am a regular user
57 And I am signed in 57 And I am signed in
@@ -62,7 +62,7 @@ Feature: Configuration @@ -62,7 +62,7 @@ Feature: Configuration
62 When I press the Save button 62 When I press the Save button
63 Then I should see "There's already" 63 Then I should see "There's already"
64 64
65 - @kalibro_restart @wip 65 + @kalibro_restart
66 Scenario: Editing just the description 66 Scenario: Editing just the description
67 Given I am a regular user 67 Given I am a regular user
68 And I am signed in 68 And I am signed in
@@ -72,7 +72,7 @@ Feature: Configuration @@ -72,7 +72,7 @@ Feature: Configuration
72 When I press the Save button 72 When I press the Save button
73 And I should see "Web Service to collect metrics" 73 And I should see "Web Service to collect metrics"
74 74
75 - @kalibro_restart @wip 75 + @kalibro_restart
76 Scenario: With blank configuration name 76 Scenario: With blank configuration name
77 Given I am a regular user 77 Given I am a regular user
78 And I am signed in 78 And I am signed in
features/step_definitions/configuration_steps.rb
@@ -15,8 +15,8 @@ Given(/^I have a sample configuration$/) do @@ -15,8 +15,8 @@ Given(/^I have a sample configuration$/) do
15 end 15 end
16 16
17 Given(/^I own a sample configuration$/) do 17 Given(/^I own a sample configuration$/) do
18 - @mezuro_configuration = FactoryGirl.build(:mezuro_configuration, {id: nil})  
19 - FactoryGirl.create(:mezuro_configuration_ownership, {user_id: @user.id, mezuro_configuration_id: @mezuro_configuration.id}) 18 + @mezuro_configuration = FactoryGirl.create(:mezuro_configuration, {id: nil})
  19 + FactoryGirl.create(:mezuro_configuration_ownership, {id: nil, user_id: @user.id, mezuro_configuration_id: @mezuro_configuration.id})
20 end 20 end
21 21
22 Given(/^I am at the Sample Configuration page$/) do 22 Given(/^I am at the Sample Configuration page$/) do
@@ -28,12 +28,12 @@ Given(/^I am at the sample configuration edit page$/) do @@ -28,12 +28,12 @@ Given(/^I am at the sample configuration edit page$/) do
28 end 28 end
29 29
30 Given(/^I own a configuration named "(.*?)"$/) do |name| 30 Given(/^I own a configuration named "(.*?)"$/) do |name|
31 - @mezuro_configuration = FactoryGirl.build(:mezuro_configuration, {id: nil, name: name})  
32 - FactoryGirl.create(:mezuro_configuration_ownership, {user_id: @user.id, mezuro_configuration_id: @mezuro_configuration.id}) 31 + @mezuro_configuration = FactoryGirl.create(:mezuro_configuration, {id: nil, name: name})
  32 + FactoryGirl.create(:mezuro_configuration_ownership, {id: nil, user_id: @user.id, mezuro_configuration_id: @mezuro_configuration.id})
33 end 33 end
34 34
35 When(/^I visit the sample configuration edit page$/) do 35 When(/^I visit the sample configuration edit page$/) do
36 - visit edit_mezuro_configuration(@mezuro_configuration.id) 36 + visit edit_mezuro_configuration_path(@mezuro_configuration.id)
37 end 37 end
38 38
39 Then(/^I should be in the Edit Configuration page$/) do 39 Then(/^I should be in the Edit Configuration page$/) do