diff --git a/features/kalibro_configuration/create.feature b/features/kalibro_configuration/create.feature
new file mode 100644
index 0000000..7a42823
--- /dev/null
+++ b/features/kalibro_configuration/create.feature
@@ -0,0 +1,41 @@
+Feature: Configuration Creation
+ In order to register my configurations
+ As a regular user
+ I should be able to create configurations
+
+ @kalibro_configuration_restart
+ Scenario: Should not create configuration without login
+ Given I am at the All Configurations page
+ Then I should not see "New Configuration"
+
+ @kalibro_configuration_restart
+ Scenario: configuration creation
+ Given I am a regular user
+ And I am signed in
+ And I am at the New Configuration page
+ And I fill the Name field with "Kalibro"
+ And I fill the Description field with "Web Service to collect metrics"
+ When I press the Save button
+ Then I should see "Kalibro"
+ And I should see "Web Service to collect metrics"
+
+ @kalibro_configuration_restart
+ Scenario: configuration creation with already taken name
+ Given I am a regular user
+ And I am signed in
+ And I have a configuration named "Kalibro"
+ And I am at the New Configuration page
+ And I fill the Name field with "Kalibro"
+ And I fill the Description field with "Web Service to collect metrics"
+ When I press the Save button
+ Then I should see "Name There is already a KalibroConfiguration with name Kalibro!"
+
+ @kalibro_configuration_restart
+ Scenario: configuration creation with blank name
+ Given I am a regular user
+ And I am signed in
+ And I am at the New Configuration page
+ And I fill the Name field with " "
+ And I fill the Description field with "Web Service to collect metrics"
+ When I press the Save button
+ Then I should see "Name can't be blank"
diff --git a/features/kalibro_configuration/deletion.feature b/features/kalibro_configuration/deletion.feature
new file mode 100644
index 0000000..a3fceee
--- /dev/null
+++ b/features/kalibro_configuration/deletion.feature
@@ -0,0 +1,28 @@
+Feature: Configuration Deletion
+ In order to be able to remove configurations
+ As a regular user
+ The system should have an interface to it
+
+ @kalibro_configuration_restart
+ Scenario: Should not delete a configuration without user authentication
+ Given I have a sample configuration
+ When I am at the Sample Configuration page
+ Then I should not see "Destroy"
+
+ @kalibro_configuration_restart
+ Scenario: Should not delete a configuration that doesn't belongs to user
+ Given I am a regular user
+ And I am signed in
+ And I have a sample configuration
+ When I am at the Sample Configuration page
+ Then I should not see "Destroy"
+
+ @kalibro_configuration_restart
+ Scenario: Should delete a configuration that I own
+ Given I am a regular user
+ And I am signed in
+ And I own a sample configuration
+ And I am at the Sample Configuration page
+ When I click the Destroy Configuration link
+ Then I should be in the All configurations page
+ And the sample configuration should not be there
diff --git a/features/kalibro_configuration/edition.feature b/features/kalibro_configuration/edition.feature
new file mode 100644
index 0000000..ecb0116
--- /dev/null
+++ b/features/kalibro_configuration/edition.feature
@@ -0,0 +1,83 @@
+Feature: Configuration
+ In Order to be able to update my configurations info
+ As a regular user
+ I should be able to edit my configurations
+
+ @kalibro_configuration_restart
+ Scenario: Should go to the edit page from a configuration that I own
+ Given I am a regular user
+ And I am signed in
+ And I own a sample configuration
+ And I am at the All Configurations page
+ When I click the Edit link
+ Then I should be in the Edit Configuration page
+
+ @kalibro_configuration_restart
+ Scenario: Should not show edit links from configurations that doesn't belongs to me
+ Given I am a regular user
+ And I am signed in
+ And I have a sample configuration
+ And I am at the All Configurations page
+ Then I should not see Edit within table
+
+ @kalibro_configuration_restart
+ Scenario: Should not render the edit page if the configuration doesn't belongs to the current user
+ Given I am a regular user
+ And I am signed in
+ And I have a sample configuration
+ And I am at the All Projects page
+ When I visit the sample configuration edit page
+ Then I should see "You're not allowed to do this operation"
+
+ @kalibro_configuration_restart
+ Scenario: Filling up the form
+ Given I am a regular user
+ And I am signed in
+ And I own a sample configuration
+ And I am at the All Configurations page
+ When I click the Edit link
+ Then The field "kalibro_configuration[name]" should be filled with the sample configuration "name"
+ And The field "kalibro_configuration[description]" should be filled with the sample configuration "description"
+
+ @kalibro_configuration_restart
+ Scenario: With valid attributes
+ Given I am a regular user
+ And I am signed in
+ And I own a sample configuration
+ And I am at the sample configuration edit page
+ And I fill the Name field with "Kalibro"
+ And I fill the Description field with "Web Service to collect metrics"
+ When I press the Save button
+ Then I should see "Kalibro"
+ And I should see "Web Service to collect metrics"
+
+ @kalibro_configuration_restart
+ Scenario: With configuration name already taken
+ Given I am a regular user
+ And I am signed in
+ And I have a configuration named "Qt-Calculator"
+ And I own a configuration named "Kalibro"
+ And I am at the sample configuration edit page
+ And I fill the Name field with "Qt-Calculator"
+ When I press the Save button
+ Then I should see "Name There is already a KalibroConfiguration with name Qt-Calculator!"
+
+ @kalibro_configuration_restart
+ Scenario: Editing just the description
+ Given I am a regular user
+ And I am signed in
+ And I own a sample configuration
+ And I am at the sample configuration edit page
+ And I fill the Description field with "Web Service to collect metrics"
+ When I press the Save button
+ And I should see "Web Service to collect metrics"
+
+ @kalibro_configuration_restart
+ Scenario: With blank configuration name
+ Given I am a regular user
+ And I am signed in
+ And I own a sample configuration
+ And I am at the sample configuration edit page
+ And I fill the Name field with " "
+ When I press the Save button
+ Then I should see "Name can't be blank"
diff --git a/features/kalibro_configuration/listing.feature b/features/kalibro_configuration/listing.feature
new file mode 100644
index 0000000..60a2c09
--- /dev/null
+++ b/features/kalibro_configuration/listing.feature
@@ -0,0 +1,30 @@
+Feature: Configuration listing
+ In order to interact with other configurations
+ As a regular user
+ I should have various listings
+
+ Scenario: Listing configurations
+ Given I am at the homepage
+ When I click the Configuration link
+ Then I should see "Configurations"
+ And I should see "Name"
+ And I should see "Description"
+ And I should see "You must be logged in to create new Configurations."
+
+ @kalibro_configuration_restart
+ Scenario: Should list the existing configurations
+ Given I am a regular user
+ And I am signed in
+ And I have a sample configuration
+ And I am at the All Configurations page
+ Then the sample configuration should be there
+ And I should not see "You must be logged in to create new Configurations."
+
+ @kalibro_configuration_restart
+ Scenario: Should show the existing configuration
+ Given I am a regular user
+ And I am signed in
+ And I have a sample configuration
+ And I am at the All Configurations page
+ When I click the Show link
+ Then the sample configuration should be there
\ No newline at end of file
diff --git a/features/kalibro_configuration/show.feature b/features/kalibro_configuration/show.feature
new file mode 100644
index 0000000..592e6af
--- /dev/null
+++ b/features/kalibro_configuration/show.feature
@@ -0,0 +1,10 @@
+Feature: Show Configuration
+ In order to know all the contents of a given configuration
+ As a regular user
+ I should be able to see each of them
+
+@kalibro_configuration_restart
+Scenario: Checking configuration contents
+ Given I have a sample configuration
+ When I am at the Sample Configuration page
+ Then the sample configuration should be there
\ No newline at end of file
diff --git a/features/mezuro_configuration/create.feature b/features/mezuro_configuration/create.feature
deleted file mode 100644
index 7a42823..0000000
--- a/features/mezuro_configuration/create.feature
+++ /dev/null
@@ -1,41 +0,0 @@
-Feature: Configuration Creation
- In order to register my configurations
- As a regular user
- I should be able to create configurations
-
- @kalibro_configuration_restart
- Scenario: Should not create configuration without login
- Given I am at the All Configurations page
- Then I should not see "New Configuration"
-
- @kalibro_configuration_restart
- Scenario: configuration creation
- Given I am a regular user
- And I am signed in
- And I am at the New Configuration page
- And I fill the Name field with "Kalibro"
- And I fill the Description field with "Web Service to collect metrics"
- When I press the Save button
- Then I should see "Kalibro"
- And I should see "Web Service to collect metrics"
-
- @kalibro_configuration_restart
- Scenario: configuration creation with already taken name
- Given I am a regular user
- And I am signed in
- And I have a configuration named "Kalibro"
- And I am at the New Configuration page
- And I fill the Name field with "Kalibro"
- And I fill the Description field with "Web Service to collect metrics"
- When I press the Save button
- Then I should see "Name There is already a KalibroConfiguration with name Kalibro!"
-
- @kalibro_configuration_restart
- Scenario: configuration creation with blank name
- Given I am a regular user
- And I am signed in
- And I am at the New Configuration page
- And I fill the Name field with " "
- And I fill the Description field with "Web Service to collect metrics"
- When I press the Save button
- Then I should see "Name can't be blank"
diff --git a/features/mezuro_configuration/deletion.feature b/features/mezuro_configuration/deletion.feature
deleted file mode 100644
index a3fceee..0000000
--- a/features/mezuro_configuration/deletion.feature
+++ /dev/null
@@ -1,28 +0,0 @@
-Feature: Configuration Deletion
- In order to be able to remove configurations
- As a regular user
- The system should have an interface to it
-
- @kalibro_configuration_restart
- Scenario: Should not delete a configuration without user authentication
- Given I have a sample configuration
- When I am at the Sample Configuration page
- Then I should not see "Destroy"
-
- @kalibro_configuration_restart
- Scenario: Should not delete a configuration that doesn't belongs to user
- Given I am a regular user
- And I am signed in
- And I have a sample configuration
- When I am at the Sample Configuration page
- Then I should not see "Destroy"
-
- @kalibro_configuration_restart
- Scenario: Should delete a configuration that I own
- Given I am a regular user
- And I am signed in
- And I own a sample configuration
- And I am at the Sample Configuration page
- When I click the Destroy Configuration link
- Then I should be in the All configurations page
- And the sample configuration should not be there
diff --git a/features/mezuro_configuration/edition.feature b/features/mezuro_configuration/edition.feature
deleted file mode 100644
index ecb0116..0000000
--- a/features/mezuro_configuration/edition.feature
+++ /dev/null
@@ -1,83 +0,0 @@
-Feature: Configuration
- In Order to be able to update my configurations info
- As a regular user
- I should be able to edit my configurations
-
- @kalibro_configuration_restart
- Scenario: Should go to the edit page from a configuration that I own
- Given I am a regular user
- And I am signed in
- And I own a sample configuration
- And I am at the All Configurations page
- When I click the Edit link
- Then I should be in the Edit Configuration page
-
- @kalibro_configuration_restart
- Scenario: Should not show edit links from configurations that doesn't belongs to me
- Given I am a regular user
- And I am signed in
- And I have a sample configuration
- And I am at the All Configurations page
- Then I should not see Edit within table
-
- @kalibro_configuration_restart
- Scenario: Should not render the edit page if the configuration doesn't belongs to the current user
- Given I am a regular user
- And I am signed in
- And I have a sample configuration
- And I am at the All Projects page
- When I visit the sample configuration edit page
- Then I should see "You're not allowed to do this operation"
-
- @kalibro_configuration_restart
- Scenario: Filling up the form
- Given I am a regular user
- And I am signed in
- And I own a sample configuration
- And I am at the All Configurations page
- When I click the Edit link
- Then The field "kalibro_configuration[name]" should be filled with the sample configuration "name"
- And The field "kalibro_configuration[description]" should be filled with the sample configuration "description"
-
- @kalibro_configuration_restart
- Scenario: With valid attributes
- Given I am a regular user
- And I am signed in
- And I own a sample configuration
- And I am at the sample configuration edit page
- And I fill the Name field with "Kalibro"
- And I fill the Description field with "Web Service to collect metrics"
- When I press the Save button
- Then I should see "Kalibro"
- And I should see "Web Service to collect metrics"
-
- @kalibro_configuration_restart
- Scenario: With configuration name already taken
- Given I am a regular user
- And I am signed in
- And I have a configuration named "Qt-Calculator"
- And I own a configuration named "Kalibro"
- And I am at the sample configuration edit page
- And I fill the Name field with "Qt-Calculator"
- When I press the Save button
- Then I should see "Name There is already a KalibroConfiguration with name Qt-Calculator!"
-
- @kalibro_configuration_restart
- Scenario: Editing just the description
- Given I am a regular user
- And I am signed in
- And I own a sample configuration
- And I am at the sample configuration edit page
- And I fill the Description field with "Web Service to collect metrics"
- When I press the Save button
- And I should see "Web Service to collect metrics"
-
- @kalibro_configuration_restart
- Scenario: With blank configuration name
- Given I am a regular user
- And I am signed in
- And I own a sample configuration
- And I am at the sample configuration edit page
- And I fill the Name field with " "
- When I press the Save button
- Then I should see "Name can't be blank"
diff --git a/features/mezuro_configuration/listing.feature b/features/mezuro_configuration/listing.feature
deleted file mode 100644
index 60a2c09..0000000
--- a/features/mezuro_configuration/listing.feature
+++ /dev/null
@@ -1,30 +0,0 @@
-Feature: Configuration listing
- In order to interact with other configurations
- As a regular user
- I should have various listings
-
- Scenario: Listing configurations
- Given I am at the homepage
- When I click the Configuration link
- Then I should see "Configurations"
- And I should see "Name"
- And I should see "Description"
- And I should see "You must be logged in to create new Configurations."
-
- @kalibro_configuration_restart
- Scenario: Should list the existing configurations
- Given I am a regular user
- And I am signed in
- And I have a sample configuration
- And I am at the All Configurations page
- Then the sample configuration should be there
- And I should not see "You must be logged in to create new Configurations."
-
- @kalibro_configuration_restart
- Scenario: Should show the existing configuration
- Given I am a regular user
- And I am signed in
- And I have a sample configuration
- And I am at the All Configurations page
- When I click the Show link
- Then the sample configuration should be there
\ No newline at end of file
diff --git a/features/mezuro_configuration/show.feature b/features/mezuro_configuration/show.feature
deleted file mode 100644
index 592e6af..0000000
--- a/features/mezuro_configuration/show.feature
+++ /dev/null
@@ -1,10 +0,0 @@
-Feature: Show Configuration
- In order to know all the contents of a given configuration
- As a regular user
- I should be able to see each of them
-
-@kalibro_configuration_restart
-Scenario: Checking configuration contents
- Given I have a sample configuration
- When I am at the Sample Configuration page
- Then the sample configuration should be there
\ No newline at end of file
diff --git a/features/step_definitions/configuration_steps.rb b/features/step_definitions/configuration_steps.rb
deleted file mode 100644
index 373d5ee..0000000
--- a/features/step_definitions/configuration_steps.rb
+++ /dev/null
@@ -1,58 +0,0 @@
-Given(/^I am at the All Configurations page$/) do
- visit kalibro_configurations_path
-end
-
-Given(/^I am at the New Configuration page$/) do
- visit new_kalibro_configuration_path
-end
-
-Given(/^I have a configuration named "(.*?)"$/) do |name|
- @kalibro_configuration = FactoryGirl.create(:kalibro_configuration, {name: name})
-end
-
-Given(/^I have a sample configuration$/) do
- @kalibro_configuration = FactoryGirl.create(:kalibro_configuration)
-end
-
-Given(/^I own a sample configuration$/) do
- @kalibro_configuration = FactoryGirl.create(:kalibro_configuration)
- FactoryGirl.create(:kalibro_configuration_ownership, {id: nil, user_id: @user.id, kalibro_configuration_id: @kalibro_configuration.id})
-end
-
-Given(/^I am at the Sample Configuration page$/) do
- visit kalibro_configuration_path(@kalibro_configuration.id)
-end
-
-Given(/^I am at the sample configuration edit page$/) do
- visit edit_kalibro_configuration_path(@kalibro_configuration.id)
-end
-
-Given(/^I own a configuration named "(.*?)"$/) do |name|
- @kalibro_configuration = FactoryGirl.create(:kalibro_configuration, {name: name})
- FactoryGirl.create(:kalibro_configuration_ownership, {id: nil, user_id: @user.id, kalibro_configuration_id: @kalibro_configuration.id})
-end
-
-When(/^I visit the sample configuration edit page$/) do
- visit edit_kalibro_configuration_path(@kalibro_configuration.id)
-end
-
-Then(/^I should be in the Edit Configuration page$/) do
- expect(page).to have_content("Edit Configuration")
-end
-
-Then(/^The field "(.*?)" should be filled with the sample configuration "(.*?)"$/) do |field, value|
- expect(page.find_field(field).value).to eq(@kalibro_configuration.send(value))
-end
-
-Then(/^I should be in the All configurations page$/) do
- expect(page).to have_content("Configurations")
-end
-
-Then(/^the sample configuration should not be there$/) do
- expect { KalibroConfiguration.find(@kalibro_configuration.id) }.to raise_error
-end
-
-Then(/^the sample configuration should be there$/) do
- expect(page).to have_content(@kalibro_configuration.name)
- expect(page).to have_content(@kalibro_configuration.description)
-end
\ No newline at end of file
diff --git a/features/step_definitions/kalibro_configuration_steps.rb b/features/step_definitions/kalibro_configuration_steps.rb
new file mode 100644
index 0000000..373d5ee
--- /dev/null
+++ b/features/step_definitions/kalibro_configuration_steps.rb
@@ -0,0 +1,58 @@
+Given(/^I am at the All Configurations page$/) do
+ visit kalibro_configurations_path
+end
+
+Given(/^I am at the New Configuration page$/) do
+ visit new_kalibro_configuration_path
+end
+
+Given(/^I have a configuration named "(.*?)"$/) do |name|
+ @kalibro_configuration = FactoryGirl.create(:kalibro_configuration, {name: name})
+end
+
+Given(/^I have a sample configuration$/) do
+ @kalibro_configuration = FactoryGirl.create(:kalibro_configuration)
+end
+
+Given(/^I own a sample configuration$/) do
+ @kalibro_configuration = FactoryGirl.create(:kalibro_configuration)
+ FactoryGirl.create(:kalibro_configuration_ownership, {id: nil, user_id: @user.id, kalibro_configuration_id: @kalibro_configuration.id})
+end
+
+Given(/^I am at the Sample Configuration page$/) do
+ visit kalibro_configuration_path(@kalibro_configuration.id)
+end
+
+Given(/^I am at the sample configuration edit page$/) do
+ visit edit_kalibro_configuration_path(@kalibro_configuration.id)
+end
+
+Given(/^I own a configuration named "(.*?)"$/) do |name|
+ @kalibro_configuration = FactoryGirl.create(:kalibro_configuration, {name: name})
+ FactoryGirl.create(:kalibro_configuration_ownership, {id: nil, user_id: @user.id, kalibro_configuration_id: @kalibro_configuration.id})
+end
+
+When(/^I visit the sample configuration edit page$/) do
+ visit edit_kalibro_configuration_path(@kalibro_configuration.id)
+end
+
+Then(/^I should be in the Edit Configuration page$/) do
+ expect(page).to have_content("Edit Configuration")
+end
+
+Then(/^The field "(.*?)" should be filled with the sample configuration "(.*?)"$/) do |field, value|
+ expect(page.find_field(field).value).to eq(@kalibro_configuration.send(value))
+end
+
+Then(/^I should be in the All configurations page$/) do
+ expect(page).to have_content("Configurations")
+end
+
+Then(/^the sample configuration should not be there$/) do
+ expect { KalibroConfiguration.find(@kalibro_configuration.id) }.to raise_error
+end
+
+Then(/^the sample configuration should be there$/) do
+ expect(page).to have_content(@kalibro_configuration.name)
+ expect(page).to have_content(@kalibro_configuration.description)
+end
\ No newline at end of file
diff --git a/spec/helpers/kalibro_configurations_helper_spec.rb b/spec/helpers/kalibro_configurations_helper_spec.rb
new file mode 100644
index 0000000..0584715
--- /dev/null
+++ b/spec/helpers/kalibro_configurations_helper_spec.rb
@@ -0,0 +1,76 @@
+require 'rails_helper'
+
+describe KalibroConfigurationsHelper, :type => :helper do
+ describe 'kalibro_configuration_owner?' do
+ before :each do
+ @subject = FactoryGirl.build(:kalibro_configuration_with_id)
+ end
+
+ context 'returns false if not logged in' do
+ before :each do
+ helper.expects(:user_signed_in?).returns(false)
+ end
+ it { expect(helper.kalibro_configuration_owner?(@subject.id)).to be_falsey }
+ end
+
+ context 'returns false if is not the owner' do
+ before :each do
+ helper.expects(:user_signed_in?).returns(true)
+ helper.expects(:current_user).returns(FactoryGirl.build(:user))
+
+ @ownerships = []
+ @ownerships.expects(:find_by_kalibro_configuration_id).with(@subject.id).returns(nil)
+
+ User.any_instance.expects(:kalibro_configuration_ownerships).returns(@ownerships)
+ end
+
+ it { expect(helper.kalibro_configuration_owner?(@subject.id)).to be_falsey }
+ end
+
+ context 'returns true if user is the kalibro_configuration owner' do
+ before :each do
+ helper.expects(:user_signed_in?).returns(true)
+ helper.expects(:current_user).returns(FactoryGirl.build(:user))
+
+ @ownership = FactoryGirl.build(:kalibro_configuration_ownership)
+ @ownerships = []
+ @ownerships.expects(:find_by_kalibro_configuration_id).with(@subject.id).returns(@ownership)
+ User.any_instance.expects(:kalibro_configuration_ownerships).returns(@ownerships)
+ end
+
+ it { expect(helper.kalibro_configuration_owner?(@subject.id)).to be_truthy }
+ end
+ end
+
+ describe 'link to edit form' do
+ context 'when the metric is native' do
+ let(:metric_configuration) { FactoryGirl.build(:metric_configuration_with_id) }
+ let(:response_link) {"Edit"}
+
+ it { expect(helper.link_to_edit_form(metric_configuration, metric_configuration.kalibro_configuration_id)).to eq(response_link) }
+ end
+
+ context 'when the metric is compound' do
+ let(:compound_metric_configuration) { FactoryGirl.build(:compound_metric_configuration_with_id) }
+ let(:response_link) {"Edit"}
+
+ it { expect(helper.link_to_edit_form(compound_metric_configuration, compound_metric_configuration.kalibro_configuration_id)).to eq(response_link) }
+ end
+ end
+
+ describe 'link to show page' do
+ context 'when the metric is native' do
+ let(:metric_configuration) { FactoryGirl.build(:metric_configuration_with_id) }
+ let(:response_link) {"Show"}
+
+ it { expect(helper.link_to_show_page(metric_configuration, metric_configuration.kalibro_configuration_id)).to eq(response_link) }
+ end
+
+ context 'when the metric is compound' do
+ let(:compound_metric_configuration) { FactoryGirl.build(:compound_metric_configuration_with_id) }
+ let(:response_link) {"Show"}
+
+ it { expect(helper.link_to_show_page(compound_metric_configuration, compound_metric_configuration.kalibro_configuration_id)).to eq(response_link) }
+ end
+ end
+end
diff --git a/spec/helpers/mezuro_configurations_helper_spec.rb b/spec/helpers/mezuro_configurations_helper_spec.rb
deleted file mode 100644
index 0584715..0000000
--- a/spec/helpers/mezuro_configurations_helper_spec.rb
+++ /dev/null
@@ -1,76 +0,0 @@
-require 'rails_helper'
-
-describe KalibroConfigurationsHelper, :type => :helper do
- describe 'kalibro_configuration_owner?' do
- before :each do
- @subject = FactoryGirl.build(:kalibro_configuration_with_id)
- end
-
- context 'returns false if not logged in' do
- before :each do
- helper.expects(:user_signed_in?).returns(false)
- end
- it { expect(helper.kalibro_configuration_owner?(@subject.id)).to be_falsey }
- end
-
- context 'returns false if is not the owner' do
- before :each do
- helper.expects(:user_signed_in?).returns(true)
- helper.expects(:current_user).returns(FactoryGirl.build(:user))
-
- @ownerships = []
- @ownerships.expects(:find_by_kalibro_configuration_id).with(@subject.id).returns(nil)
-
- User.any_instance.expects(:kalibro_configuration_ownerships).returns(@ownerships)
- end
-
- it { expect(helper.kalibro_configuration_owner?(@subject.id)).to be_falsey }
- end
-
- context 'returns true if user is the kalibro_configuration owner' do
- before :each do
- helper.expects(:user_signed_in?).returns(true)
- helper.expects(:current_user).returns(FactoryGirl.build(:user))
-
- @ownership = FactoryGirl.build(:kalibro_configuration_ownership)
- @ownerships = []
- @ownerships.expects(:find_by_kalibro_configuration_id).with(@subject.id).returns(@ownership)
- User.any_instance.expects(:kalibro_configuration_ownerships).returns(@ownerships)
- end
-
- it { expect(helper.kalibro_configuration_owner?(@subject.id)).to be_truthy }
- end
- end
-
- describe 'link to edit form' do
- context 'when the metric is native' do
- let(:metric_configuration) { FactoryGirl.build(:metric_configuration_with_id) }
- let(:response_link) {"Edit"}
-
- it { expect(helper.link_to_edit_form(metric_configuration, metric_configuration.kalibro_configuration_id)).to eq(response_link) }
- end
-
- context 'when the metric is compound' do
- let(:compound_metric_configuration) { FactoryGirl.build(:compound_metric_configuration_with_id) }
- let(:response_link) {"Edit"}
-
- it { expect(helper.link_to_edit_form(compound_metric_configuration, compound_metric_configuration.kalibro_configuration_id)).to eq(response_link) }
- end
- end
-
- describe 'link to show page' do
- context 'when the metric is native' do
- let(:metric_configuration) { FactoryGirl.build(:metric_configuration_with_id) }
- let(:response_link) {"Show"}
-
- it { expect(helper.link_to_show_page(metric_configuration, metric_configuration.kalibro_configuration_id)).to eq(response_link) }
- end
-
- context 'when the metric is compound' do
- let(:compound_metric_configuration) { FactoryGirl.build(:compound_metric_configuration_with_id) }
- let(:response_link) {"Show"}
-
- it { expect(helper.link_to_show_page(compound_metric_configuration, compound_metric_configuration.kalibro_configuration_id)).to eq(response_link) }
- end
- end
-end
diff --git a/spec/routing/kalibro_configuration_routing_spec.rb b/spec/routing/kalibro_configuration_routing_spec.rb
new file mode 100644
index 0000000..3230bdd
--- /dev/null
+++ b/spec/routing/kalibro_configuration_routing_spec.rb
@@ -0,0 +1,20 @@
+require "rails_helper"
+
+describe KalibroConfigurationsController, :type => :routing do
+ describe "routing" do
+ it { is_expected.to route(:get, '/kalibro_configurations/new').
+ to(controller: :kalibro_configurations, action: :new) }
+ it { is_expected.to route(:get, '/kalibro_configurations').
+ to(controller: :kalibro_configurations, action: :index) }
+ it { is_expected.to route(:post, '/kalibro_configurations').
+ to(controller: :kalibro_configurations, action: :create) }
+ it { is_expected.to route(:get, '/kalibro_configurations/1').
+ to(controller: :kalibro_configurations, action: :show, id: "1") }
+ it { is_expected.to route(:get, '/kalibro_configurations/1/edit').
+ to(controller: :kalibro_configurations, action: :edit, id: "1") }
+ it { is_expected.to route(:put, '/kalibro_configurations/1').
+ to(controller: :kalibro_configurations, action: :update, id: "1") }
+ it { is_expected.to route(:delete, '/kalibro_configurations/1').
+ to(controller: :kalibro_configurations, action: :destroy, id: "1") }
+ end
+end
diff --git a/spec/routing/mezuro_configuration_routing_spec.rb b/spec/routing/mezuro_configuration_routing_spec.rb
deleted file mode 100644
index 3230bdd..0000000
--- a/spec/routing/mezuro_configuration_routing_spec.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-require "rails_helper"
-
-describe KalibroConfigurationsController, :type => :routing do
- describe "routing" do
- it { is_expected.to route(:get, '/kalibro_configurations/new').
- to(controller: :kalibro_configurations, action: :new) }
- it { is_expected.to route(:get, '/kalibro_configurations').
- to(controller: :kalibro_configurations, action: :index) }
- it { is_expected.to route(:post, '/kalibro_configurations').
- to(controller: :kalibro_configurations, action: :create) }
- it { is_expected.to route(:get, '/kalibro_configurations/1').
- to(controller: :kalibro_configurations, action: :show, id: "1") }
- it { is_expected.to route(:get, '/kalibro_configurations/1/edit').
- to(controller: :kalibro_configurations, action: :edit, id: "1") }
- it { is_expected.to route(:put, '/kalibro_configurations/1').
- to(controller: :kalibro_configurations, action: :update, id: "1") }
- it { is_expected.to route(:delete, '/kalibro_configurations/1').
- to(controller: :kalibro_configurations, action: :destroy, id: "1") }
- end
-end
--
libgit2 0.21.2