Commit f9a0274c98136b8a9915f1095f79c2af7b3439a0
1 parent
a70a2ef5
Exists in
colab
and in
4 other branches
Renamed MezuroConfiguration to KalibroConfiguration
Otherwise, ActiveResource requests would look for the unexistent route /mezuro_configurations instead of /kalibro_configuration which is the route expected by KalibroConfigurations webservice.
Showing
76 changed files
with
610 additions
and
600 deletions
Show diff stats
app/controllers/base_metric_configurations_controller.rb
| @@ -5,19 +5,19 @@ include ResourceFinder | @@ -5,19 +5,19 @@ include ResourceFinder | ||
| 5 | class BaseMetricConfigurationsController < ApplicationController | 5 | class BaseMetricConfigurationsController < ApplicationController |
| 6 | before_action :authenticate_user!, except: [:show, :index] | 6 | before_action :authenticate_user!, except: [:show, :index] |
| 7 | before_action :metric_configuration_owner?, only: [:edit, :update, :destroy] | 7 | before_action :metric_configuration_owner?, only: [:edit, :update, :destroy] |
| 8 | - before_action :mezuro_configuration_owner?, only: [:new, :create, :choose_metric] | 8 | + before_action :kalibro_configuration_owner?, only: [:new, :create, :choose_metric] |
| 9 | before_action :set_metric_configuration, only: [:show, :edit, :update, :destroy] | 9 | before_action :set_metric_configuration, only: [:show, :edit, :update, :destroy] |
| 10 | 10 | ||
| 11 | def new | 11 | def new |
| 12 | update_metric_configuration(MetricConfiguration.new) | 12 | update_metric_configuration(MetricConfiguration.new) |
| 13 | - metric_configuration.configuration_id = params[:mezuro_configuration_id].to_i | 13 | + metric_configuration.configuration_id = params[:kalibro_configuration_id].to_i |
| 14 | end | 14 | end |
| 15 | 15 | ||
| 16 | def show | 16 | def show |
| 17 | if metric_configuration | 17 | if metric_configuration |
| 18 | @reading_group = ReadingGroup.find(metric_configuration.reading_group_id) | 18 | @reading_group = ReadingGroup.find(metric_configuration.reading_group_id) |
| 19 | @mezuro_ranges = metric_configuration.kalibro_ranges | 19 | @mezuro_ranges = metric_configuration.kalibro_ranges |
| 20 | - metric_configuration.configuration_id = params[:mezuro_configuration_id].to_i | 20 | + metric_configuration.configuration_id = params[:kalibro_configuration_id].to_i |
| 21 | else | 21 | else |
| 22 | raise NotImplementedError | 22 | raise NotImplementedError |
| 23 | end | 23 | end |
| @@ -25,7 +25,7 @@ class BaseMetricConfigurationsController < ApplicationController | @@ -25,7 +25,7 @@ class BaseMetricConfigurationsController < ApplicationController | ||
| 25 | 25 | ||
| 26 | def create | 26 | def create |
| 27 | update_metric_configuration(MetricConfiguration.new(metric_configuration_params)) | 27 | update_metric_configuration(MetricConfiguration.new(metric_configuration_params)) |
| 28 | - metric_configuration.configuration_id = params[:mezuro_configuration_id].to_i | 28 | + metric_configuration.configuration_id = params[:kalibro_configuration_id].to_i |
| 29 | end | 29 | end |
| 30 | 30 | ||
| 31 | protected | 31 | protected |
app/controllers/compound_metric_configurations_controller.rb
| @@ -7,7 +7,7 @@ class CompoundMetricConfigurationsController < BaseMetricConfigurationsControlle | @@ -7,7 +7,7 @@ class CompoundMetricConfigurationsController < BaseMetricConfigurationsControlle | ||
| 7 | respond_to do |format| | 7 | respond_to do |format| |
| 8 | create_and_redir(format) | 8 | create_and_redir(format) |
| 9 | end | 9 | end |
| 10 | - Rails.cache.delete("#{params[:mezuro_configuration_id].to_i}_metric_configurations") | 10 | + Rails.cache.delete("#{params[:kalibro_configuration_id].to_i}_metric_configurations") |
| 11 | end | 11 | end |
| 12 | 12 | ||
| 13 | def show | 13 | def show |
| @@ -17,14 +17,14 @@ class CompoundMetricConfigurationsController < BaseMetricConfigurationsControlle | @@ -17,14 +17,14 @@ class CompoundMetricConfigurationsController < BaseMetricConfigurationsControlle | ||
| 17 | 17 | ||
| 18 | def edit | 18 | def edit |
| 19 | @compound_metric_configuration = @metric_configuration | 19 | @compound_metric_configuration = @metric_configuration |
| 20 | - @compound_metric_configuration.configuration_id = params[:mezuro_configuration_id].to_i | 20 | + @compound_metric_configuration.configuration_id = params[:kalibro_configuration_id].to_i |
| 21 | end | 21 | end |
| 22 | 22 | ||
| 23 | def update | 23 | def update |
| 24 | respond_to do |format| | 24 | respond_to do |format| |
| 25 | edit | 25 | edit |
| 26 | if @compound_metric_configuration.update(metric_configuration_params) | 26 | if @compound_metric_configuration.update(metric_configuration_params) |
| 27 | - format.html { redirect_to mezuro_configuration_path(@compound_metric_configuration.configuration_id), notice: 'Compound Metric Configuration was successfully updated.' } | 27 | + format.html { redirect_to kalibro_configuration_path(@compound_metric_configuration.configuration_id), notice: 'Compound Metric Configuration was successfully updated.' } |
| 28 | format.json { head :no_content } | 28 | format.json { head :no_content } |
| 29 | else | 29 | else |
| 30 | failed_action(format, 'edit') | 30 | failed_action(format, 'edit') |
| @@ -52,7 +52,7 @@ class CompoundMetricConfigurationsController < BaseMetricConfigurationsControlle | @@ -52,7 +52,7 @@ class CompoundMetricConfigurationsController < BaseMetricConfigurationsControlle | ||
| 52 | 52 | ||
| 53 | # Duplicated code on create and update actions extracted here | 53 | # Duplicated code on create and update actions extracted here |
| 54 | def failed_action(format, destiny_action) | 54 | def failed_action(format, destiny_action) |
| 55 | - @mezuro_configuration_id = params[:mezuro_configuration_id] | 55 | + @kalibro_configuration_id = params[:kalibro_configuration_id] |
| 56 | 56 | ||
| 57 | set_metric_configurations | 57 | set_metric_configurations |
| 58 | format.html { render action: destiny_action } | 58 | format.html { render action: destiny_action } |
| @@ -62,14 +62,14 @@ class CompoundMetricConfigurationsController < BaseMetricConfigurationsControlle | @@ -62,14 +62,14 @@ class CompoundMetricConfigurationsController < BaseMetricConfigurationsControlle | ||
| 62 | #Code extracted from create action | 62 | #Code extracted from create action |
| 63 | def create_and_redir(format) | 63 | def create_and_redir(format) |
| 64 | if @compound_metric_configuration.save | 64 | if @compound_metric_configuration.save |
| 65 | - format.html { redirect_to mezuro_configuration_path(@compound_metric_configuration.configuration_id), notice: 'Compound Metric Configuration was successfully created.' } | 65 | + format.html { redirect_to kalibro_configuration_path(@compound_metric_configuration.configuration_id), notice: 'Compound Metric Configuration was successfully created.' } |
| 66 | else | 66 | else |
| 67 | failed_action(format, 'new') | 67 | failed_action(format, 'new') |
| 68 | end | 68 | end |
| 69 | end | 69 | end |
| 70 | 70 | ||
| 71 | def set_metric_configurations | 71 | def set_metric_configurations |
| 72 | - @metric_configurations = MetricConfiguration.metric_configurations_of(params[:mezuro_configuration_id].to_i) | 72 | + @metric_configurations = MetricConfiguration.metric_configurations_of(params[:kalibro_configuration_id].to_i) |
| 73 | end | 73 | end |
| 74 | 74 | ||
| 75 | end | 75 | end |
app/controllers/concerns/ownership_authentication.rb
| @@ -33,19 +33,19 @@ module OwnershipAuthentication | @@ -33,19 +33,19 @@ module OwnershipAuthentication | ||
| 33 | check_reading_group_ownership(params[:reading_group_id]) | 33 | check_reading_group_ownership(params[:reading_group_id]) |
| 34 | end | 34 | end |
| 35 | 35 | ||
| 36 | - def mezuro_configuration_owner? | ||
| 37 | - if self.kind_of?(MezuroConfigurationsController) | 36 | + def kalibro_configuration_owner? |
| 37 | + if self.kind_of?(KalibroConfigurationsController) | ||
| 38 | id = params[:id] | 38 | id = params[:id] |
| 39 | elsif (self.kind_of?(BaseMetricConfigurationsController)) | 39 | elsif (self.kind_of?(BaseMetricConfigurationsController)) |
| 40 | - id = params[:mezuro_configuration_id] | 40 | + id = params[:kalibro_configuration_id] |
| 41 | else | 41 | else |
| 42 | raise "Not supported" | 42 | raise "Not supported" |
| 43 | end | 43 | end |
| 44 | - check_mezuro_configuration_ownership(id) | 44 | + check_kalibro_configuration_ownership(id) |
| 45 | end | 45 | end |
| 46 | 46 | ||
| 47 | def metric_configuration_owner? | 47 | def metric_configuration_owner? |
| 48 | - check_mezuro_configuration_ownership(params[:mezuro_configuration_id]) | 48 | + check_kalibro_configuration_ownership(params[:kalibro_configuration_id]) |
| 49 | end | 49 | end |
| 50 | 50 | ||
| 51 | 51 | ||
| @@ -73,10 +73,10 @@ module OwnershipAuthentication | @@ -73,10 +73,10 @@ module OwnershipAuthentication | ||
| 73 | return true | 73 | return true |
| 74 | end | 74 | end |
| 75 | 75 | ||
| 76 | - def check_mezuro_configuration_ownership(id) | ||
| 77 | - if current_user.mezuro_configuration_ownerships.find_by_mezuro_configuration_id(id).nil? | 76 | + def check_kalibro_configuration_ownership(id) |
| 77 | + if current_user.kalibro_configuration_ownerships.find_by_kalibro_configuration_id(id).nil? | ||
| 78 | respond_to do |format| | 78 | respond_to do |format| |
| 79 | - format.html { redirect_to mezuro_configurations_url(id), notice: "You're not allowed to do this operation" } | 79 | + format.html { redirect_to kalibro_configurations_url(id), notice: "You're not allowed to do this operation" } |
| 80 | format.json { head :no_content } | 80 | format.json { head :no_content } |
| 81 | end | 81 | end |
| 82 | end | 82 | end |
| @@ -0,0 +1,89 @@ | @@ -0,0 +1,89 @@ | ||
| 1 | +include OwnershipAuthentication | ||
| 2 | +include ResourceFinder | ||
| 3 | + | ||
| 4 | +class KalibroConfigurationsController < ApplicationController | ||
| 5 | + before_action :authenticate_user!, except: [:index, :show] | ||
| 6 | + before_action :kalibro_configuration_owner?, only: [:edit, :update, :destroy] | ||
| 7 | + | ||
| 8 | + # GET /kalibro_configurations/new | ||
| 9 | + def new | ||
| 10 | + @kalibro_configuration = KalibroConfiguration.new | ||
| 11 | + end | ||
| 12 | + | ||
| 13 | + # GET /kalibro_configurations | ||
| 14 | + # GET /kalibro_configurations.json | ||
| 15 | + def index | ||
| 16 | + @kalibro_configurations = KalibroConfiguration.all | ||
| 17 | + end | ||
| 18 | + | ||
| 19 | + # POST /kalibro_configurations | ||
| 20 | + # POST /kalibro_configurations.json | ||
| 21 | + def create | ||
| 22 | + @kalibro_configuration = KalibroConfiguration.new(kalibro_configuration_params) | ||
| 23 | + respond_to do |format| | ||
| 24 | + create_and_redir(format) | ||
| 25 | + end | ||
| 26 | + end | ||
| 27 | + | ||
| 28 | + # GET /kalibro_configurations/1 | ||
| 29 | + # GET /kalibro_configurations/1.json | ||
| 30 | + def show | ||
| 31 | + set_kalibro_configuration | ||
| 32 | + Rails.cache.fetch("#{@kalibro_configuration.id}_metric_configurations") do | ||
| 33 | + @kalibro_configuration.metric_configurations | ||
| 34 | + end | ||
| 35 | + end | ||
| 36 | + | ||
| 37 | + # GET /kalibro_configurations/1/edit | ||
| 38 | + # GET /kalibro_configurations/1/edit.json | ||
| 39 | + def edit | ||
| 40 | + set_kalibro_configuration | ||
| 41 | + end | ||
| 42 | + | ||
| 43 | + | ||
| 44 | + def update | ||
| 45 | + set_kalibro_configuration | ||
| 46 | + if @kalibro_configuration.update(kalibro_configuration_params) | ||
| 47 | + redirect_to(kalibro_configuration_path(@kalibro_configuration.id)) | ||
| 48 | + else | ||
| 49 | + render "edit" | ||
| 50 | + end | ||
| 51 | + end | ||
| 52 | + | ||
| 53 | + # DELETE /kalibro_configurations/1 | ||
| 54 | + # DELETE /kalibro_configurations/1.json | ||
| 55 | + def destroy | ||
| 56 | + set_kalibro_configuration | ||
| 57 | + current_user.kalibro_configuration_ownerships.find_by_kalibro_configuration_id(@kalibro_configuration.id).destroy | ||
| 58 | + @kalibro_configuration.destroy | ||
| 59 | + respond_to do |format| | ||
| 60 | + format.html { redirect_to kalibro_configurations_url } | ||
| 61 | + format.json { head :no_content } | ||
| 62 | + end | ||
| 63 | + Rails.cache.delete("#{@kalibro_configuration.id}_metrics") | ||
| 64 | + end | ||
| 65 | + | ||
| 66 | + private | ||
| 67 | + # Use callbacks to share common setup or constraints between actions. | ||
| 68 | + def set_kalibro_configuration | ||
| 69 | + @kalibro_configuration = find_resource(KalibroConfiguration, params[:id].to_i) | ||
| 70 | + end | ||
| 71 | + | ||
| 72 | + # Never trust parameters from the scary internet, only allow the white list through. | ||
| 73 | + def kalibro_configuration_params | ||
| 74 | + params[:kalibro_configuration] | ||
| 75 | + end | ||
| 76 | + | ||
| 77 | + # Extracted code from create action | ||
| 78 | + def create_and_redir(format) | ||
| 79 | + if @kalibro_configuration.save | ||
| 80 | + current_user.kalibro_configuration_ownerships.create kalibro_configuration_id: @kalibro_configuration.id | ||
| 81 | + | ||
| 82 | + format.html { redirect_to kalibro_configuration_path(@kalibro_configuration.id), notice: 'Configuration was successfully created.' } | ||
| 83 | + format.json { render action: 'show', status: :created, location: @kalibro_configuration } | ||
| 84 | + else | ||
| 85 | + format.html { render action: 'new' } | ||
| 86 | + format.json { render json: @kalibro_configuration.errors, status: :unprocessable_entity } | ||
| 87 | + end | ||
| 88 | + end | ||
| 89 | +end |
app/controllers/metric_configurations_controller.rb
| 1 | class MetricConfigurationsController < BaseMetricConfigurationsController | 1 | class MetricConfigurationsController < BaseMetricConfigurationsController |
| 2 | def choose_metric | 2 | def choose_metric |
| 3 | - @mezuro_configuration_id = params[:mezuro_configuration_id].to_i | 3 | + @kalibro_configuration_id = params[:kalibro_configuration_id].to_i |
| 4 | @metric_configuration_id = params[:metric_configuration_id].to_i | 4 | @metric_configuration_id = params[:metric_configuration_id].to_i |
| 5 | @metric_collectors = KalibroClient::Processor::MetricCollector.all | 5 | @metric_collectors = KalibroClient::Processor::MetricCollector.all |
| 6 | end | 6 | end |
| @@ -19,20 +19,20 @@ class MetricConfigurationsController < BaseMetricConfigurationsController | @@ -19,20 +19,20 @@ class MetricConfigurationsController < BaseMetricConfigurationsController | ||
| 19 | respond_to do |format| | 19 | respond_to do |format| |
| 20 | create_and_redir(format) | 20 | create_and_redir(format) |
| 21 | end | 21 | end |
| 22 | - Rails.cache.delete("#{params[:mezuro_configuration_id]}_metric_configurations") | 22 | + Rails.cache.delete("#{params[:kalibro_configuration_id]}_metric_configurations") |
| 23 | end | 23 | end |
| 24 | 24 | ||
| 25 | def edit | 25 | def edit |
| 26 | #FIXME: set the configuration id just once! | 26 | #FIXME: set the configuration id just once! |
| 27 | - @mezuro_configuration_id = params[:mezuro_configuration_id] | ||
| 28 | - @metric_configuration.configuration_id = @mezuro_configuration_id | 27 | + @kalibro_configuration_id = params[:kalibro_configuration_id] |
| 28 | + @metric_configuration.configuration_id = @kalibro_configuration_id | ||
| 29 | end | 29 | end |
| 30 | 30 | ||
| 31 | def update | 31 | def update |
| 32 | respond_to do |format| | 32 | respond_to do |format| |
| 33 | - @metric_configuration.configuration_id = params[:mezuro_configuration_id] | 33 | + @metric_configuration.configuration_id = params[:kalibro_configuration_id] |
| 34 | if @metric_configuration.update(metric_configuration_params) | 34 | if @metric_configuration.update(metric_configuration_params) |
| 35 | - format.html { redirect_to(mezuro_configuration_path(@metric_configuration.configuration_id), notice: 'Metric Configuration was successfully updated.') } | 35 | + format.html { redirect_to(kalibro_configuration_path(@metric_configuration.configuration_id), notice: 'Metric Configuration was successfully updated.') } |
| 36 | format.json { head :no_content } | 36 | format.json { head :no_content } |
| 37 | Rails.cache.delete("#{@metric_configuration.configuration_id}_metric_configurations") | 37 | Rails.cache.delete("#{@metric_configuration.configuration_id}_metric_configurations") |
| 38 | else | 38 | else |
| @@ -44,10 +44,10 @@ class MetricConfigurationsController < BaseMetricConfigurationsController | @@ -44,10 +44,10 @@ class MetricConfigurationsController < BaseMetricConfigurationsController | ||
| 44 | def destroy | 44 | def destroy |
| 45 | @metric_configuration.destroy | 45 | @metric_configuration.destroy |
| 46 | respond_to do |format| | 46 | respond_to do |format| |
| 47 | - format.html { redirect_to mezuro_configuration_path(params[:mezuro_configuration_id]) } | 47 | + format.html { redirect_to kalibro_configuration_path(params[:kalibro_configuration_id]) } |
| 48 | format.json { head :no_content } | 48 | format.json { head :no_content } |
| 49 | end | 49 | end |
| 50 | - Rails.cache.delete("#{params[:mezuro_configuration_id]}_metric_configurations") | 50 | + Rails.cache.delete("#{params[:kalibro_configuration_id]}_metric_configurations") |
| 51 | end | 51 | end |
| 52 | 52 | ||
| 53 | protected | 53 | protected |
| @@ -64,7 +64,7 @@ class MetricConfigurationsController < BaseMetricConfigurationsController | @@ -64,7 +64,7 @@ class MetricConfigurationsController < BaseMetricConfigurationsController | ||
| 64 | 64 | ||
| 65 | # Duplicated code on create and update actions extracted here | 65 | # Duplicated code on create and update actions extracted here |
| 66 | def failed_action(format, destiny_action) | 66 | def failed_action(format, destiny_action) |
| 67 | - @mezuro_configuration_id = params[:mezuro_configuration_id] | 67 | + @kalibro_configuration_id = params[:kalibro_configuration_id] |
| 68 | 68 | ||
| 69 | format.html { render action: destiny_action } | 69 | format.html { render action: destiny_action } |
| 70 | format.json { render json: @metric_configuration.errors, status: :unprocessable_entity } | 70 | format.json { render json: @metric_configuration.errors, status: :unprocessable_entity } |
| @@ -73,7 +73,7 @@ class MetricConfigurationsController < BaseMetricConfigurationsController | @@ -73,7 +73,7 @@ class MetricConfigurationsController < BaseMetricConfigurationsController | ||
| 73 | #Code extracted from create action | 73 | #Code extracted from create action |
| 74 | def create_and_redir(format) | 74 | def create_and_redir(format) |
| 75 | if @metric_configuration.save | 75 | if @metric_configuration.save |
| 76 | - format.html { redirect_to mezuro_configuration_path(@metric_configuration.configuration_id), notice: 'Metric Configuration was successfully created.' } | 76 | + format.html { redirect_to kalibro_configuration_path(@metric_configuration.configuration_id), notice: 'Metric Configuration was successfully created.' } |
| 77 | else | 77 | else |
| 78 | failed_action(format, 'new') | 78 | failed_action(format, 'new') |
| 79 | end | 79 | end |
app/controllers/mezuro_configurations_controller.rb
| @@ -1,89 +0,0 @@ | @@ -1,89 +0,0 @@ | ||
| 1 | -include OwnershipAuthentication | ||
| 2 | -include ResourceFinder | ||
| 3 | - | ||
| 4 | -class MezuroConfigurationsController < ApplicationController | ||
| 5 | - before_action :authenticate_user!, except: [:index, :show] | ||
| 6 | - before_action :mezuro_configuration_owner?, only: [:edit, :update, :destroy] | ||
| 7 | - | ||
| 8 | - # GET /mezuro_configurations/new | ||
| 9 | - def new | ||
| 10 | - @mezuro_configuration = MezuroConfiguration.new | ||
| 11 | - end | ||
| 12 | - | ||
| 13 | - # GET /mezuro_configurations | ||
| 14 | - # GET /mezuro_configurations.json | ||
| 15 | - def index | ||
| 16 | - @mezuro_configurations = MezuroConfiguration.all | ||
| 17 | - end | ||
| 18 | - | ||
| 19 | - # POST /mezuro_configurations | ||
| 20 | - # POST /mezuro_configurations.json | ||
| 21 | - def create | ||
| 22 | - @mezuro_configuration = MezuroConfiguration.new(mezuro_configuration_params) | ||
| 23 | - respond_to do |format| | ||
| 24 | - create_and_redir(format) | ||
| 25 | - end | ||
| 26 | - end | ||
| 27 | - | ||
| 28 | - # GET /mezuro_configurations/1 | ||
| 29 | - # GET /mezuro_configurations/1.json | ||
| 30 | - def show | ||
| 31 | - set_mezuro_configuration | ||
| 32 | - Rails.cache.fetch("#{@mezuro_configuration.id}_metric_configurations") do | ||
| 33 | - @mezuro_configuration.metric_configurations | ||
| 34 | - end | ||
| 35 | - end | ||
| 36 | - | ||
| 37 | - # GET /mezuro_configurations/1/edit | ||
| 38 | - # GET /mezuro_configurations/1/edit.json | ||
| 39 | - def edit | ||
| 40 | - set_mezuro_configuration | ||
| 41 | - end | ||
| 42 | - | ||
| 43 | - | ||
| 44 | - def update | ||
| 45 | - set_mezuro_configuration | ||
| 46 | - if @mezuro_configuration.update(mezuro_configuration_params) | ||
| 47 | - redirect_to(mezuro_configuration_path(@mezuro_configuration.id)) | ||
| 48 | - else | ||
| 49 | - render "edit" | ||
| 50 | - end | ||
| 51 | - end | ||
| 52 | - | ||
| 53 | - # DELETE /mezuro_configurations/1 | ||
| 54 | - # DELETE /mezuro_configurations/1.json | ||
| 55 | - def destroy | ||
| 56 | - set_mezuro_configuration | ||
| 57 | - current_user.mezuro_configuration_ownerships.find_by_mezuro_configuration_id(@mezuro_configuration.id).destroy | ||
| 58 | - @mezuro_configuration.destroy | ||
| 59 | - respond_to do |format| | ||
| 60 | - format.html { redirect_to mezuro_configurations_url } | ||
| 61 | - format.json { head :no_content } | ||
| 62 | - end | ||
| 63 | - Rails.cache.delete("#{@mezuro_configuration.id}_metrics") | ||
| 64 | - end | ||
| 65 | - | ||
| 66 | - private | ||
| 67 | - # Use callbacks to share common setup or constraints between actions. | ||
| 68 | - def set_mezuro_configuration | ||
| 69 | - @mezuro_configuration = find_resource(MezuroConfiguration, params[:id].to_i) | ||
| 70 | - end | ||
| 71 | - | ||
| 72 | - # Never trust parameters from the scary internet, only allow the white list through. | ||
| 73 | - def mezuro_configuration_params | ||
| 74 | - params[:mezuro_configuration] | ||
| 75 | - end | ||
| 76 | - | ||
| 77 | - # Extracted code from create action | ||
| 78 | - def create_and_redir(format) | ||
| 79 | - if @mezuro_configuration.save | ||
| 80 | - current_user.mezuro_configuration_ownerships.create mezuro_configuration_id: @mezuro_configuration.id | ||
| 81 | - | ||
| 82 | - format.html { redirect_to mezuro_configuration_path(@mezuro_configuration.id), notice: 'Configuration was successfully created.' } | ||
| 83 | - format.json { render action: 'show', status: :created, location: @mezuro_configuration } | ||
| 84 | - else | ||
| 85 | - format.html { render action: 'new' } | ||
| 86 | - format.json { render json: @mezuro_configuration.errors, status: :unprocessable_entity } | ||
| 87 | - end | ||
| 88 | - end | ||
| 89 | -end |
app/controllers/mezuro_ranges_controller.rb
| @@ -23,8 +23,8 @@ class MezuroRangesController < ApplicationController | @@ -23,8 +23,8 @@ class MezuroRangesController < ApplicationController | ||
| 23 | def destroy | 23 | def destroy |
| 24 | @mezuro_range.destroy | 24 | @mezuro_range.destroy |
| 25 | respond_to do |format| | 25 | respond_to do |format| |
| 26 | - format.html { redirect_to mezuro_configuration_metric_configuration_path( | ||
| 27 | - @mezuro_configuration_id, @metric_configuration_id) } | 26 | + format.html { redirect_to kalibro_configuration_metric_configuration_path( |
| 27 | + @kalibro_configuration_id, @metric_configuration_id) } | ||
| 28 | format.json { head :no_content } | 28 | format.json { head :no_content } |
| 29 | end | 29 | end |
| 30 | end | 30 | end |
| @@ -37,8 +37,8 @@ class MezuroRangesController < ApplicationController | @@ -37,8 +37,8 @@ class MezuroRangesController < ApplicationController | ||
| 37 | respond_to do |format| | 37 | respond_to do |format| |
| 38 | @mezuro_range.metric_configuration_id = @metric_configuration_id | 38 | @mezuro_range.metric_configuration_id = @metric_configuration_id |
| 39 | if @mezuro_range.update(mezuro_range_params) | 39 | if @mezuro_range.update(mezuro_range_params) |
| 40 | - format.html { redirect_to mezuro_configuration_metric_configuration_path( | ||
| 41 | - @mezuro_configuration_id, @metric_configuration_id), notice: 'Range was successfully edited.' } | 40 | + format.html { redirect_to kalibro_configuration_metric_configuration_path( |
| 41 | + @kalibro_configuration_id, @metric_configuration_id), notice: 'Range was successfully edited.' } | ||
| 42 | format.json { head :no_content } | 42 | format.json { head :no_content } |
| 43 | else | 43 | else |
| 44 | failed_action(format, 'edit') | 44 | failed_action(format, 'edit') |
| @@ -55,8 +55,8 @@ class MezuroRangesController < ApplicationController | @@ -55,8 +55,8 @@ class MezuroRangesController < ApplicationController | ||
| 55 | 55 | ||
| 56 | def create_and_redir(format) | 56 | def create_and_redir(format) |
| 57 | if @mezuro_range.save | 57 | if @mezuro_range.save |
| 58 | - format.html { redirect_to mezuro_configuration_metric_configuration_path( | ||
| 59 | - @mezuro_configuration_id, @metric_configuration_id), notice: 'Range was successfully created.' } | 58 | + format.html { redirect_to kalibro_configuration_metric_configuration_path( |
| 59 | + @kalibro_configuration_id, @metric_configuration_id), notice: 'Range was successfully created.' } | ||
| 60 | else | 60 | else |
| 61 | failed_action(format, 'new') | 61 | failed_action(format, 'new') |
| 62 | end | 62 | end |
| @@ -75,7 +75,7 @@ class MezuroRangesController < ApplicationController | @@ -75,7 +75,7 @@ class MezuroRangesController < ApplicationController | ||
| 75 | end | 75 | end |
| 76 | 76 | ||
| 77 | def get_url_params | 77 | def get_url_params |
| 78 | - @mezuro_configuration_id = params[:mezuro_configuration_id].to_i | 78 | + @kalibro_configuration_id = params[:kalibro_configuration_id].to_i |
| 79 | @metric_configuration_id = params[:metric_configuration_id].to_i | 79 | @metric_configuration_id = params[:metric_configuration_id].to_i |
| 80 | end | 80 | end |
| 81 | 81 |
app/controllers/repositories_controller.rb
| @@ -11,7 +11,7 @@ class RepositoriesController < ApplicationController | @@ -11,7 +11,7 @@ class RepositoriesController < ApplicationController | ||
| 11 | # GET /projects/1/repositories/1/modules/1 | 11 | # GET /projects/1/repositories/1/modules/1 |
| 12 | # GET /projects/1/repositories/1/modules/1.json | 12 | # GET /projects/1/repositories/1/modules/1.json |
| 13 | def show | 13 | def show |
| 14 | - set_mezuro_configuration | 14 | + set_kalibro_configuration |
| 15 | end | 15 | end |
| 16 | 16 | ||
| 17 | # GET projects/1/repositories/new | 17 | # GET projects/1/repositories/new |
| @@ -87,7 +87,7 @@ class RepositoriesController < ApplicationController | @@ -87,7 +87,7 @@ class RepositoriesController < ApplicationController | ||
| 87 | # GET /projects/1/repositories/1/process | 87 | # GET /projects/1/repositories/1/process |
| 88 | def process_repository | 88 | def process_repository |
| 89 | @repository.process | 89 | @repository.process |
| 90 | - set_mezuro_configuration | 90 | + set_kalibro_configuration |
| 91 | respond_to do |format| | 91 | respond_to do |format| |
| 92 | format.html { redirect_to project_repository_path(@repository.project_id, @repository.id) } | 92 | format.html { redirect_to project_repository_path(@repository.project_id, @repository.id) } |
| 93 | end | 93 | end |
| @@ -108,8 +108,8 @@ private | @@ -108,8 +108,8 @@ private | ||
| 108 | @repository = find_resource(Repository, params[:id].to_i) | 108 | @repository = find_resource(Repository, params[:id].to_i) |
| 109 | end | 109 | end |
| 110 | 110 | ||
| 111 | - def set_mezuro_configuration | ||
| 112 | - @mezuro_configuration = MezuroConfiguration.find(@repository.configuration_id) | 111 | + def set_kalibro_configuration |
| 112 | + @kalibro_configuration = KalibroConfiguration.find(@repository.configuration_id) | ||
| 113 | end | 113 | end |
| 114 | 114 | ||
| 115 | # Never trust parameters from the scary internet, only allow the white list through. | 115 | # Never trust parameters from the scary internet, only allow the white list through. |
| @@ -0,0 +1,21 @@ | @@ -0,0 +1,21 @@ | ||
| 1 | +module KalibroConfigurationsHelper | ||
| 2 | + def kalibro_configuration_owner?(kalibro_configuration_id) | ||
| 3 | + user_signed_in? && !current_user.kalibro_configuration_ownerships.find_by_kalibro_configuration_id(kalibro_configuration_id).nil? | ||
| 4 | + end | ||
| 5 | + | ||
| 6 | + def link_to_edit_form(metric_configuration, kalibro_configuration_id) | ||
| 7 | + if (metric_configuration.metric.compound) | ||
| 8 | + link_to('Edit', edit_kalibro_configuration_compound_metric_configuration_path(kalibro_configuration_id, metric_configuration.id), class: 'btn btn-info') | ||
| 9 | + else | ||
| 10 | + link_to('Edit', edit_kalibro_configuration_metric_configuration_path(kalibro_configuration_id, metric_configuration.id), class: 'btn btn-info') | ||
| 11 | + end | ||
| 12 | + end | ||
| 13 | + | ||
| 14 | + def link_to_show_page(metric_configuration, kalibro_configuration_id) | ||
| 15 | + if (metric_configuration.metric.compound) | ||
| 16 | + link_to('Show', kalibro_configuration_compound_metric_configuration_path(kalibro_configuration_id, metric_configuration.id), class: 'btn btn-info') | ||
| 17 | + else | ||
| 18 | + link_to('Show', kalibro_configuration_metric_configuration_path(kalibro_configuration_id, metric_configuration.id), class: 'btn btn-info') | ||
| 19 | + end | ||
| 20 | + end | ||
| 21 | +end |
app/helpers/metric_configurations_helper.rb
| @@ -8,8 +8,8 @@ module MetricConfigurationsHelper | @@ -8,8 +8,8 @@ module MetricConfigurationsHelper | ||
| 8 | ReadingGroup.all.map { |reading_group| [reading_group.name, reading_group.id] } | 8 | ReadingGroup.all.map { |reading_group| [reading_group.name, reading_group.id] } |
| 9 | end | 9 | end |
| 10 | 10 | ||
| 11 | - def native_metrics_of(mezuro_configuration_id) | ||
| 12 | - MetricConfiguration.metric_configurations_of(mezuro_configuration_id).map do |metric_configuration| | 11 | + def native_metrics_of(kalibro_configuration_id) |
| 12 | + MetricConfiguration.metric_configurations_of(kalibro_configuration_id).map do |metric_configuration| | ||
| 13 | [ metric_configuration.code, metric_configuration.metric.name ] | 13 | [ metric_configuration.code, metric_configuration.metric.name ] |
| 14 | end | 14 | end |
| 15 | end | 15 | end |
app/helpers/mezuro_configurations_helper.rb
| @@ -1,21 +0,0 @@ | @@ -1,21 +0,0 @@ | ||
| 1 | -module MezuroConfigurationsHelper | ||
| 2 | - def mezuro_configuration_owner?(mezuro_configuration_id) | ||
| 3 | - user_signed_in? && !current_user.mezuro_configuration_ownerships.find_by_mezuro_configuration_id(mezuro_configuration_id).nil? | ||
| 4 | - end | ||
| 5 | - | ||
| 6 | - def link_to_edit_form(metric_configuration, mezuro_configuration_id) | ||
| 7 | - if (metric_configuration.metric.compound) | ||
| 8 | - link_to('Edit', edit_mezuro_configuration_compound_metric_configuration_path(mezuro_configuration_id, metric_configuration.id), class: 'btn btn-info') | ||
| 9 | - else | ||
| 10 | - link_to('Edit', edit_mezuro_configuration_metric_configuration_path(mezuro_configuration_id, metric_configuration.id), class: 'btn btn-info') | ||
| 11 | - end | ||
| 12 | - end | ||
| 13 | - | ||
| 14 | - def link_to_show_page(metric_configuration, mezuro_configuration_id) | ||
| 15 | - if (metric_configuration.metric.compound) | ||
| 16 | - link_to('Show', mezuro_configuration_compound_metric_configuration_path(mezuro_configuration_id, metric_configuration.id), class: 'btn btn-info') | ||
| 17 | - else | ||
| 18 | - link_to('Show', mezuro_configuration_metric_configuration_path(mezuro_configuration_id, metric_configuration.id), class: 'btn btn-info') | ||
| 19 | - end | ||
| 20 | - end | ||
| 21 | -end |
| @@ -0,0 +1 @@ | @@ -0,0 +1 @@ | ||
| 1 | +class KalibroConfiguration < KalibroClient::Configurations::KalibroConfiguration; end |
app/models/mezuro_configuration.rb
| @@ -1 +0,0 @@ | @@ -1 +0,0 @@ | ||
| 1 | -class MezuroConfiguration < KalibroClient::Configurations::KalibroConfiguration; end |
app/models/mezuro_configuration_ownership.rb
app/models/user.rb
| @@ -10,7 +10,7 @@ class User < ActiveRecord::Base | @@ -10,7 +10,7 @@ class User < ActiveRecord::Base | ||
| 10 | 10 | ||
| 11 | has_many :project_ownerships | 11 | has_many :project_ownerships |
| 12 | has_many :reading_group_ownerships | 12 | has_many :reading_group_ownerships |
| 13 | - has_many :mezuro_configuration_ownerships | 13 | + has_many :kalibro_configuration_ownerships |
| 14 | # Alert: when adding new parameters to this model, they should also be added to registrations_controller | 14 | # Alert: when adding new parameters to this model, they should also be added to registrations_controller |
| 15 | 15 | ||
| 16 | def projects | 16 | def projects |
app/views/compound_metric_configurations/_form.html.erb
| @@ -53,4 +53,4 @@ | @@ -53,4 +53,4 @@ | ||
| 53 | </div> | 53 | </div> |
| 54 | <br> | 54 | <br> |
| 55 | <%= f.submit 'Save', class: 'btn btn-primary' %> | 55 | <%= f.submit 'Save', class: 'btn btn-primary' %> |
| 56 | -<%= link_to 'Back', mezuro_configuration_path(@compound_metric_configuration.configuration_id), class: 'btn btn-default' %> | 56 | +<%= link_to 'Back', kalibro_configuration_path(@compound_metric_configuration.configuration_id), class: 'btn btn-default' %> |
app/views/compound_metric_configurations/edit.html.erb
| @@ -6,7 +6,7 @@ | @@ -6,7 +6,7 @@ | ||
| 6 | 6 | ||
| 7 | <br> | 7 | <br> |
| 8 | 8 | ||
| 9 | -<%= form_for(@compound_metric_configuration, :url => mezuro_configuration_compound_metric_configuration_update_url(@compound_metric_configuration.configuration_id, @compound_metric_configuration.id), method: :put) do |f| %> | 9 | +<%= form_for(@compound_metric_configuration, :url => kalibro_configuration_compound_metric_configuration_update_url(@compound_metric_configuration.configuration_id, @compound_metric_configuration.id), method: :put) do |f| %> |
| 10 | <%= render partial: 'form', locals: {f: f} %> | 10 | <%= render partial: 'form', locals: {f: f} %> |
| 11 | <% end %> | 11 | <% end %> |
| 12 | 12 |
app/views/compound_metric_configurations/new.html.erb
| @@ -6,7 +6,7 @@ | @@ -6,7 +6,7 @@ | ||
| 6 | 6 | ||
| 7 | <br> | 7 | <br> |
| 8 | 8 | ||
| 9 | -<%= form_for(@compound_metric_configuration, :url => mezuro_configuration_compound_metric_configurations_path(@compound_metric_configuration.configuration_id)) do |f| %> | 9 | +<%= form_for(@compound_metric_configuration, :url => kalibro_configuration_compound_metric_configurations_path(@compound_metric_configuration.configuration_id)) do |f| %> |
| 10 | <%= render partial: 'form', locals: {f: f} %> | 10 | <%= render partial: 'form', locals: {f: f} %> |
| 11 | <% end %> | 11 | <% end %> |
| 12 | 12 |
app/views/compound_metric_configurations/show.html.erb
| @@ -44,8 +44,8 @@ | @@ -44,8 +44,8 @@ | ||
| 44 | <hr> | 44 | <hr> |
| 45 | 45 | ||
| 46 | <h2> Ranges </h2> | 46 | <h2> Ranges </h2> |
| 47 | -<% if mezuro_configuration_owner? @compound_metric_configuration.configuration_id %> | ||
| 48 | - <%= link_to 'Add Range', mezuro_configuration_metric_configuration_new_mezuro_range_path(@compound_metric_configuration.configuration_id, | 47 | +<% if kalibro_configuration_owner? @compound_metric_configuration.configuration_id %> |
| 48 | + <%= link_to 'Add Range', kalibro_configuration_metric_configuration_new_mezuro_range_path(@compound_metric_configuration.configuration_id, | ||
| 49 | @compound_metric_configuration.id), class: 'btn btn-info' %> | 49 | @compound_metric_configuration.id), class: 'btn btn-info' %> |
| 50 | <% end %> | 50 | <% end %> |
| 51 | 51 | ||
| @@ -69,9 +69,9 @@ | @@ -69,9 +69,9 @@ | ||
| 69 | <hr> | 69 | <hr> |
| 70 | 70 | ||
| 71 | <p> | 71 | <p> |
| 72 | - <%= link_to 'Back', mezuro_configuration_path(@compound_metric_configuration.configuration_id), class: 'btn btn-default' %> | ||
| 73 | -<% if mezuro_configuration_owner? @compound_metric_configuration.configuration_id %> | ||
| 74 | - <%= link_to 'Destroy Metric Configuration', mezuro_configuration_metric_configuration_path(@compound_metric_configuration.configuration_id, | 72 | + <%= link_to 'Back', kalibro_configuration_path(@compound_metric_configuration.configuration_id), class: 'btn btn-default' %> |
| 73 | +<% if kalibro_configuration_owner? @compound_metric_configuration.configuration_id %> | ||
| 74 | + <%= link_to 'Destroy Metric Configuration', kalibro_configuration_metric_configuration_path(@compound_metric_configuration.configuration_id, | ||
| 75 | @compound_metric_configuration.id), method: :delete, data: { confirm: 'Are you sure that you want to destroy this Metric Configuration?' }, | 75 | @compound_metric_configuration.id), method: :delete, data: { confirm: 'Are you sure that you want to destroy this Metric Configuration?' }, |
| 76 | class: 'btn btn-danger' %> | 76 | class: 'btn btn-danger' %> |
| 77 | <% end %> | 77 | <% end %> |
| @@ -0,0 +1,29 @@ | @@ -0,0 +1,29 @@ | ||
| 1 | +<%= form_for(@kalibro_configuration, :html => { role: 'form' }) do |f| %> | ||
| 2 | + <%= render :partial => 'shared/form_errors', :locals => {:object => @kalibro_configuration} %> | ||
| 3 | + | ||
| 4 | +<div class="row margin-left-none"> | ||
| 5 | + <div class="form-table col-md-9"> | ||
| 6 | + | ||
| 7 | + <div class="form-row"> | ||
| 8 | + <div class="field-container"> | ||
| 9 | + <%= f.label :name, class: 'control-label' %><br> | ||
| 10 | + <%= f.text_field :name, :required => true, class: 'text-field form-control' %> | ||
| 11 | + </div> | ||
| 12 | + </div> | ||
| 13 | + | ||
| 14 | + <div class="form-row"> | ||
| 15 | + <div class="field-container"> | ||
| 16 | + <%= f.label :description, class: 'control-label' %><br> | ||
| 17 | + <%= f.text_area :description, class: 'text-area form-control' %> | ||
| 18 | + </div> | ||
| 19 | + </div> | ||
| 20 | + | ||
| 21 | + </div> | ||
| 22 | +</div> | ||
| 23 | + | ||
| 24 | +<div class="row margin-left-none" style="margin-top: 20px"> | ||
| 25 | + <%= f.submit 'Save', class: 'btn btn-primary' %> | ||
| 26 | + <%= link_to 'Back', kalibro_configurations_path, class: 'btn btn-default' %> | ||
| 27 | +</div> | ||
| 28 | + | ||
| 29 | +<% end %> |
| @@ -0,0 +1,13 @@ | @@ -0,0 +1,13 @@ | ||
| 1 | +<table class="table table-hover"> | ||
| 2 | + <thead> | ||
| 3 | + <tr> | ||
| 4 | + <th>Name</th> | ||
| 5 | + <th>Description</th> | ||
| 6 | + <th colspan="2"></th> | ||
| 7 | + </tr> | ||
| 8 | + </thead> | ||
| 9 | + | ||
| 10 | + <tbody> | ||
| 11 | + <%= render @kalibro_configurations %> | ||
| 12 | + </tbody> | ||
| 13 | +</table> | ||
| 0 | \ No newline at end of file | 14 | \ No newline at end of file |
app/views/kalibro_configurations/_metric_configurations.html.erb
0 → 100644
| @@ -0,0 +1,19 @@ | @@ -0,0 +1,19 @@ | ||
| 1 | +<tr> | ||
| 2 | + <td><%= metric_configuration.metric.name %></td> | ||
| 3 | + <td><%= metric_configuration.code %></td> | ||
| 4 | + <td><%= metric_configuration.weight %></td> | ||
| 5 | + <td> | ||
| 6 | + <%= link_to_show_page(metric_configuration, @kalibro_configuration.id) %> | ||
| 7 | + </td> | ||
| 8 | + <% if kalibro_configuration_owner? @kalibro_configuration.id %> | ||
| 9 | + <td> | ||
| 10 | + <%= link_to_edit_form(metric_configuration, @kalibro_configuration.id) %> | ||
| 11 | + </td> | ||
| 12 | + <td> | ||
| 13 | + <%= link_to 'Destroy', kalibro_configuration_metric_configuration_path(@kalibro_configuration.id, metric_configuration.id), | ||
| 14 | + method: :delete, data: { confirm: 'Are you sure that you want to destroy this Metric Configuration?' }, | ||
| 15 | + class: 'btn btn-danger' %> | ||
| 16 | + </td> | ||
| 17 | + </td> | ||
| 18 | + <% end %> | ||
| 19 | +</tr> |
app/views/kalibro_configurations/_mezuro_configuration.html.erb
0 → 100644
| @@ -0,0 +1,10 @@ | @@ -0,0 +1,10 @@ | ||
| 1 | +<tr> | ||
| 2 | + <td><%= kalibro_configuration.name %></td> | ||
| 3 | + <td><%= kalibro_configuration.description %></td> | ||
| 4 | + <td><%= link_to 'Show', kalibro_configuration_path(kalibro_configuration.id), class: 'btn btn-info' %></td> | ||
| 5 | + <td> | ||
| 6 | + <% if kalibro_configuration_owner?(kalibro_configuration.id) %> | ||
| 7 | + <%= link_to 'Edit', edit_kalibro_configuration_path(kalibro_configuration.id), class: 'btn btn-info' %> | ||
| 8 | + <% end %> | ||
| 9 | + </td> | ||
| 10 | +</tr> | ||
| 0 | \ No newline at end of file | 11 | \ No newline at end of file |
app/views/kalibro_configurations/_no_metric_configurations.html.erb
0 → 100644
| @@ -0,0 +1,16 @@ | @@ -0,0 +1,16 @@ | ||
| 1 | +<div class="page-header"> | ||
| 2 | + <h1>Configurations</h1> | ||
| 3 | +</div> | ||
| 4 | + | ||
| 5 | +<% if user_signed_in? %> | ||
| 6 | + <p> | ||
| 7 | + <%= link_to 'New Configuration', new_kalibro_configuration_path, class: 'btn btn-primary' %> | ||
| 8 | + </p> | ||
| 9 | +<%else%> | ||
| 10 | + <p class="alert alert-warning alert-dismissable"> | ||
| 11 | + <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button> | ||
| 12 | + You must be logged in to create new Configurations. | ||
| 13 | + </p> | ||
| 14 | +<% end %> | ||
| 15 | + | ||
| 16 | +<%= render partial: 'list', locals: {configurations: @configurations} %> | ||
| 0 | \ No newline at end of file | 17 | \ No newline at end of file |
| @@ -0,0 +1,42 @@ | @@ -0,0 +1,42 @@ | ||
| 1 | +<div class="page-header"> | ||
| 2 | + <h1><%= @kalibro_configuration.name %></h1> | ||
| 3 | +</div> | ||
| 4 | + | ||
| 5 | +<p> | ||
| 6 | + <strong>Description:</strong> | ||
| 7 | + <%= @kalibro_configuration.description %> | ||
| 8 | +</p> | ||
| 9 | + | ||
| 10 | +<hr> | ||
| 11 | + | ||
| 12 | +<h2> Metrics </h2> | ||
| 13 | +<% if kalibro_configuration_owner? @kalibro_configuration.id %> | ||
| 14 | + <%= link_to 'Add Metric', kalibro_configuration_choose_metric_path(@kalibro_configuration.id), class: 'btn btn-info' %> | ||
| 15 | +<% end %> | ||
| 16 | + | ||
| 17 | +<table class="table table-hover"> | ||
| 18 | + <thead> | ||
| 19 | + <tr> | ||
| 20 | + <th>Metric Name</th> | ||
| 21 | + <th>Code</th> | ||
| 22 | + <th>Weight</th> | ||
| 23 | + <th colspan="3"></th> | ||
| 24 | + </tr> | ||
| 25 | + </thead> | ||
| 26 | + <tbody> | ||
| 27 | + <% if Rails.cache.read("#{@kalibro_configuration.id}_metric_configurations").empty? %> | ||
| 28 | + <%= render partial: 'no_metric_configurations' %> | ||
| 29 | + <% else %> | ||
| 30 | + <%= render partial: 'metric_configurations', collection: Rails.cache.read("#{@kalibro_configuration.id}_metric_configurations"), as: :metric_configuration %> | ||
| 31 | + <% end %> | ||
| 32 | + </tbody> | ||
| 33 | +</table> | ||
| 34 | + | ||
| 35 | +<hr> | ||
| 36 | + | ||
| 37 | +<p> | ||
| 38 | + <%= link_to 'Back', kalibro_configurations_path, class: 'btn btn-default' %> | ||
| 39 | + <% if kalibro_configuration_owner? @kalibro_configuration.id %> | ||
| 40 | + <%= link_to 'Destroy Configuration', kalibro_configuration_path(@kalibro_configuration.id), method: :delete, data: { confirm: 'Are you sure that you want to destroy this Configuration?' }, class: 'btn btn-danger' %> | ||
| 41 | + <% end %> | ||
| 42 | +</p> |
app/views/layouts/application.html.erb
| @@ -60,7 +60,7 @@ | @@ -60,7 +60,7 @@ | ||
| 60 | <ul class="nav navbar-nav"> | 60 | <ul class="nav navbar-nav"> |
| 61 | <li><%= link_to 'Home', root_path %></li> | 61 | <li><%= link_to 'Home', root_path %></li> |
| 62 | <li><%= link_to 'Project', projects_path %></li> | 62 | <li><%= link_to 'Project', projects_path %></li> |
| 63 | - <li><%= link_to 'Configuration', mezuro_configurations_path %></li> | 63 | + <li><%= link_to 'Configuration', kalibro_configurations_path %></li> |
| 64 | <li><%= link_to 'Reading Group', reading_groups_path %></li> | 64 | <li><%= link_to 'Reading Group', reading_groups_path %></li> |
| 65 | </ul> | 65 | </ul> |
| 66 | <ul class="nav navbar-nav" style="float: right;"> | 66 | <ul class="nav navbar-nav" style="float: right;"> |
app/views/metric_configurations/_ranges.html.erb
| @@ -8,10 +8,10 @@ | @@ -8,10 +8,10 @@ | ||
| 8 | <td><%= mezuro_range.beginning %></td> | 8 | <td><%= mezuro_range.beginning %></td> |
| 9 | <td><%= mezuro_range.end %></td> | 9 | <td><%= mezuro_range.end %></td> |
| 10 | <td> | 10 | <td> |
| 11 | - <% if mezuro_configuration_owner? @metric_configuration.configuration_id %> | ||
| 12 | - <%= link_to 'Edit', edit_mezuro_configuration_metric_configuration_mezuro_range_path( | 11 | + <% if kalibro_configuration_owner? @metric_configuration.configuration_id %> |
| 12 | + <%= link_to 'Edit', edit_kalibro_configuration_metric_configuration_mezuro_range_path( | ||
| 13 | @metric_configuration.configuration_id, @metric_configuration.id, mezuro_range.id), class: 'btn btn-info' %> | 13 | @metric_configuration.configuration_id, @metric_configuration.id, mezuro_range.id), class: 'btn btn-info' %> |
| 14 | - <%= link_to 'Destroy', mezuro_configuration_metric_configuration_mezuro_range_path(@metric_configuration.configuration_id, | 14 | + <%= link_to 'Destroy', kalibro_configuration_metric_configuration_mezuro_range_path(@metric_configuration.configuration_id, |
| 15 | @metric_configuration.id, mezuro_range.id), method: :delete, data: { confirm: 'Are you sure that you want to destroy this Range?' }, | 15 | @metric_configuration.id, mezuro_range.id), method: :delete, data: { confirm: 'Are you sure that you want to destroy this Range?' }, |
| 16 | class: 'btn btn-danger' %> | 16 | class: 'btn btn-danger' %> |
| 17 | <% end %> | 17 | <% end %> |
app/views/metric_configurations/choose_metric.html.erb
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | <h1>Choose a metric from a Base Tool:</h1> | 2 | <h1>Choose a metric from a Base Tool:</h1> |
| 3 | </div> | 3 | </div> |
| 4 | 4 | ||
| 5 | -<%= form_tag mezuro_configuration_new_metric_configuration_path(@mezuro_configuration_id) do %> | 5 | +<%= form_tag kalibro_configuration_new_metric_configuration_path(@kalibro_configuration_id) do %> |
| 6 | <%= hidden_field_tag(:metric_collector_name,) %> | 6 | <%= hidden_field_tag(:metric_collector_name,) %> |
| 7 | <%= hidden_field_tag(:metric_name) %> | 7 | <%= hidden_field_tag(:metric_name) %> |
| 8 | <% end %> | 8 | <% end %> |
| @@ -18,8 +18,8 @@ | @@ -18,8 +18,8 @@ | ||
| 18 | <% end %> | 18 | <% end %> |
| 19 | </div><br /> | 19 | </div><br /> |
| 20 | 20 | ||
| 21 | -<%= link_to 'Back', mezuro_configuration_path(@mezuro_configuration_id), class: 'btn btn-default' %> | ||
| 22 | -<%= link_to 'Compound Metric', new_mezuro_configuration_compound_metric_configuration_path(@mezuro_configuration_id), class: 'btn btn-info', id: "link_to_compound" %> | 21 | +<%= link_to 'Back', kalibro_configuration_path(@kalibro_configuration_id), class: 'btn btn-default' %> |
| 22 | +<%= link_to 'Compound Metric', new_kalibro_configuration_compound_metric_configuration_path(@kalibro_configuration_id), class: 'btn btn-info', id: "link_to_compound" %> | ||
| 23 | 23 | ||
| 24 | 24 | ||
| 25 | <script type="text/javascript"> | 25 | <script type="text/javascript"> |
| @@ -31,7 +31,7 @@ | @@ -31,7 +31,7 @@ | ||
| 31 | }); | 31 | }); |
| 32 | }); | 32 | }); |
| 33 | 33 | ||
| 34 | - <% if MetricConfiguration.metric_configurations_of(@mezuro_configuration_id).blank? %> | 34 | + <% if MetricConfiguration.metric_configurations_of(@kalibro_configuration_id).blank? %> |
| 35 | $("#link_to_compound").css("display", "none"); | 35 | $("#link_to_compound").css("display", "none"); |
| 36 | <% end %> | 36 | <% end %> |
| 37 | </script> | 37 | </script> |
app/views/metric_configurations/edit.html.erb
| @@ -2,10 +2,10 @@ | @@ -2,10 +2,10 @@ | ||
| 2 | <h1>Editing Metric Configuration</h1> | 2 | <h1>Editing Metric Configuration</h1> |
| 3 | </div> | 3 | </div> |
| 4 | 4 | ||
| 5 | -<%= form_for(@metric_configuration, :url => mezuro_configuration_metric_configuration_update_url(@mezuro_configuration_id, @metric_configuration.id), method: :put) do |f| %> | 5 | +<%= form_for(@metric_configuration, :url => kalibro_configuration_metric_configuration_update_url(@kalibro_configuration_id, @metric_configuration.id), method: :put) do |f| %> |
| 6 | <%= render partial: 'form', locals: {f: f} %> | 6 | <%= render partial: 'form', locals: {f: f} %> |
| 7 | <div class="row margin-left-none" style="margin-top: 20px"> | 7 | <div class="row margin-left-none" style="margin-top: 20px"> |
| 8 | <%= f.submit 'Save', class: 'btn btn-primary' %> | 8 | <%= f.submit 'Save', class: 'btn btn-primary' %> |
| 9 | - <%= link_to 'Back', mezuro_configuration_path(@metric_configuration.configuration_id), class: 'btn btn-default' %> | 9 | + <%= link_to 'Back', kalibro_configuration_path(@metric_configuration.configuration_id), class: 'btn btn-default' %> |
| 10 | </div> | 10 | </div> |
| 11 | <% end %> | 11 | <% end %> |
app/views/metric_configurations/new.html.erb
| @@ -24,10 +24,10 @@ | @@ -24,10 +24,10 @@ | ||
| 24 | 24 | ||
| 25 | <br> | 25 | <br> |
| 26 | 26 | ||
| 27 | -<%= form_for(@metric_configuration, :url => mezuro_configuration_metric_configurations_path(@metric_configuration.configuration_id)) do |f| %> | 27 | +<%= form_for(@metric_configuration, :url => kalibro_configuration_metric_configurations_path(@metric_configuration.configuration_id)) do |f| %> |
| 28 | <%= render partial: 'form', locals: {f: f} %> | 28 | <%= render partial: 'form', locals: {f: f} %> |
| 29 | <div class="row margin-left-none" style="margin-top: 20px"> | 29 | <div class="row margin-left-none" style="margin-top: 20px"> |
| 30 | <%= f.submit 'Save', class: 'btn btn-primary' %> | 30 | <%= f.submit 'Save', class: 'btn btn-primary' %> |
| 31 | - <%= link_to 'Back', mezuro_configuration_choose_metric_path(@metric_configuration.configuration_id), class: 'btn btn-default' %> | 31 | + <%= link_to 'Back', kalibro_configuration_choose_metric_path(@metric_configuration.configuration_id), class: 'btn btn-default' %> |
| 32 | </div> | 32 | </div> |
| 33 | <% end %> | 33 | <% end %> |
app/views/metric_configurations/show.html.erb
| @@ -49,8 +49,8 @@ | @@ -49,8 +49,8 @@ | ||
| 49 | <hr> | 49 | <hr> |
| 50 | 50 | ||
| 51 | <h2> Ranges </h2> | 51 | <h2> Ranges </h2> |
| 52 | -<% if mezuro_configuration_owner? @metric_configuration.configuration_id %> | ||
| 53 | - <%= link_to 'Add Range', mezuro_configuration_metric_configuration_new_mezuro_range_path(@metric_configuration.configuration_id, | 52 | +<% if kalibro_configuration_owner? @metric_configuration.configuration_id %> |
| 53 | + <%= link_to 'Add Range', kalibro_configuration_metric_configuration_new_mezuro_range_path(@metric_configuration.configuration_id, | ||
| 54 | @metric_configuration.id), class: 'btn btn-info' %> | 54 | @metric_configuration.id), class: 'btn btn-info' %> |
| 55 | <% end %> | 55 | <% end %> |
| 56 | 56 | ||
| @@ -72,9 +72,9 @@ | @@ -72,9 +72,9 @@ | ||
| 72 | </table> | 72 | </table> |
| 73 | 73 | ||
| 74 | <p> | 74 | <p> |
| 75 | - <%= link_to 'Back', mezuro_configuration_path(@metric_configuration.configuration_id), class: 'btn btn-default' %> | ||
| 76 | -<% if mezuro_configuration_owner? @metric_configuration.configuration_id %> | ||
| 77 | - <%= link_to 'Destroy Metric Configuration', mezuro_configuration_metric_configuration_path(@metric_configuration.configuration_id, | 75 | + <%= link_to 'Back', kalibro_configuration_path(@metric_configuration.configuration_id), class: 'btn btn-default' %> |
| 76 | +<% if kalibro_configuration_owner? @metric_configuration.configuration_id %> | ||
| 77 | + <%= link_to 'Destroy Metric Configuration', kalibro_configuration_metric_configuration_path(@metric_configuration.configuration_id, | ||
| 78 | @metric_configuration.id), method: :delete, data: { confirm: 'Are you sure that you want to destroy this Metric Configuration?' }, | 78 | @metric_configuration.id), method: :delete, data: { confirm: 'Are you sure that you want to destroy this Metric Configuration?' }, |
| 79 | class: 'btn btn-danger' %> | 79 | class: 'btn btn-danger' %> |
| 80 | <% end %> | 80 | <% end %> |
app/views/mezuro_configurations/_form.html.erb
| @@ -1,29 +0,0 @@ | @@ -1,29 +0,0 @@ | ||
| 1 | -<%= form_for(@mezuro_configuration, :html => { role: 'form' }) do |f| %> | ||
| 2 | - <%= render :partial => 'shared/form_errors', :locals => {:object => @mezuro_configuration} %> | ||
| 3 | - | ||
| 4 | -<div class="row margin-left-none"> | ||
| 5 | - <div class="form-table col-md-9"> | ||
| 6 | - | ||
| 7 | - <div class="form-row"> | ||
| 8 | - <div class="field-container"> | ||
| 9 | - <%= f.label :name, class: 'control-label' %><br> | ||
| 10 | - <%= f.text_field :name, :required => true, class: 'text-field form-control' %> | ||
| 11 | - </div> | ||
| 12 | - </div> | ||
| 13 | - | ||
| 14 | - <div class="form-row"> | ||
| 15 | - <div class="field-container"> | ||
| 16 | - <%= f.label :description, class: 'control-label' %><br> | ||
| 17 | - <%= f.text_area :description, class: 'text-area form-control' %> | ||
| 18 | - </div> | ||
| 19 | - </div> | ||
| 20 | - | ||
| 21 | - </div> | ||
| 22 | -</div> | ||
| 23 | - | ||
| 24 | -<div class="row margin-left-none" style="margin-top: 20px"> | ||
| 25 | - <%= f.submit 'Save', class: 'btn btn-primary' %> | ||
| 26 | - <%= link_to 'Back', mezuro_configurations_path, class: 'btn btn-default' %> | ||
| 27 | -</div> | ||
| 28 | - | ||
| 29 | -<% end %> |
app/views/mezuro_configurations/_list.html.erb
| @@ -1,13 +0,0 @@ | @@ -1,13 +0,0 @@ | ||
| 1 | -<table class="table table-hover"> | ||
| 2 | - <thead> | ||
| 3 | - <tr> | ||
| 4 | - <th>Name</th> | ||
| 5 | - <th>Description</th> | ||
| 6 | - <th colspan="2"></th> | ||
| 7 | - </tr> | ||
| 8 | - </thead> | ||
| 9 | - | ||
| 10 | - <tbody> | ||
| 11 | - <%= render @mezuro_configurations %> | ||
| 12 | - </tbody> | ||
| 13 | -</table> | ||
| 14 | \ No newline at end of file | 0 | \ No newline at end of file |
app/views/mezuro_configurations/_metric_configurations.html.erb
| @@ -1,19 +0,0 @@ | @@ -1,19 +0,0 @@ | ||
| 1 | -<tr> | ||
| 2 | - <td><%= metric_configuration.metric.name %></td> | ||
| 3 | - <td><%= metric_configuration.code %></td> | ||
| 4 | - <td><%= metric_configuration.weight %></td> | ||
| 5 | - <td> | ||
| 6 | - <%= link_to_show_page(metric_configuration, @mezuro_configuration.id) %> | ||
| 7 | - </td> | ||
| 8 | - <% if mezuro_configuration_owner? @mezuro_configuration.id %> | ||
| 9 | - <td> | ||
| 10 | - <%= link_to_edit_form(metric_configuration, @mezuro_configuration.id) %> | ||
| 11 | - </td> | ||
| 12 | - <td> | ||
| 13 | - <%= link_to 'Destroy', mezuro_configuration_metric_configuration_path(@mezuro_configuration.id, metric_configuration.id), | ||
| 14 | - method: :delete, data: { confirm: 'Are you sure that you want to destroy this Metric Configuration?' }, | ||
| 15 | - class: 'btn btn-danger' %> | ||
| 16 | - </td> | ||
| 17 | - </td> | ||
| 18 | - <% end %> | ||
| 19 | -</tr> |
app/views/mezuro_configurations/_mezuro_configuration.html.erb
| @@ -1,10 +0,0 @@ | @@ -1,10 +0,0 @@ | ||
| 1 | -<tr> | ||
| 2 | - <td><%= mezuro_configuration.name %></td> | ||
| 3 | - <td><%= mezuro_configuration.description %></td> | ||
| 4 | - <td><%= link_to 'Show', mezuro_configuration_path(mezuro_configuration.id), class: 'btn btn-info' %></td> | ||
| 5 | - <td> | ||
| 6 | - <% if mezuro_configuration_owner?(mezuro_configuration.id) %> | ||
| 7 | - <%= link_to 'Edit', edit_mezuro_configuration_path(mezuro_configuration.id), class: 'btn btn-info' %> | ||
| 8 | - <% end %> | ||
| 9 | - </td> | ||
| 10 | -</tr> | ||
| 11 | \ No newline at end of file | 0 | \ No newline at end of file |
app/views/mezuro_configurations/_no_metric_configurations.html.erb
app/views/mezuro_configurations/edit.html.erb
app/views/mezuro_configurations/index.html.erb
| @@ -1,16 +0,0 @@ | @@ -1,16 +0,0 @@ | ||
| 1 | -<div class="page-header"> | ||
| 2 | - <h1>Configurations</h1> | ||
| 3 | -</div> | ||
| 4 | - | ||
| 5 | -<% if user_signed_in? %> | ||
| 6 | - <p> | ||
| 7 | - <%= link_to 'New Configuration', new_mezuro_configuration_path, class: 'btn btn-primary' %> | ||
| 8 | - </p> | ||
| 9 | -<%else%> | ||
| 10 | - <p class="alert alert-warning alert-dismissable"> | ||
| 11 | - <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button> | ||
| 12 | - You must be logged in to create new Configurations. | ||
| 13 | - </p> | ||
| 14 | -<% end %> | ||
| 15 | - | ||
| 16 | -<%= render partial: 'list', locals: {configurations: @configurations} %> | ||
| 17 | \ No newline at end of file | 0 | \ No newline at end of file |
app/views/mezuro_configurations/new.html.erb
app/views/mezuro_configurations/show.html.erb
| @@ -1,42 +0,0 @@ | @@ -1,42 +0,0 @@ | ||
| 1 | -<div class="page-header"> | ||
| 2 | - <h1><%= @mezuro_configuration.name %></h1> | ||
| 3 | -</div> | ||
| 4 | - | ||
| 5 | -<p> | ||
| 6 | - <strong>Description:</strong> | ||
| 7 | - <%= @mezuro_configuration.description %> | ||
| 8 | -</p> | ||
| 9 | - | ||
| 10 | -<hr> | ||
| 11 | - | ||
| 12 | -<h2> Metrics </h2> | ||
| 13 | -<% if mezuro_configuration_owner? @mezuro_configuration.id %> | ||
| 14 | - <%= link_to 'Add Metric', mezuro_configuration_choose_metric_path(@mezuro_configuration.id), class: 'btn btn-info' %> | ||
| 15 | -<% end %> | ||
| 16 | - | ||
| 17 | -<table class="table table-hover"> | ||
| 18 | - <thead> | ||
| 19 | - <tr> | ||
| 20 | - <th>Metric Name</th> | ||
| 21 | - <th>Code</th> | ||
| 22 | - <th>Weight</th> | ||
| 23 | - <th colspan="3"></th> | ||
| 24 | - </tr> | ||
| 25 | - </thead> | ||
| 26 | - <tbody> | ||
| 27 | - <% if Rails.cache.read("#{@mezuro_configuration.id}_metric_configurations").empty? %> | ||
| 28 | - <%= render partial: 'no_metric_configurations' %> | ||
| 29 | - <% else %> | ||
| 30 | - <%= render partial: 'metric_configurations', collection: Rails.cache.read("#{@mezuro_configuration.id}_metric_configurations"), as: :metric_configuration %> | ||
| 31 | - <% end %> | ||
| 32 | - </tbody> | ||
| 33 | -</table> | ||
| 34 | - | ||
| 35 | -<hr> | ||
| 36 | - | ||
| 37 | -<p> | ||
| 38 | - <%= link_to 'Back', mezuro_configurations_path, class: 'btn btn-default' %> | ||
| 39 | - <% if mezuro_configuration_owner? @mezuro_configuration.id %> | ||
| 40 | - <%= link_to 'Destroy Configuration', mezuro_configuration_path(@mezuro_configuration.id), method: :delete, data: { confirm: 'Are you sure that you want to destroy this Configuration?' }, class: 'btn btn-danger' %> | ||
| 41 | - <% end %> | ||
| 42 | -</p> |
app/views/mezuro_ranges/_form.html.erb
| @@ -70,5 +70,5 @@ | @@ -70,5 +70,5 @@ | ||
| 70 | 70 | ||
| 71 | <div class="row margin-left-none" style="margin-top: 20px"> | 71 | <div class="row margin-left-none" style="margin-top: 20px"> |
| 72 | <%= f.submit 'Save', class: 'btn btn-primary' %> | 72 | <%= f.submit 'Save', class: 'btn btn-primary' %> |
| 73 | - <%= link_to 'Back', mezuro_configuration_metric_configuration_path(@mezuro_configuration_id, @metric_configuration_id), class: 'btn btn-default' %> | 73 | + <%= link_to 'Back', kalibro_configuration_metric_configuration_path(@kalibro_configuration_id, @metric_configuration_id), class: 'btn btn-default' %> |
| 74 | </div> | 74 | </div> |
app/views/mezuro_ranges/edit.html.erb
| 1 | <h1>Edit Range</h1> | 1 | <h1>Edit Range</h1> |
| 2 | 2 | ||
| 3 | -<%= form_for(@mezuro_range, :url => mezuro_configuration_metric_configuration_mezuro_range_update_url( | ||
| 4 | - @mezuro_configuration_id, @metric_configuration_id, @mezuro_range.id), method: :put) do |f| %> | 3 | +<%= form_for(@mezuro_range, :url => kalibro_configuration_metric_configuration_mezuro_range_update_url( |
| 4 | + @kalibro_configuration_id, @metric_configuration_id, @mezuro_range.id), method: :put) do |f| %> | ||
| 5 | <%= render partial: 'form', locals: {f: f} %> | 5 | <%= render partial: 'form', locals: {f: f} %> |
| 6 | <% end %> | 6 | <% end %> |
| 7 | \ No newline at end of file | 7 | \ No newline at end of file |
app/views/mezuro_ranges/new.html.erb
| 1 | <h1>New Range</h1> | 1 | <h1>New Range</h1> |
| 2 | 2 | ||
| 3 | -<%= form_for(@mezuro_range, :url => mezuro_configuration_metric_configuration_mezuro_ranges_path( | ||
| 4 | - @mezuro_configuration_id, @metric_configuration_id)) do |f| %> | 3 | +<%= form_for(@mezuro_range, :url => kalibro_configuration_metric_configuration_mezuro_ranges_path( |
| 4 | + @kalibro_configuration_id, @metric_configuration_id)) do |f| %> | ||
| 5 | <%= render partial: 'form', locals: {f: f} %> | 5 | <%= render partial: 'form', locals: {f: f} %> |
| 6 | <% end %> | 6 | <% end %> |
| 7 | \ No newline at end of file | 7 | \ No newline at end of file |
app/views/repositories/show.html.erb
| @@ -29,7 +29,7 @@ | @@ -29,7 +29,7 @@ | ||
| 29 | 29 | ||
| 30 | <p> | 30 | <p> |
| 31 | <strong>Configuration:</strong> | 31 | <strong>Configuration:</strong> |
| 32 | - <%= @mezuro_configuration.name %> | 32 | + <%= @kalibro_configuration.name %> |
| 33 | </p> | 33 | </p> |
| 34 | 34 | ||
| 35 | <p><strong> Retrieve the closest processing information from: </strong></p> | 35 | <p><strong> Retrieve the closest processing information from: </strong></p> |
config/routes.rb
| @@ -10,7 +10,7 @@ Rails.application.routes.draw do | @@ -10,7 +10,7 @@ Rails.application.routes.draw do | ||
| 10 | get '/repositories/:id/process' => 'repositories#process_repository', as: :repository_process | 10 | get '/repositories/:id/process' => 'repositories#process_repository', as: :repository_process |
| 11 | end | 11 | end |
| 12 | 12 | ||
| 13 | - resources :mezuro_configurations do | 13 | + resources :kalibro_configurations do |
| 14 | get '/metric_configurations/choose_metric' => 'metric_configurations#choose_metric', as: :choose_metric | 14 | get '/metric_configurations/choose_metric' => 'metric_configurations#choose_metric', as: :choose_metric |
| 15 | resources :metric_configurations, except: [:update, :new] do | 15 | resources :metric_configurations, except: [:update, :new] do |
| 16 | get '/mezuro_ranges/new' => 'mezuro_ranges#new', as: :new_mezuro_range | 16 | get '/mezuro_ranges/new' => 'mezuro_ranges#new', as: :new_mezuro_range |
db/migrate/20140124124835_create_mezuro_configuration_ownerships.rb
| 1 | -class CreateMezuroConfigurationOwnerships < ActiveRecord::Migration | 1 | +class CreateKalibroConfigurationOwnerships < ActiveRecord::Migration |
| 2 | def change | 2 | def change |
| 3 | - create_table :mezuro_configuration_ownerships do |t| | 3 | + create_table :kalibro_configuration_ownerships do |t| |
| 4 | t.integer :user_id | 4 | t.integer :user_id |
| 5 | - t.integer :mezuro_configuration_id | 5 | + t.integer :kalibro_configuration_id |
| 6 | 6 | ||
| 7 | t.timestamps | 7 | t.timestamps |
| 8 | end | 8 | end |
db/migrate/20141211113727_rename_mezuro_configuration_ownerships_to_kalibro_configuration_ownerships.rb
0 → 100644
db/migrate/20141211114023_rename_mezuro_configuration_id_from_kalibro_configuration_ownerships_to_kalibro_configuration_id.rb
0 → 100644
db/schema.rb
| @@ -11,11 +11,11 @@ | @@ -11,11 +11,11 @@ | ||
| 11 | # | 11 | # |
| 12 | # It's strongly recommended that you check this file into your version control system. | 12 | # It's strongly recommended that you check this file into your version control system. |
| 13 | 13 | ||
| 14 | -ActiveRecord::Schema.define(version: 20141119173020) do | 14 | +ActiveRecord::Schema.define(version: 20141211114023) do |
| 15 | 15 | ||
| 16 | - create_table "mezuro_configuration_ownerships", force: true do |t| | 16 | + create_table "kalibro_configuration_ownerships", force: true do |t| |
| 17 | t.integer "user_id" | 17 | t.integer "user_id" |
| 18 | - t.integer "mezuro_configuration_id" | 18 | + t.integer "kalibro_configuration_id" |
| 19 | t.datetime "created_at" | 19 | t.datetime "created_at" |
| 20 | t.datetime "updated_at" | 20 | t.datetime "updated_at" |
| 21 | end | 21 | end |
features/mezuro_configuration/create.feature
| @@ -28,7 +28,7 @@ Feature: Configuration Creation | @@ -28,7 +28,7 @@ Feature: Configuration Creation | ||
| 28 | And I fill the Name field with "Kalibro" | 28 | And I fill the Name field with "Kalibro" |
| 29 | And I fill the Description field with "Web Service to collect metrics" | 29 | And I fill the Description field with "Web Service to collect metrics" |
| 30 | When I press the Save button | 30 | When I press the Save button |
| 31 | - Then I should see "Name There is already a MezuroConfiguration with name Kalibro!" | 31 | + Then I should see "Name There is already a KalibroConfiguration with name Kalibro!" |
| 32 | 32 | ||
| 33 | @kalibro_restart | 33 | @kalibro_restart |
| 34 | Scenario: configuration creation with blank name | 34 | Scenario: configuration creation with blank name |
features/mezuro_configuration/edition.feature
| @@ -36,8 +36,8 @@ Feature: Configuration | @@ -36,8 +36,8 @@ Feature: Configuration | ||
| 36 | And I own a sample configuration | 36 | And I own a sample configuration |
| 37 | And I am at the All Configurations page | 37 | And I am at the All Configurations page |
| 38 | When I click the Edit link | 38 | When I click the Edit link |
| 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" | 39 | + Then The field "kalibro_configuration[name]" should be filled with the sample configuration "name" |
| 40 | + And The field "kalibro_configuration[description]" should be filled with the sample configuration "description" | ||
| 41 | 41 | ||
| 42 | @kalibro_restart | 42 | @kalibro_restart |
| 43 | Scenario: With valid attributes | 43 | Scenario: With valid attributes |
| @@ -60,7 +60,7 @@ Feature: Configuration | @@ -60,7 +60,7 @@ Feature: Configuration | ||
| 60 | And I am at the sample configuration edit page | 60 | And I am at the sample configuration edit page |
| 61 | And I fill the Name field with "Qt-Calculator" | 61 | And I fill the Name field with "Qt-Calculator" |
| 62 | When I press the Save button | 62 | When I press the Save button |
| 63 | - Then I should see "Name There is already a MezuroConfiguration with name Qt-Calculator!" | 63 | + Then I should see "Name There is already a KalibroConfiguration with name Qt-Calculator!" |
| 64 | 64 | ||
| 65 | @kalibro_restart | 65 | @kalibro_restart |
| 66 | Scenario: Editing just the description | 66 | Scenario: Editing just the description |
features/step_definitions/compound_metric_configuration_steps.rb
| @@ -7,15 +7,15 @@ Given(/^I see the sample metric configuration code$/) do | @@ -7,15 +7,15 @@ Given(/^I see the sample metric configuration code$/) do | ||
| 7 | end | 7 | end |
| 8 | 8 | ||
| 9 | Given(/^I have a sample compound metric configuration within the given mezuro configuration$/) do | 9 | Given(/^I have a sample compound metric configuration within the given mezuro configuration$/) do |
| 10 | - @compound_metric_configuration = FactoryGirl.create(:compound_metric_configuration, {id: nil, configuration_id: @mezuro_configuration.id, reading_group_id: @reading_group.id}) | 10 | + @compound_metric_configuration = FactoryGirl.create(:compound_metric_configuration, {id: nil, configuration_id: @kalibro_configuration.id, reading_group_id: @reading_group.id}) |
| 11 | end | 11 | end |
| 12 | 12 | ||
| 13 | Given(/^I have another compound metric configuration with code "(.*?)" within the given mezuro configuration$/) do |code| | 13 | Given(/^I have another compound metric configuration with code "(.*?)" within the given mezuro configuration$/) do |code| |
| 14 | - @another_compound_metric_configuration = FactoryGirl.create(:compound_metric_configuration, {id: nil, configuration_id: @mezuro_configuration.id, code: code, reading_group_id: @reading_group.id}) | 14 | + @another_compound_metric_configuration = FactoryGirl.create(:compound_metric_configuration, {id: nil, configuration_id: @kalibro_configuration.id, code: code, reading_group_id: @reading_group.id}) |
| 15 | end | 15 | end |
| 16 | 16 | ||
| 17 | When(/^I visit the sample compound metric configuration edit page$/) do | 17 | When(/^I visit the sample compound metric configuration edit page$/) do |
| 18 | - visit edit_mezuro_configuration_compound_metric_configuration_path(@compound_metric_configuration.configuration_id, @compound_metric_configuration.id) | 18 | + visit edit_kalibro_configuration_compound_metric_configuration_path(@compound_metric_configuration.configuration_id, @compound_metric_configuration.id) |
| 19 | end | 19 | end |
| 20 | 20 | ||
| 21 | When(/^I click the edit link of the Coumpound Metric$/) do | 21 | When(/^I click the edit link of the Coumpound Metric$/) do |
features/step_definitions/configuration_steps.rb
| 1 | Given(/^I am at the All Configurations page$/) do | 1 | Given(/^I am at the All Configurations page$/) do |
| 2 | - visit mezuro_configurations_path | 2 | + visit kalibro_configurations_path |
| 3 | end | 3 | end |
| 4 | 4 | ||
| 5 | Given(/^I am at the New Configuration page$/) do | 5 | Given(/^I am at the New Configuration page$/) do |
| 6 | - visit new_mezuro_configuration_path | 6 | + visit new_kalibro_configuration_path |
| 7 | end | 7 | end |
| 8 | 8 | ||
| 9 | Given(/^I have a configuration named "(.*?)"$/) do |name| | 9 | Given(/^I have a configuration named "(.*?)"$/) do |name| |
| 10 | - @mezuro_configuration = FactoryGirl.create(:mezuro_configuration, {id: nil, name: name}) | 10 | + @kalibro_configuration = FactoryGirl.create(:kalibro_configuration, {id: nil, name: name}) |
| 11 | end | 11 | end |
| 12 | 12 | ||
| 13 | Given(/^I have a sample configuration$/) do | 13 | Given(/^I have a sample configuration$/) do |
| 14 | - @mezuro_configuration = FactoryGirl.create(:mezuro_configuration, {id: nil}) | 14 | + @kalibro_configuration = FactoryGirl.create(:kalibro_configuration, {id: nil}) |
| 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.create(:mezuro_configuration, {id: nil}) | ||
| 19 | - FactoryGirl.create(:mezuro_configuration_ownership, {id: nil, user_id: @user.id, mezuro_configuration_id: @mezuro_configuration.id}) | 18 | + @kalibro_configuration = FactoryGirl.create(:kalibro_configuration, {id: nil}) |
| 19 | + FactoryGirl.create(:kalibro_configuration_ownership, {id: nil, user_id: @user.id, kalibro_configuration_id: @kalibro_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 |
| 23 | - visit mezuro_configuration_path(@mezuro_configuration.id) | 23 | + visit kalibro_configuration_path(@kalibro_configuration.id) |
| 24 | end | 24 | end |
| 25 | 25 | ||
| 26 | Given(/^I am at the sample configuration edit page$/) do | 26 | Given(/^I am at the sample configuration edit page$/) do |
| 27 | - visit edit_mezuro_configuration_path(@mezuro_configuration.id) | 27 | + visit edit_kalibro_configuration_path(@kalibro_configuration.id) |
| 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.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}) | 31 | + @kalibro_configuration = FactoryGirl.create(:kalibro_configuration, {id: nil, name: name}) |
| 32 | + FactoryGirl.create(:kalibro_configuration_ownership, {id: nil, user_id: @user.id, kalibro_configuration_id: @kalibro_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_path(@mezuro_configuration.id) | 36 | + visit edit_kalibro_configuration_path(@kalibro_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 |
| @@ -41,7 +41,7 @@ Then(/^I should be in the Edit Configuration page$/) do | @@ -41,7 +41,7 @@ Then(/^I should be in the Edit Configuration page$/) do | ||
| 41 | end | 41 | end |
| 42 | 42 | ||
| 43 | Then(/^The field "(.*?)" should be filled with the sample configuration "(.*?)"$/) do |field, value| | 43 | Then(/^The field "(.*?)" should be filled with the sample configuration "(.*?)"$/) do |field, value| |
| 44 | - expect(page.find_field(field).value).to eq(@mezuro_configuration.send(value)) | 44 | + expect(page.find_field(field).value).to eq(@kalibro_configuration.send(value)) |
| 45 | end | 45 | end |
| 46 | 46 | ||
| 47 | Then(/^I should be in the All configurations page$/) do | 47 | Then(/^I should be in the All configurations page$/) do |
| @@ -49,10 +49,10 @@ Then(/^I should be in the All configurations page$/) do | @@ -49,10 +49,10 @@ Then(/^I should be in the All configurations page$/) do | ||
| 49 | end | 49 | end |
| 50 | 50 | ||
| 51 | Then(/^the sample configuration should not be there$/) do | 51 | Then(/^the sample configuration should not be there$/) do |
| 52 | - expect { MezuroConfiguration.find(@mezuro_configuration.id) }.to raise_error | 52 | + expect { KalibroConfiguration.find(@kalibro_configuration.id) }.to raise_error |
| 53 | end | 53 | end |
| 54 | 54 | ||
| 55 | Then(/^the sample configuration should be there$/) do | 55 | Then(/^the sample configuration should be there$/) do |
| 56 | - expect(page).to have_content(@mezuro_configuration.name) | ||
| 57 | - expect(page).to have_content(@mezuro_configuration.description) | 56 | + expect(page).to have_content(@kalibro_configuration.name) |
| 57 | + expect(page).to have_content(@kalibro_configuration.description) | ||
| 58 | end | 58 | end |
| 59 | \ No newline at end of file | 59 | \ No newline at end of file |
features/step_definitions/metric_configuration_steps.rb
| 1 | Given(/^I have a sample metric configuration within the given mezuro configuration$/) do | 1 | Given(/^I have a sample metric configuration within the given mezuro configuration$/) do |
| 2 | @metric_configuration = FactoryGirl.create(:metric_configuration, | 2 | @metric_configuration = FactoryGirl.create(:metric_configuration, |
| 3 | - {id: nil, configuration_id: @mezuro_configuration.id, reading_group_id: @reading_group.id} ) | 3 | + {id: nil, configuration_id: @kalibro_configuration.id, reading_group_id: @reading_group.id} ) |
| 4 | end | 4 | end |
| 5 | 5 | ||
| 6 | Given(/^I have another metric configuration with code "(.*?)" within the given mezuro configuration$/) do |code| | 6 | Given(/^I have another metric configuration with code "(.*?)" within the given mezuro configuration$/) do |code| |
| 7 | @another_metric_configuration = FactoryGirl.create(:metric_configuration, | 7 | @another_metric_configuration = FactoryGirl.create(:metric_configuration, |
| 8 | - {id: nil, configuration_id: @mezuro_configuration.id, reading_group_id: @reading_group.id, code: code} ) | 8 | + {id: nil, configuration_id: @kalibro_configuration.id, reading_group_id: @reading_group.id, code: code} ) |
| 9 | end | 9 | end |
| 10 | 10 | ||
| 11 | When(/^I visit the sample metric configuration edit page$/) do | 11 | When(/^I visit the sample metric configuration edit page$/) do |
| 12 | - visit edit_mezuro_configuration_metric_configuration_path(@metric_configuration.configuration_id, @metric_configuration.id) | 12 | + visit edit_kalibro_configuration_metric_configuration_path(@metric_configuration.configuration_id, @metric_configuration.id) |
| 13 | end | 13 | end |
| 14 | 14 | ||
| 15 | When(/^I visit the sample metric configuration page$/) do | 15 | When(/^I visit the sample metric configuration page$/) do |
| 16 | - visit mezuro_configuration_metric_configuration_path(@metric_configuration.configuration_id, @metric_configuration.id) | 16 | + visit kalibro_configuration_metric_configuration_path(@metric_configuration.configuration_id, @metric_configuration.id) |
| 17 | end | 17 | end |
| 18 | 18 | ||
| 19 | When(/^I visit the sample metric configuration page$/) do | 19 | When(/^I visit the sample metric configuration page$/) do |
| 20 | - visit edit_mezuro_configuration_path(@mezuro_configuration.id) | 20 | + visit edit_kalibro_configuration_path(@kalibro_configuration.id) |
| 21 | end | 21 | end |
| 22 | 22 | ||
| 23 | Then(/^I am at the sample metric configuration page$/) do | 23 | Then(/^I am at the sample metric configuration page$/) do |
| 24 | - visit mezuro_configuration_metric_configuration_path(@metric_configuration.configuration_id, @metric_configuration.id) | 24 | + visit kalibro_configuration_metric_configuration_path(@metric_configuration.configuration_id, @metric_configuration.id) |
| 25 | expect(page).to have_content(@metric_configuration.metric.name) | 25 | expect(page).to have_content(@metric_configuration.metric.name) |
| 26 | expect(page).to have_content("Ranges") | 26 | expect(page).to have_content("Ranges") |
| 27 | end | 27 | end |
features/step_definitions/mezuro_range_steps.rb
| @@ -4,7 +4,7 @@ Given(/^I have a sample range within the sample metric configuration with beginn | @@ -4,7 +4,7 @@ Given(/^I have a sample range within the sample metric configuration with beginn | ||
| 4 | end | 4 | end |
| 5 | 5 | ||
| 6 | Given(/^I am at the Edit Mezuro Range page$/) do | 6 | Given(/^I am at the Edit Mezuro Range page$/) do |
| 7 | - visit edit_mezuro_configuration_metric_configuration_mezuro_range_path(@metric_configuration.configuration_id, @metric_configuration.id, @mezuro_range.id) | 7 | + visit edit_kalibro_configuration_metric_configuration_mezuro_range_path(@metric_configuration.configuration_id, @metric_configuration.id, @mezuro_range.id) |
| 8 | end | 8 | end |
| 9 | 9 | ||
| 10 | Given(/^the select field "(.*?)" is set as "(.*?)"$/) do |field, text| | 10 | Given(/^the select field "(.*?)" is set as "(.*?)"$/) do |field, text| |
| @@ -22,7 +22,7 @@ Given(/^I have a sample range within the sample compound metric configuration$/) | @@ -22,7 +22,7 @@ Given(/^I have a sample range within the sample compound metric configuration$/) | ||
| 22 | end | 22 | end |
| 23 | 23 | ||
| 24 | When(/^I am at the New Range page$/) do | 24 | When(/^I am at the New Range page$/) do |
| 25 | - visit mezuro_configuration_metric_configuration_new_mezuro_range_path(@metric_configuration.configuration_id, @metric_configuration.id) | 25 | + visit kalibro_configuration_metric_configuration_new_mezuro_range_path(@metric_configuration.configuration_id, @metric_configuration.id) |
| 26 | end | 26 | end |
| 27 | 27 | ||
| 28 | Then(/^I should be at the New Range page$/) do | 28 | Then(/^I should be at the New Range page$/) do |
features/step_definitions/repository_steps.rb
| 1 | Given(/^I have a sample configuration with native metrics but without ranges$/) do | 1 | Given(/^I have a sample configuration with native metrics but without ranges$/) do |
| 2 | reading_group = FactoryGirl.create(:reading_group, id: nil) | 2 | reading_group = FactoryGirl.create(:reading_group, id: nil) |
| 3 | reading = FactoryGirl.create(:reading, {id: nil, group_id: reading_group.id}) | 3 | reading = FactoryGirl.create(:reading, {id: nil, group_id: reading_group.id}) |
| 4 | - @mezuro_configuration = FactoryGirl.create(:mezuro_configuration, id: nil) | 4 | + @kalibro_configuration = FactoryGirl.create(:kalibro_configuration, id: nil) |
| 5 | metric_configuration = FactoryGirl.create(:metric_configuration, | 5 | metric_configuration = FactoryGirl.create(:metric_configuration, |
| 6 | {id: nil, | 6 | {id: nil, |
| 7 | metric: FactoryGirl.build(:loc), | 7 | metric: FactoryGirl.build(:loc), |
| 8 | reading_group_id: reading_group.id, | 8 | reading_group_id: reading_group.id, |
| 9 | - configuration_id: @mezuro_configuration.id, | 9 | + configuration_id: @kalibro_configuration.id, |
| 10 | code: 'loc'}) | 10 | code: 'loc'}) |
| 11 | end | 11 | end |
| 12 | 12 | ||
| 13 | Given(/^I have a sample configuration with native metrics$/) do | 13 | Given(/^I have a sample configuration with native metrics$/) do |
| 14 | reading_group = FactoryGirl.create(:reading_group, id: nil) | 14 | reading_group = FactoryGirl.create(:reading_group, id: nil) |
| 15 | reading = FactoryGirl.create(:reading, {id: nil, group_id: reading_group.id}) | 15 | reading = FactoryGirl.create(:reading, {id: nil, group_id: reading_group.id}) |
| 16 | - @mezuro_configuration = FactoryGirl.create(:mezuro_configuration, id: nil) | 16 | + @kalibro_configuration = FactoryGirl.create(:kalibro_configuration, id: nil) |
| 17 | metric_configuration = FactoryGirl.create(:metric_configuration, | 17 | metric_configuration = FactoryGirl.create(:metric_configuration, |
| 18 | {id: nil, | 18 | {id: nil, |
| 19 | metric: FactoryGirl.build(:loc), | 19 | metric: FactoryGirl.build(:loc), |
| 20 | reading_group_id: reading_group.id, | 20 | reading_group_id: reading_group.id, |
| 21 | - configuration_id: @mezuro_configuration.id, | 21 | + configuration_id: @kalibro_configuration.id, |
| 22 | code: 'loc'}) | 22 | code: 'loc'}) |
| 23 | range = FactoryGirl.build(:mezuro_range, {id: nil, reading_id: reading.id, beginning: '-INF', :end => 'INF', metric_configuration_id: metric_configuration.id}) | 23 | range = FactoryGirl.build(:mezuro_range, {id: nil, reading_id: reading.id, beginning: '-INF', :end => 'INF', metric_configuration_id: metric_configuration.id}) |
| 24 | range.save | 24 | range.save |
| @@ -26,17 +26,17 @@ end | @@ -26,17 +26,17 @@ end | ||
| 26 | 26 | ||
| 27 | Given(/^I have a sample repository within the sample project$/) do | 27 | Given(/^I have a sample repository within the sample project$/) do |
| 28 | @repository = FactoryGirl.create(:repository, {project_id: @project.id, | 28 | @repository = FactoryGirl.create(:repository, {project_id: @project.id, |
| 29 | - configuration_id: @mezuro_configuration.id, id: nil}) | 29 | + configuration_id: @kalibro_configuration.id, id: nil}) |
| 30 | end | 30 | end |
| 31 | 31 | ||
| 32 | Given(/^I have a sample repository within the sample project named "(.+)"$/) do |name| | 32 | Given(/^I have a sample repository within the sample project named "(.+)"$/) do |name| |
| 33 | @repository = FactoryGirl.create(:repository, {project_id: @project.id, | 33 | @repository = FactoryGirl.create(:repository, {project_id: @project.id, |
| 34 | - configuration_id: @mezuro_configuration.id, id: nil, name: name}) | 34 | + configuration_id: @kalibro_configuration.id, id: nil, name: name}) |
| 35 | end | 35 | end |
| 36 | 36 | ||
| 37 | Given(/^I have a sample of an invalid repository within the sample project$/) do | 37 | Given(/^I have a sample of an invalid repository within the sample project$/) do |
| 38 | @repository = FactoryGirl.create(:repository, {project_id: @project.id, | 38 | @repository = FactoryGirl.create(:repository, {project_id: @project.id, |
| 39 | - configuration_id: @mezuro_configuration.id, id: nil, address: "https://invalidrepository.git"}) | 39 | + configuration_id: @kalibro_configuration.id, id: nil, address: "https://invalidrepository.git"}) |
| 40 | end | 40 | end |
| 41 | 41 | ||
| 42 | Given(/^I start to process that repository$/) do | 42 | Given(/^I start to process that repository$/) do |
| @@ -144,7 +144,7 @@ Then(/^I should see the given repository's content$/) do | @@ -144,7 +144,7 @@ Then(/^I should see the given repository's content$/) do | ||
| 144 | expect(page).to have_content(@repository.name) | 144 | expect(page).to have_content(@repository.name) |
| 145 | expect(page).to have_content(@repository.license) | 145 | expect(page).to have_content(@repository.license) |
| 146 | expect(page).to have_content(@repository.address) | 146 | expect(page).to have_content(@repository.address) |
| 147 | - expect(page).to have_content(@mezuro_configuration.name) | 147 | + expect(page).to have_content(@kalibro_configuration.name) |
| 148 | expect(page).to have_content("1 day") # The given repository periodicity | 148 | expect(page).to have_content("1 day") # The given repository periodicity |
| 149 | end | 149 | end |
| 150 | 150 | ||
| @@ -173,7 +173,7 @@ Then(/^I should see the saved repository's content$/) do | @@ -173,7 +173,7 @@ Then(/^I should see the saved repository's content$/) do | ||
| 173 | expect(page).to have_content(@repository.name) | 173 | expect(page).to have_content(@repository.name) |
| 174 | expect(page).to have_content(@repository.license) | 174 | expect(page).to have_content(@repository.license) |
| 175 | expect(page).to have_content(@repository.address) | 175 | expect(page).to have_content(@repository.address) |
| 176 | - expect(page).to have_content(@mezuro_configuration.name) | 176 | + expect(page).to have_content(@kalibro_configuration.name) |
| 177 | end | 177 | end |
| 178 | 178 | ||
| 179 | Then(/^"(.*?)" should be less than "(.*?)"$/) do |arg1, arg2| | 179 | Then(/^"(.*?)" should be less than "(.*?)"$/) do |arg1, arg2| |
spec/controllers/base_metric_configurations_controller_spec.rb
| @@ -41,11 +41,11 @@ end | @@ -41,11 +41,11 @@ end | ||
| 41 | 41 | ||
| 42 | 42 | ||
| 43 | describe InheritsFromBaseMetricConfigurationsController, :type => :controller do | 43 | describe InheritsFromBaseMetricConfigurationsController, :type => :controller do |
| 44 | - let(:mezuro_configuration) { FactoryGirl.build(:mezuro_configuration) } | 44 | + let(:kalibro_configuration) { FactoryGirl.build(:kalibro_configuration) } |
| 45 | 45 | ||
| 46 | before do | 46 | before do |
| 47 | Rails.application.routes.draw do | 47 | Rails.application.routes.draw do |
| 48 | - resources :mezuro_configurations do | 48 | + resources :kalibro_configurations do |
| 49 | match '/metric_configurations/choose_metric' => 'metric_configurations#choose_metric', as: :choose_metric, :via => [:get] | 49 | match '/metric_configurations/choose_metric' => 'metric_configurations#choose_metric', as: :choose_metric, :via => [:get] |
| 50 | resources :inherits_from_base_metric_configurations do | 50 | resources :inherits_from_base_metric_configurations do |
| 51 | match '/metric_configurations/new' => 'metric_configurations#new', as: :new_metric_configuration, :via => [:post] | 51 | match '/metric_configurations/new' => 'metric_configurations#new', as: :new_metric_configuration, :via => [:post] |
| @@ -67,8 +67,8 @@ describe InheritsFromBaseMetricConfigurationsController, :type => :controller do | @@ -67,8 +67,8 @@ describe InheritsFromBaseMetricConfigurationsController, :type => :controller do | ||
| 67 | context 'when the current user owns the mezuro configuration' do | 67 | context 'when the current user owns the mezuro configuration' do |
| 68 | let!(:metric_configuration) { FactoryGirl.build(:metric_configuration) } | 68 | let!(:metric_configuration) { FactoryGirl.build(:metric_configuration) } |
| 69 | before :each do | 69 | before :each do |
| 70 | - subject.expects(:mezuro_configuration_owner?).returns true | ||
| 71 | - get :new, mezuro_configuration_id: mezuro_configuration.id | 70 | + subject.expects(:kalibro_configuration_owner?).returns true |
| 71 | + get :new, kalibro_configuration_id: kalibro_configuration.id | ||
| 72 | end | 72 | end |
| 73 | 73 | ||
| 74 | it { expect(metric_configuration).not_to be_nil } | 74 | it { expect(metric_configuration).not_to be_nil } |
| @@ -77,10 +77,10 @@ describe InheritsFromBaseMetricConfigurationsController, :type => :controller do | @@ -77,10 +77,10 @@ describe InheritsFromBaseMetricConfigurationsController, :type => :controller do | ||
| 77 | 77 | ||
| 78 | context "when the current user doesn't owns the mezuro configuration" do | 78 | context "when the current user doesn't owns the mezuro configuration" do |
| 79 | before :each do | 79 | before :each do |
| 80 | - get :new, mezuro_configuration_id: mezuro_configuration.id | 80 | + get :new, kalibro_configuration_id: kalibro_configuration.id |
| 81 | end | 81 | end |
| 82 | 82 | ||
| 83 | - it { is_expected.to redirect_to(mezuro_configurations_url(mezuro_configuration.id)) } | 83 | + it { is_expected.to redirect_to(kalibro_configurations_url(kalibro_configuration.id)) } |
| 84 | it { is_expected.to respond_with(:redirect) } | 84 | it { is_expected.to respond_with(:redirect) } |
| 85 | end | 85 | end |
| 86 | end | 86 | end |
| @@ -96,12 +96,12 @@ describe InheritsFromBaseMetricConfigurationsController, :type => :controller do | @@ -96,12 +96,12 @@ describe InheritsFromBaseMetricConfigurationsController, :type => :controller do | ||
| 96 | 96 | ||
| 97 | context 'when the current user owns the mezuro configuration' do | 97 | context 'when the current user owns the mezuro configuration' do |
| 98 | before :each do | 98 | before :each do |
| 99 | - subject.expects(:mezuro_configuration_owner?).returns true | 99 | + subject.expects(:kalibro_configuration_owner?).returns true |
| 100 | end | 100 | end |
| 101 | 101 | ||
| 102 | context 'with valid fields' do | 102 | context 'with valid fields' do |
| 103 | before :each do | 103 | before :each do |
| 104 | - post :create, mezuro_configuration_id: mezuro_configuration.id, metric_configuration: metric_configuration_params, metric_collector_name: metric_collector.name | 104 | + post :create, kalibro_configuration_id: kalibro_configuration.id, metric_configuration: metric_configuration_params, metric_collector_name: metric_collector.name |
| 105 | end | 105 | end |
| 106 | 106 | ||
| 107 | it { expect(subject.metric_configuration).not_to be_nil } | 107 | it { expect(subject.metric_configuration).not_to be_nil } |
| @@ -121,7 +121,7 @@ describe InheritsFromBaseMetricConfigurationsController, :type => :controller do | @@ -121,7 +121,7 @@ describe InheritsFromBaseMetricConfigurationsController, :type => :controller do | ||
| 121 | subject.expects(:find_resource).with(MetricConfiguration, metric_configuration.id).returns(metric_configuration) | 121 | subject.expects(:find_resource).with(MetricConfiguration, metric_configuration.id).returns(metric_configuration) |
| 122 | metric_configuration.expects(:kalibro_ranges).returns([mezuro_range]) | 122 | metric_configuration.expects(:kalibro_ranges).returns([mezuro_range]) |
| 123 | 123 | ||
| 124 | - get :show, mezuro_configuration_id: metric_configuration.configuration_id.to_s, id: metric_configuration.id | 124 | + get :show, kalibro_configuration_id: metric_configuration.configuration_id.to_s, id: metric_configuration.id |
| 125 | end | 125 | end |
| 126 | 126 | ||
| 127 | it { expect(subject.mezuro_ranges).not_to be_nil} | 127 | it { expect(subject.mezuro_ranges).not_to be_nil} |
spec/controllers/compound_metric_configurations_controller_spec.rb
| 1 | require 'rails_helper' | 1 | require 'rails_helper' |
| 2 | 2 | ||
| 3 | describe CompoundMetricConfigurationsController, :type => :controller do | 3 | describe CompoundMetricConfigurationsController, :type => :controller do |
| 4 | - let(:mezuro_configuration) { FactoryGirl.build(:mezuro_configuration) } | 4 | + let(:kalibro_configuration) { FactoryGirl.build(:kalibro_configuration) } |
| 5 | 5 | ||
| 6 | describe 'new' do | 6 | describe 'new' do |
| 7 | before :each do | 7 | before :each do |
| @@ -11,9 +11,9 @@ describe CompoundMetricConfigurationsController, :type => :controller do | @@ -11,9 +11,9 @@ describe CompoundMetricConfigurationsController, :type => :controller do | ||
| 11 | context 'when the current user owns the mezuro configuration' do | 11 | context 'when the current user owns the mezuro configuration' do |
| 12 | let!(:metric_configuration) { FactoryGirl.build(:metric_configuration) } | 12 | let!(:metric_configuration) { FactoryGirl.build(:metric_configuration) } |
| 13 | before :each do | 13 | before :each do |
| 14 | - subject.expects(:mezuro_configuration_owner?).returns true | ||
| 15 | - MetricConfiguration.expects(:metric_configurations_of).with(mezuro_configuration.id).returns([metric_configuration]) | ||
| 16 | - get :new, mezuro_configuration_id: mezuro_configuration.id | 14 | + subject.expects(:kalibro_configuration_owner?).returns true |
| 15 | + MetricConfiguration.expects(:metric_configurations_of).with(kalibro_configuration.id).returns([metric_configuration]) | ||
| 16 | + get :new, kalibro_configuration_id: kalibro_configuration.id | ||
| 17 | end | 17 | end |
| 18 | 18 | ||
| 19 | it { is_expected.to respond_with(:success) } | 19 | it { is_expected.to respond_with(:success) } |
| @@ -22,10 +22,10 @@ describe CompoundMetricConfigurationsController, :type => :controller do | @@ -22,10 +22,10 @@ describe CompoundMetricConfigurationsController, :type => :controller do | ||
| 22 | 22 | ||
| 23 | context "when the current user doesn't owns the mezuro configuration" do | 23 | context "when the current user doesn't owns the mezuro configuration" do |
| 24 | before :each do | 24 | before :each do |
| 25 | - get :new, mezuro_configuration_id: mezuro_configuration.id | 25 | + get :new, kalibro_configuration_id: kalibro_configuration.id |
| 26 | end | 26 | end |
| 27 | 27 | ||
| 28 | - it { is_expected.to redirect_to(mezuro_configurations_url(mezuro_configuration.id)) } | 28 | + it { is_expected.to redirect_to(kalibro_configurations_url(kalibro_configuration.id)) } |
| 29 | it { is_expected.to respond_with(:redirect) } | 29 | it { is_expected.to respond_with(:redirect) } |
| 30 | end | 30 | end |
| 31 | end | 31 | end |
| @@ -42,14 +42,14 @@ describe CompoundMetricConfigurationsController, :type => :controller do | @@ -42,14 +42,14 @@ describe CompoundMetricConfigurationsController, :type => :controller do | ||
| 42 | 42 | ||
| 43 | context 'when the current user owns the reading group' do | 43 | context 'when the current user owns the reading group' do |
| 44 | before :each do | 44 | before :each do |
| 45 | - subject.expects(:mezuro_configuration_owner?).returns true | 45 | + subject.expects(:kalibro_configuration_owner?).returns true |
| 46 | end | 46 | end |
| 47 | 47 | ||
| 48 | context 'with valid fields' do | 48 | context 'with valid fields' do |
| 49 | before :each do | 49 | before :each do |
| 50 | MetricConfiguration.any_instance.expects(:save).returns(true) | 50 | MetricConfiguration.any_instance.expects(:save).returns(true) |
| 51 | 51 | ||
| 52 | - post :create, mezuro_configuration_id: mezuro_configuration.id, metric_configuration: metric_configuration_params | 52 | + post :create, kalibro_configuration_id: kalibro_configuration.id, metric_configuration: metric_configuration_params |
| 53 | end | 53 | end |
| 54 | 54 | ||
| 55 | it { is_expected.to respond_with(:redirect) } | 55 | it { is_expected.to respond_with(:redirect) } |
| @@ -58,8 +58,8 @@ describe CompoundMetricConfigurationsController, :type => :controller do | @@ -58,8 +58,8 @@ describe CompoundMetricConfigurationsController, :type => :controller do | ||
| 58 | context 'with invalid fields' do | 58 | context 'with invalid fields' do |
| 59 | before :each do | 59 | before :each do |
| 60 | MetricConfiguration.any_instance.expects(:save).returns(false) | 60 | MetricConfiguration.any_instance.expects(:save).returns(false) |
| 61 | - MetricConfiguration.expects(:metric_configurations_of).with(mezuro_configuration.id).returns([compound_metric_configuration]) | ||
| 62 | - post :create, mezuro_configuration_id: mezuro_configuration.id, metric_configuration: metric_configuration_params | 61 | + MetricConfiguration.expects(:metric_configurations_of).with(kalibro_configuration.id).returns([compound_metric_configuration]) |
| 62 | + post :create, kalibro_configuration_id: kalibro_configuration.id, metric_configuration: metric_configuration_params | ||
| 63 | end | 63 | end |
| 64 | 64 | ||
| 65 | it { is_expected.to render_template(:new) } | 65 | it { is_expected.to render_template(:new) } |
| @@ -77,7 +77,7 @@ describe CompoundMetricConfigurationsController, :type => :controller do | @@ -77,7 +77,7 @@ describe CompoundMetricConfigurationsController, :type => :controller do | ||
| 77 | subject.expects(:find_resource).with(MetricConfiguration, compound_metric_configuration.id).returns(compound_metric_configuration) | 77 | subject.expects(:find_resource).with(MetricConfiguration, compound_metric_configuration.id).returns(compound_metric_configuration) |
| 78 | compound_metric_configuration.expects(:kalibro_ranges).returns([mezuro_range]) | 78 | compound_metric_configuration.expects(:kalibro_ranges).returns([mezuro_range]) |
| 79 | 79 | ||
| 80 | - get :show, mezuro_configuration_id: compound_metric_configuration.configuration_id.to_s, id: compound_metric_configuration.id | 80 | + get :show, kalibro_configuration_id: compound_metric_configuration.configuration_id.to_s, id: compound_metric_configuration.id |
| 81 | end | 81 | end |
| 82 | 82 | ||
| 83 | it { is_expected.to render_template(:show) } | 83 | it { is_expected.to render_template(:show) } |
| @@ -95,8 +95,8 @@ describe CompoundMetricConfigurationsController, :type => :controller do | @@ -95,8 +95,8 @@ describe CompoundMetricConfigurationsController, :type => :controller do | ||
| 95 | before :each do | 95 | before :each do |
| 96 | subject.expects(:metric_configuration_owner?).returns(true) | 96 | subject.expects(:metric_configuration_owner?).returns(true) |
| 97 | subject.expects(:find_resource).with(MetricConfiguration, compound_metric_configuration.id).returns(compound_metric_configuration) | 97 | subject.expects(:find_resource).with(MetricConfiguration, compound_metric_configuration.id).returns(compound_metric_configuration) |
| 98 | - MetricConfiguration.expects(:metric_configurations_of).with(mezuro_configuration.id).returns([compound_metric_configuration]) | ||
| 99 | - get :edit, id: compound_metric_configuration.id, mezuro_configuration_id: compound_metric_configuration.configuration_id.to_s | 98 | + MetricConfiguration.expects(:metric_configurations_of).with(kalibro_configuration.id).returns([compound_metric_configuration]) |
| 99 | + get :edit, id: compound_metric_configuration.id, kalibro_configuration_id: compound_metric_configuration.configuration_id.to_s | ||
| 100 | end | 100 | end |
| 101 | 101 | ||
| 102 | it { is_expected.to render_template(:edit) } | 102 | it { is_expected.to render_template(:edit) } |
| @@ -104,10 +104,10 @@ describe CompoundMetricConfigurationsController, :type => :controller do | @@ -104,10 +104,10 @@ describe CompoundMetricConfigurationsController, :type => :controller do | ||
| 104 | 104 | ||
| 105 | context 'when the user does not own the compound metric configuration' do | 105 | context 'when the user does not own the compound metric configuration' do |
| 106 | before do | 106 | before do |
| 107 | - get :edit, id: compound_metric_configuration.id, mezuro_configuration_id: compound_metric_configuration.configuration_id.to_s | 107 | + get :edit, id: compound_metric_configuration.id, kalibro_configuration_id: compound_metric_configuration.configuration_id.to_s |
| 108 | end | 108 | end |
| 109 | 109 | ||
| 110 | - it { is_expected.to redirect_to(mezuro_configurations_path(mezuro_configuration.id)) } | 110 | + it { is_expected.to redirect_to(kalibro_configurations_path(kalibro_configuration.id)) } |
| 111 | it { is_expected.to respond_with(:redirect) } | 111 | it { is_expected.to respond_with(:redirect) } |
| 112 | it { is_expected.to set_the_flash[:notice].to("You're not allowed to do this operation") } | 112 | it { is_expected.to set_the_flash[:notice].to("You're not allowed to do this operation") } |
| 113 | end | 113 | end |
| @@ -115,7 +115,7 @@ describe CompoundMetricConfigurationsController, :type => :controller do | @@ -115,7 +115,7 @@ describe CompoundMetricConfigurationsController, :type => :controller do | ||
| 115 | 115 | ||
| 116 | context 'with no user logged in' do | 116 | context 'with no user logged in' do |
| 117 | before :each do | 117 | before :each do |
| 118 | - get :edit, id: compound_metric_configuration.id, mezuro_configuration_id: compound_metric_configuration.configuration_id.to_s | 118 | + get :edit, id: compound_metric_configuration.id, kalibro_configuration_id: compound_metric_configuration.configuration_id.to_s |
| 119 | end | 119 | end |
| 120 | 120 | ||
| 121 | it { is_expected.to redirect_to new_user_session_path } | 121 | it { is_expected.to redirect_to new_user_session_path } |
| @@ -141,20 +141,20 @@ describe CompoundMetricConfigurationsController, :type => :controller do | @@ -141,20 +141,20 @@ describe CompoundMetricConfigurationsController, :type => :controller do | ||
| 141 | subject.expects(:find_resource).with(MetricConfiguration, compound_metric_configuration.id).returns(compound_metric_configuration) | 141 | subject.expects(:find_resource).with(MetricConfiguration, compound_metric_configuration.id).returns(compound_metric_configuration) |
| 142 | MetricConfiguration.any_instance.expects(:update).with(metric_configuration_params).returns(true) | 142 | MetricConfiguration.any_instance.expects(:update).with(metric_configuration_params).returns(true) |
| 143 | 143 | ||
| 144 | - post :update, mezuro_configuration_id: compound_metric_configuration.configuration_id, id: compound_metric_configuration.id, metric_configuration: metric_configuration_params | 144 | + post :update, kalibro_configuration_id: compound_metric_configuration.configuration_id, id: compound_metric_configuration.id, metric_configuration: metric_configuration_params |
| 145 | end | 145 | end |
| 146 | 146 | ||
| 147 | - it { should redirect_to(mezuro_configuration_path(compound_metric_configuration.configuration_id)) } | 147 | + it { should redirect_to(kalibro_configuration_path(compound_metric_configuration.configuration_id)) } |
| 148 | it { should respond_with(:redirect) } | 148 | it { should respond_with(:redirect) } |
| 149 | end | 149 | end |
| 150 | 150 | ||
| 151 | context 'with an invalid field' do | 151 | context 'with an invalid field' do |
| 152 | before :each do | 152 | before :each do |
| 153 | subject.expects(:find_resource).with(MetricConfiguration, compound_metric_configuration.id).returns(compound_metric_configuration) | 153 | subject.expects(:find_resource).with(MetricConfiguration, compound_metric_configuration.id).returns(compound_metric_configuration) |
| 154 | - MetricConfiguration.expects(:metric_configurations_of).with(mezuro_configuration.id).returns([compound_metric_configuration]) | 154 | + MetricConfiguration.expects(:metric_configurations_of).with(kalibro_configuration.id).returns([compound_metric_configuration]) |
| 155 | MetricConfiguration.any_instance.expects(:update).with(metric_configuration_params).returns(false) | 155 | MetricConfiguration.any_instance.expects(:update).with(metric_configuration_params).returns(false) |
| 156 | 156 | ||
| 157 | - post :update, mezuro_configuration_id: compound_metric_configuration.configuration_id, id: compound_metric_configuration.id, metric_configuration: metric_configuration_params | 157 | + post :update, kalibro_configuration_id: compound_metric_configuration.configuration_id, id: compound_metric_configuration.id, metric_configuration: metric_configuration_params |
| 158 | end | 158 | end |
| 159 | 159 | ||
| 160 | it { should render_template(:edit) } | 160 | it { should render_template(:edit) } |
| @@ -163,10 +163,10 @@ describe CompoundMetricConfigurationsController, :type => :controller do | @@ -163,10 +163,10 @@ describe CompoundMetricConfigurationsController, :type => :controller do | ||
| 163 | 163 | ||
| 164 | context 'when the user does not own the reading' do | 164 | context 'when the user does not own the reading' do |
| 165 | before :each do | 165 | before :each do |
| 166 | - post :update, mezuro_configuration_id: compound_metric_configuration.configuration_id, id: compound_metric_configuration.id, metric_configuration: metric_configuration_params | 166 | + post :update, kalibro_configuration_id: compound_metric_configuration.configuration_id, id: compound_metric_configuration.id, metric_configuration: metric_configuration_params |
| 167 | end | 167 | end |
| 168 | 168 | ||
| 169 | - it { should redirect_to mezuro_configurations_path(compound_metric_configuration.configuration_id) } | 169 | + it { should redirect_to kalibro_configurations_path(compound_metric_configuration.configuration_id) } |
| 170 | end | 170 | end |
| 171 | end | 171 | end |
| 172 | end | 172 | end |
spec/controllers/concerns/ownership_authentication_spec.rb
| @@ -64,10 +64,10 @@ describe OwnershipAuthentication, type: :controller do | @@ -64,10 +64,10 @@ describe OwnershipAuthentication, type: :controller do | ||
| 64 | end | 64 | end |
| 65 | end | 65 | end |
| 66 | 66 | ||
| 67 | - describe 'mezuro_configuration_owner?' do | ||
| 68 | - let(:mezuro_configuration) { FactoryGirl.build(:mezuro_configuration) } | 67 | + describe 'kalibro_configuration_owner?' do |
| 68 | + let(:kalibro_configuration) { FactoryGirl.build(:kalibro_configuration) } | ||
| 69 | 69 | ||
| 70 | - context 'Not MezuroConfigurationsController nor MetricConfigurationsController nor CompoundMetricConfigurationsController' do | 70 | + context 'Not KalibroConfigurationsController nor MetricConfigurationsController nor CompoundMetricConfigurationsController' do |
| 71 | let!(:projects_controller) { ProjectsController.new } | 71 | let!(:projects_controller) { ProjectsController.new } |
| 72 | 72 | ||
| 73 | before do | 73 | before do |
| @@ -75,7 +75,7 @@ describe OwnershipAuthentication, type: :controller do | @@ -75,7 +75,7 @@ describe OwnershipAuthentication, type: :controller do | ||
| 75 | end | 75 | end |
| 76 | 76 | ||
| 77 | it 'should raise an exception' do | 77 | it 'should raise an exception' do |
| 78 | - expect { projects_controller.mezuro_configuration_owner? }.to raise_error("Not supported") | 78 | + expect { projects_controller.kalibro_configuration_owner? }.to raise_error("Not supported") |
| 79 | end | 79 | end |
| 80 | end | 80 | end |
| 81 | end | 81 | end |
spec/controllers/metric_configurations_controller_spec.rb
| 1 | require 'rails_helper' | 1 | require 'rails_helper' |
| 2 | 2 | ||
| 3 | describe MetricConfigurationsController, :type => :controller do | 3 | describe MetricConfigurationsController, :type => :controller do |
| 4 | - let(:mezuro_configuration) { FactoryGirl.build(:mezuro_configuration) } | 4 | + let(:kalibro_configuration) { FactoryGirl.build(:kalibro_configuration) } |
| 5 | describe 'choose_metric' do | 5 | describe 'choose_metric' do |
| 6 | let(:metric_collector) { FactoryGirl.build(:metric_collector) } | 6 | let(:metric_collector) { FactoryGirl.build(:metric_collector) } |
| 7 | before :each do | 7 | before :each do |
| @@ -10,9 +10,9 @@ describe MetricConfigurationsController, :type => :controller do | @@ -10,9 +10,9 @@ describe MetricConfigurationsController, :type => :controller do | ||
| 10 | 10 | ||
| 11 | context 'when adding new metrics' do | 11 | context 'when adding new metrics' do |
| 12 | before :each do | 12 | before :each do |
| 13 | - subject.expects(:mezuro_configuration_owner?).returns true | 13 | + subject.expects(:kalibro_configuration_owner?).returns true |
| 14 | KalibroClient::Processor::MetricCollector.expects(:all).returns([metric_collector]) | 14 | KalibroClient::Processor::MetricCollector.expects(:all).returns([metric_collector]) |
| 15 | - get :choose_metric, mezuro_configuration_id: mezuro_configuration.id | 15 | + get :choose_metric, kalibro_configuration_id: kalibro_configuration.id |
| 16 | end | 16 | end |
| 17 | 17 | ||
| 18 | it { is_expected.to respond_with(:success) } | 18 | it { is_expected.to respond_with(:success) } |
| @@ -28,9 +28,9 @@ describe MetricConfigurationsController, :type => :controller do | @@ -28,9 +28,9 @@ describe MetricConfigurationsController, :type => :controller do | ||
| 28 | 28 | ||
| 29 | context 'when the current user owns the mezuro configuration' do | 29 | context 'when the current user owns the mezuro configuration' do |
| 30 | before :each do | 30 | before :each do |
| 31 | - subject.expects(:mezuro_configuration_owner?).returns true | 31 | + subject.expects(:kalibro_configuration_owner?).returns true |
| 32 | KalibroClient::Processor::MetricCollector.expects(:find).with(metric_collector.name).returns(metric_collector) | 32 | KalibroClient::Processor::MetricCollector.expects(:find).with(metric_collector.name).returns(metric_collector) |
| 33 | - post :new, mezuro_configuration_id: mezuro_configuration.id, metric_name: "Lines of Code", metric_collector_name: metric_collector.name | 33 | + post :new, kalibro_configuration_id: kalibro_configuration.id, metric_name: "Lines of Code", metric_collector_name: metric_collector.name |
| 34 | end | 34 | end |
| 35 | 35 | ||
| 36 | it { is_expected.to respond_with(:success) } | 36 | it { is_expected.to respond_with(:success) } |
| @@ -39,10 +39,10 @@ describe MetricConfigurationsController, :type => :controller do | @@ -39,10 +39,10 @@ describe MetricConfigurationsController, :type => :controller do | ||
| 39 | 39 | ||
| 40 | context "when the current user doesn't owns the mezuro configuration" do | 40 | context "when the current user doesn't owns the mezuro configuration" do |
| 41 | before :each do | 41 | before :each do |
| 42 | - post :new, mezuro_configuration_id: mezuro_configuration.id, metric_name: "Lines of Code", metric_collector_name: metric_collector.name | 42 | + post :new, kalibro_configuration_id: kalibro_configuration.id, metric_name: "Lines of Code", metric_collector_name: metric_collector.name |
| 43 | end | 43 | end |
| 44 | 44 | ||
| 45 | - it { is_expected.to redirect_to(mezuro_configurations_url(mezuro_configuration.id)) } | 45 | + it { is_expected.to redirect_to(kalibro_configurations_url(kalibro_configuration.id)) } |
| 46 | it { is_expected.to respond_with(:redirect) } | 46 | it { is_expected.to respond_with(:redirect) } |
| 47 | end | 47 | end |
| 48 | end | 48 | end |
| @@ -50,7 +50,7 @@ describe MetricConfigurationsController, :type => :controller do | @@ -50,7 +50,7 @@ describe MetricConfigurationsController, :type => :controller do | ||
| 50 | describe 'create' do | 50 | describe 'create' do |
| 51 | let!(:metric_configuration) { FactoryGirl.build(:metric_configuration) } | 51 | let!(:metric_configuration) { FactoryGirl.build(:metric_configuration) } |
| 52 | let(:metric_configuration_params) { Hash[FactoryGirl.attributes_for(:metric_configuration).map { |k,v| [k.to_s, v.to_s] }] } #FIXME: Mocha is creating the expectations with strings, but FactoryGirl returns everything with symbols and integers | 52 | let(:metric_configuration_params) { Hash[FactoryGirl.attributes_for(:metric_configuration).map { |k,v| [k.to_s, v.to_s] }] } #FIXME: Mocha is creating the expectations with strings, but FactoryGirl returns everything with symbols and integers |
| 53 | - let(:mezuro_configuration) { FactoryGirl.build(:mezuro_configuration) } | 53 | + let(:kalibro_configuration) { FactoryGirl.build(:kalibro_configuration) } |
| 54 | let(:metric_collector) { FactoryGirl.build(:metric_collector) } | 54 | let(:metric_collector) { FactoryGirl.build(:metric_collector) } |
| 55 | 55 | ||
| 56 | before do | 56 | before do |
| @@ -59,7 +59,7 @@ describe MetricConfigurationsController, :type => :controller do | @@ -59,7 +59,7 @@ describe MetricConfigurationsController, :type => :controller do | ||
| 59 | 59 | ||
| 60 | context 'when the current user owns the metric configuration' do | 60 | context 'when the current user owns the metric configuration' do |
| 61 | before :each do | 61 | before :each do |
| 62 | - subject.expects(:mezuro_configuration_owner?).returns true | 62 | + subject.expects(:kalibro_configuration_owner?).returns true |
| 63 | end | 63 | end |
| 64 | 64 | ||
| 65 | context 'with valid fields' do | 65 | context 'with valid fields' do |
| @@ -68,7 +68,7 @@ describe MetricConfigurationsController, :type => :controller do | @@ -68,7 +68,7 @@ describe MetricConfigurationsController, :type => :controller do | ||
| 68 | KalibroClient::Processor::MetricCollector.expects(:find).with(metric_collector.name).returns(metric_collector) | 68 | KalibroClient::Processor::MetricCollector.expects(:find).with(metric_collector.name).returns(metric_collector) |
| 69 | metric_collector.expects(:metric).with(metric_configuration.metric.name).returns(metric_configuration.metric) | 69 | metric_collector.expects(:metric).with(metric_configuration.metric.name).returns(metric_configuration.metric) |
| 70 | 70 | ||
| 71 | - post :create, mezuro_configuration_id: mezuro_configuration.id, metric_configuration: metric_configuration_params, metric_collector_name: metric_collector.name, metric_name: metric_configuration.metric.name | 71 | + post :create, kalibro_configuration_id: kalibro_configuration.id, metric_configuration: metric_configuration_params, metric_collector_name: metric_collector.name, metric_name: metric_configuration.metric.name |
| 72 | end | 72 | end |
| 73 | 73 | ||
| 74 | it { is_expected.to respond_with(:redirect) } | 74 | it { is_expected.to respond_with(:redirect) } |
| @@ -80,7 +80,7 @@ describe MetricConfigurationsController, :type => :controller do | @@ -80,7 +80,7 @@ describe MetricConfigurationsController, :type => :controller do | ||
| 80 | KalibroClient::Processor::MetricCollector.expects(:find).with(metric_collector.name).returns(metric_collector) | 80 | KalibroClient::Processor::MetricCollector.expects(:find).with(metric_collector.name).returns(metric_collector) |
| 81 | metric_collector.expects(:metric).with(metric_configuration.metric.name).returns(metric_configuration.metric) | 81 | metric_collector.expects(:metric).with(metric_configuration.metric.name).returns(metric_configuration.metric) |
| 82 | 82 | ||
| 83 | - post :create, mezuro_configuration_id: mezuro_configuration.id, metric_configuration: metric_configuration_params, metric_collector_name: metric_collector.name, metric_name: metric_configuration.metric.name | 83 | + post :create, kalibro_configuration_id: kalibro_configuration.id, metric_configuration: metric_configuration_params, metric_collector_name: metric_collector.name, metric_name: metric_configuration.metric.name |
| 84 | end | 84 | end |
| 85 | 85 | ||
| 86 | it { is_expected.to render_template(:new) } | 86 | it { is_expected.to render_template(:new) } |
| @@ -98,7 +98,7 @@ describe MetricConfigurationsController, :type => :controller do | @@ -98,7 +98,7 @@ describe MetricConfigurationsController, :type => :controller do | ||
| 98 | subject.expects(:find_resource).with(MetricConfiguration, metric_configuration.id).returns(metric_configuration) | 98 | subject.expects(:find_resource).with(MetricConfiguration, metric_configuration.id).returns(metric_configuration) |
| 99 | metric_configuration.expects(:kalibro_ranges).returns([mezuro_range]) | 99 | metric_configuration.expects(:kalibro_ranges).returns([mezuro_range]) |
| 100 | 100 | ||
| 101 | - get :show, mezuro_configuration_id: metric_configuration.configuration_id.to_s, id: metric_configuration.id | 101 | + get :show, kalibro_configuration_id: metric_configuration.configuration_id.to_s, id: metric_configuration.id |
| 102 | end | 102 | end |
| 103 | 103 | ||
| 104 | it { is_expected.to render_template(:show) } | 104 | it { is_expected.to render_template(:show) } |
| @@ -116,7 +116,7 @@ describe MetricConfigurationsController, :type => :controller do | @@ -116,7 +116,7 @@ describe MetricConfigurationsController, :type => :controller do | ||
| 116 | before :each do | 116 | before :each do |
| 117 | subject.expects(:metric_configuration_owner?).returns(true) | 117 | subject.expects(:metric_configuration_owner?).returns(true) |
| 118 | subject.expects(:find_resource).with(MetricConfiguration, metric_configuration.id).returns(metric_configuration) | 118 | subject.expects(:find_resource).with(MetricConfiguration, metric_configuration.id).returns(metric_configuration) |
| 119 | - get :edit, id: metric_configuration.id, mezuro_configuration_id: metric_configuration.configuration_id.to_s | 119 | + get :edit, id: metric_configuration.id, kalibro_configuration_id: metric_configuration.configuration_id.to_s |
| 120 | end | 120 | end |
| 121 | 121 | ||
| 122 | it { is_expected.to render_template(:edit) } | 122 | it { is_expected.to render_template(:edit) } |
| @@ -124,10 +124,10 @@ describe MetricConfigurationsController, :type => :controller do | @@ -124,10 +124,10 @@ describe MetricConfigurationsController, :type => :controller do | ||
| 124 | 124 | ||
| 125 | context 'when the user does not own the metric configuration' do | 125 | context 'when the user does not own the metric configuration' do |
| 126 | before do | 126 | before do |
| 127 | - get :edit, id: metric_configuration.id, mezuro_configuration_id: metric_configuration.configuration_id.to_s | 127 | + get :edit, id: metric_configuration.id, kalibro_configuration_id: metric_configuration.configuration_id.to_s |
| 128 | end | 128 | end |
| 129 | 129 | ||
| 130 | - it { is_expected.to redirect_to(mezuro_configurations_path(metric_configuration.configuration_id)) } | 130 | + it { is_expected.to redirect_to(kalibro_configurations_path(metric_configuration.configuration_id)) } |
| 131 | it { is_expected.to respond_with(:redirect) } | 131 | it { is_expected.to respond_with(:redirect) } |
| 132 | it { is_expected.to set_the_flash[:notice].to("You're not allowed to do this operation") } | 132 | it { is_expected.to set_the_flash[:notice].to("You're not allowed to do this operation") } |
| 133 | end | 133 | end |
| @@ -135,7 +135,7 @@ describe MetricConfigurationsController, :type => :controller do | @@ -135,7 +135,7 @@ describe MetricConfigurationsController, :type => :controller do | ||
| 135 | 135 | ||
| 136 | context 'with no user logged in' do | 136 | context 'with no user logged in' do |
| 137 | before :each do | 137 | before :each do |
| 138 | - get :edit, id: metric_configuration.id, mezuro_configuration_id: metric_configuration.configuration_id.to_s | 138 | + get :edit, id: metric_configuration.id, kalibro_configuration_id: metric_configuration.configuration_id.to_s |
| 139 | end | 139 | end |
| 140 | 140 | ||
| 141 | it { is_expected.to redirect_to new_user_session_path } | 141 | it { is_expected.to redirect_to new_user_session_path } |
| @@ -161,10 +161,10 @@ describe MetricConfigurationsController, :type => :controller do | @@ -161,10 +161,10 @@ describe MetricConfigurationsController, :type => :controller do | ||
| 161 | subject.expects(:find_resource).with(MetricConfiguration, metric_configuration.id).returns(metric_configuration) | 161 | subject.expects(:find_resource).with(MetricConfiguration, metric_configuration.id).returns(metric_configuration) |
| 162 | MetricConfiguration.any_instance.expects(:update).with(metric_configuration_params).returns(true) | 162 | MetricConfiguration.any_instance.expects(:update).with(metric_configuration_params).returns(true) |
| 163 | 163 | ||
| 164 | - post :update, mezuro_configuration_id: metric_configuration.configuration_id, id: metric_configuration.id, metric_configuration: metric_configuration_params | 164 | + post :update, kalibro_configuration_id: metric_configuration.configuration_id, id: metric_configuration.id, metric_configuration: metric_configuration_params |
| 165 | end | 165 | end |
| 166 | 166 | ||
| 167 | - it { is_expected.to redirect_to(mezuro_configuration_path(metric_configuration.configuration_id)) } | 167 | + it { is_expected.to redirect_to(kalibro_configuration_path(metric_configuration.configuration_id)) } |
| 168 | it { is_expected.to respond_with(:redirect) } | 168 | it { is_expected.to respond_with(:redirect) } |
| 169 | end | 169 | end |
| 170 | 170 | ||
| @@ -173,7 +173,7 @@ describe MetricConfigurationsController, :type => :controller do | @@ -173,7 +173,7 @@ describe MetricConfigurationsController, :type => :controller do | ||
| 173 | subject.expects(:find_resource).with(MetricConfiguration, metric_configuration.id).returns(metric_configuration) | 173 | subject.expects(:find_resource).with(MetricConfiguration, metric_configuration.id).returns(metric_configuration) |
| 174 | MetricConfiguration.any_instance.expects(:update).with(metric_configuration_params).returns(false) | 174 | MetricConfiguration.any_instance.expects(:update).with(metric_configuration_params).returns(false) |
| 175 | 175 | ||
| 176 | - post :update, mezuro_configuration_id: metric_configuration.configuration_id, id: metric_configuration.id, metric_configuration: metric_configuration_params | 176 | + post :update, kalibro_configuration_id: metric_configuration.configuration_id, id: metric_configuration.id, metric_configuration: metric_configuration_params |
| 177 | end | 177 | end |
| 178 | 178 | ||
| 179 | it { is_expected.to render_template(:edit) } | 179 | it { is_expected.to render_template(:edit) } |
| @@ -182,10 +182,10 @@ describe MetricConfigurationsController, :type => :controller do | @@ -182,10 +182,10 @@ describe MetricConfigurationsController, :type => :controller do | ||
| 182 | 182 | ||
| 183 | context 'when the user does not own the reading' do | 183 | context 'when the user does not own the reading' do |
| 184 | before :each do | 184 | before :each do |
| 185 | - post :update, mezuro_configuration_id: metric_configuration.configuration_id, id: metric_configuration.id, metric_configuration: metric_configuration_params | 185 | + post :update, kalibro_configuration_id: metric_configuration.configuration_id, id: metric_configuration.id, metric_configuration: metric_configuration_params |
| 186 | end | 186 | end |
| 187 | 187 | ||
| 188 | - it { is_expected.to redirect_to mezuro_configurations_path(metric_configuration.configuration_id) } | 188 | + it { is_expected.to redirect_to kalibro_configurations_path(metric_configuration.configuration_id) } |
| 189 | end | 189 | end |
| 190 | end | 190 | end |
| 191 | end | 191 | end |
| @@ -205,26 +205,26 @@ describe MetricConfigurationsController, :type => :controller do | @@ -205,26 +205,26 @@ describe MetricConfigurationsController, :type => :controller do | ||
| 205 | metric_configuration.expects(:destroy) | 205 | metric_configuration.expects(:destroy) |
| 206 | subject.expects(:find_resource).with(MetricConfiguration, metric_configuration.id).returns(metric_configuration) | 206 | subject.expects(:find_resource).with(MetricConfiguration, metric_configuration.id).returns(metric_configuration) |
| 207 | 207 | ||
| 208 | - delete :destroy, id: metric_configuration.id, mezuro_configuration_id: metric_configuration.configuration_id.to_s | 208 | + delete :destroy, id: metric_configuration.id, kalibro_configuration_id: metric_configuration.configuration_id.to_s |
| 209 | end | 209 | end |
| 210 | 210 | ||
| 211 | - it { is_expected.to redirect_to(mezuro_configuration_path(metric_configuration.configuration_id)) } | 211 | + it { is_expected.to redirect_to(kalibro_configuration_path(metric_configuration.configuration_id)) } |
| 212 | it { is_expected.to respond_with(:redirect) } | 212 | it { is_expected.to respond_with(:redirect) } |
| 213 | end | 213 | end |
| 214 | 214 | ||
| 215 | context "when the user doesn't own the configuration" do | 215 | context "when the user doesn't own the configuration" do |
| 216 | before :each do | 216 | before :each do |
| 217 | - delete :destroy, id: metric_configuration.id, mezuro_configuration_id: metric_configuration.configuration_id.to_s | 217 | + delete :destroy, id: metric_configuration.id, kalibro_configuration_id: metric_configuration.configuration_id.to_s |
| 218 | end | 218 | end |
| 219 | 219 | ||
| 220 | - it { is_expected.to redirect_to(mezuro_configurations_path(metric_configuration.configuration_id)) } | 220 | + it { is_expected.to redirect_to(kalibro_configurations_path(metric_configuration.configuration_id)) } |
| 221 | it { is_expected.to respond_with(:redirect) } | 221 | it { is_expected.to respond_with(:redirect) } |
| 222 | end | 222 | end |
| 223 | end | 223 | end |
| 224 | 224 | ||
| 225 | context 'with no User logged in' do | 225 | context 'with no User logged in' do |
| 226 | before :each do | 226 | before :each do |
| 227 | - delete :destroy, id: metric_configuration.id, mezuro_configuration_id: mezuro_configuration.id.to_s | 227 | + delete :destroy, id: metric_configuration.id, kalibro_configuration_id: kalibro_configuration.id.to_s |
| 228 | end | 228 | end |
| 229 | 229 | ||
| 230 | it { is_expected.to redirect_to new_user_session_path } | 230 | it { is_expected.to redirect_to new_user_session_path } |
spec/controllers/mezuro_configurations_controller_spec.rb
| 1 | require 'rails_helper' | 1 | require 'rails_helper' |
| 2 | 2 | ||
| 3 | -describe MezuroConfigurationsController, :type => :controller do | 3 | +describe KalibroConfigurationsController, :type => :controller do |
| 4 | 4 | ||
| 5 | describe 'new' do | 5 | describe 'new' do |
| 6 | before :each do | 6 | before :each do |
| @@ -18,26 +18,26 @@ describe MezuroConfigurationsController, :type => :controller do | @@ -18,26 +18,26 @@ describe MezuroConfigurationsController, :type => :controller do | ||
| 18 | end | 18 | end |
| 19 | 19 | ||
| 20 | context 'with valid fields' do | 20 | context 'with valid fields' do |
| 21 | - let(:mezuro_configuration) { FactoryGirl.build(:mezuro_configuration) } | ||
| 22 | - let(:subject_params) { Hash[FactoryGirl.attributes_for(:mezuro_configuration).map { |k,v| [k.to_s, v.to_s] }] } #FIXME: Mocha is creating the expectations with strings, but FactoryGirl returns everything with sybols and integers | 21 | + let(:kalibro_configuration) { FactoryGirl.build(:kalibro_configuration) } |
| 22 | + let(:subject_params) { Hash[FactoryGirl.attributes_for(:kalibro_configuration).map { |k,v| [k.to_s, v.to_s] }] } #FIXME: Mocha is creating the expectations with strings, but FactoryGirl returns everything with sybols and integers | ||
| 23 | 23 | ||
| 24 | before :each do | 24 | before :each do |
| 25 | - MezuroConfiguration.any_instance.expects(:save).returns(true) | 25 | + KalibroConfiguration.any_instance.expects(:save).returns(true) |
| 26 | end | 26 | end |
| 27 | 27 | ||
| 28 | context 'rendering the show' do | 28 | context 'rendering the show' do |
| 29 | before :each do | 29 | before :each do |
| 30 | - post :create, :mezuro_configuration => subject_params | 30 | + post :create, :kalibro_configuration => subject_params |
| 31 | end | 31 | end |
| 32 | 32 | ||
| 33 | it 'should redirect to the show view' do | 33 | it 'should redirect to the show view' do |
| 34 | - expect(response).to redirect_to mezuro_configuration_path(mezuro_configuration.id) | 34 | + expect(response).to redirect_to kalibro_configuration_path(kalibro_configuration.id) |
| 35 | end | 35 | end |
| 36 | end | 36 | end |
| 37 | 37 | ||
| 38 | context 'without rendering the show view' do | 38 | context 'without rendering the show view' do |
| 39 | before :each do | 39 | before :each do |
| 40 | - post :create, :mezuro_configuration => subject_params | 40 | + post :create, :kalibro_configuration => subject_params |
| 41 | end | 41 | end |
| 42 | 42 | ||
| 43 | it { is_expected.to respond_with(:redirect) } | 43 | it { is_expected.to respond_with(:redirect) } |
| @@ -46,13 +46,13 @@ describe MezuroConfigurationsController, :type => :controller do | @@ -46,13 +46,13 @@ describe MezuroConfigurationsController, :type => :controller do | ||
| 46 | 46 | ||
| 47 | context 'with an invalid field' do | 47 | context 'with an invalid field' do |
| 48 | before :each do | 48 | before :each do |
| 49 | - @subject = FactoryGirl.build(:mezuro_configuration) | ||
| 50 | - @subject_params = Hash[FactoryGirl.attributes_for(:mezuro_configuration).map { |k,v| [k.to_s, v.to_s] }] #FIXME: Mocha is creating the expectations with strings, but FactoryGirl returns everything with sybols and integers | 49 | + @subject = FactoryGirl.build(:kalibro_configuration) |
| 50 | + @subject_params = Hash[FactoryGirl.attributes_for(:kalibro_configuration).map { |k,v| [k.to_s, v.to_s] }] #FIXME: Mocha is creating the expectations with strings, but FactoryGirl returns everything with sybols and integers | ||
| 51 | 51 | ||
| 52 | - MezuroConfiguration.expects(:new).at_least_once.with(@subject_params).returns(@subject) | ||
| 53 | - MezuroConfiguration.any_instance.expects(:save).returns(false) | 52 | + KalibroConfiguration.expects(:new).at_least_once.with(@subject_params).returns(@subject) |
| 53 | + KalibroConfiguration.any_instance.expects(:save).returns(false) | ||
| 54 | 54 | ||
| 55 | - post :create, :mezuro_configuration => @subject_params | 55 | + post :create, :kalibro_configuration => @subject_params |
| 56 | end | 56 | end |
| 57 | 57 | ||
| 58 | it { is_expected.to render_template(:new) } | 58 | it { is_expected.to render_template(:new) } |
| @@ -60,14 +60,14 @@ describe MezuroConfigurationsController, :type => :controller do | @@ -60,14 +60,14 @@ describe MezuroConfigurationsController, :type => :controller do | ||
| 60 | end | 60 | end |
| 61 | 61 | ||
| 62 | describe 'show' do | 62 | describe 'show' do |
| 63 | - let(:mezuro_configuration) { FactoryGirl.build(:mezuro_configuration) } | 63 | + let(:kalibro_configuration) { FactoryGirl.build(:kalibro_configuration) } |
| 64 | let(:metric_configuration) { FactoryGirl.build(:metric_configuration) } | 64 | let(:metric_configuration) { FactoryGirl.build(:metric_configuration) } |
| 65 | 65 | ||
| 66 | before :each do | 66 | before :each do |
| 67 | - mezuro_configuration.expects(:metric_configurations).returns(metric_configuration) | ||
| 68 | - subject.expects(:find_resource).with(MezuroConfiguration, mezuro_configuration.id).returns(mezuro_configuration) | 67 | + kalibro_configuration.expects(:metric_configurations).returns(metric_configuration) |
| 68 | + subject.expects(:find_resource).with(KalibroConfiguration, kalibro_configuration.id).returns(kalibro_configuration) | ||
| 69 | 69 | ||
| 70 | - get :show, :id => mezuro_configuration.id | 70 | + get :show, :id => kalibro_configuration.id |
| 71 | end | 71 | end |
| 72 | 72 | ||
| 73 | it { is_expected.to render_template(:show) } | 73 | it { is_expected.to render_template(:show) } |
| @@ -75,47 +75,47 @@ describe MezuroConfigurationsController, :type => :controller do | @@ -75,47 +75,47 @@ describe MezuroConfigurationsController, :type => :controller do | ||
| 75 | 75 | ||
| 76 | describe 'destroy' do | 76 | describe 'destroy' do |
| 77 | before do | 77 | before do |
| 78 | - @subject = FactoryGirl.build(:mezuro_configuration) | 78 | + @subject = FactoryGirl.build(:kalibro_configuration) |
| 79 | end | 79 | end |
| 80 | 80 | ||
| 81 | context 'with an User logged in' do | 81 | context 'with an User logged in' do |
| 82 | before do | 82 | before do |
| 83 | sign_in FactoryGirl.create(:user) | 83 | sign_in FactoryGirl.create(:user) |
| 84 | - @ownership = FactoryGirl.build(:mezuro_configuration_ownership) | 84 | + @ownership = FactoryGirl.build(:kalibro_configuration_ownership) |
| 85 | @ownerships = [] | 85 | @ownerships = [] |
| 86 | end | 86 | end |
| 87 | 87 | ||
| 88 | - context 'when the user owns the mezuro_configuration' do | 88 | + context 'when the user owns the kalibro_configuration' do |
| 89 | before :each do | 89 | before :each do |
| 90 | @ownership.expects(:destroy) | 90 | @ownership.expects(:destroy) |
| 91 | @subject.expects(:destroy) | 91 | @subject.expects(:destroy) |
| 92 | 92 | ||
| 93 | #Those two mocks looks the same but they are necessary since params[:id] is a String and @configuration.id is an Integer :( | 93 | #Those two mocks looks the same but they are necessary since params[:id] is a String and @configuration.id is an Integer :( |
| 94 | - @ownerships.expects(:find_by_mezuro_configuration_id).with("#{@subject.id}").returns(@ownership) | ||
| 95 | - @ownerships.expects(:find_by_mezuro_configuration_id).with(@subject.id).returns(@ownership) | 94 | + @ownerships.expects(:find_by_kalibro_configuration_id).with("#{@subject.id}").returns(@ownership) |
| 95 | + @ownerships.expects(:find_by_kalibro_configuration_id).with(@subject.id).returns(@ownership) | ||
| 96 | 96 | ||
| 97 | - User.any_instance.expects(:mezuro_configuration_ownerships).at_least_once.returns(@ownerships) | 97 | + User.any_instance.expects(:kalibro_configuration_ownerships).at_least_once.returns(@ownerships) |
| 98 | 98 | ||
| 99 | - subject.expects(:find_resource).with(MezuroConfiguration, @subject.id).returns(@subject) | 99 | + subject.expects(:find_resource).with(KalibroConfiguration, @subject.id).returns(@subject) |
| 100 | delete :destroy, :id => @subject.id | 100 | delete :destroy, :id => @subject.id |
| 101 | end | 101 | end |
| 102 | 102 | ||
| 103 | - it 'should redirect to the mezuro_configurations page' do | ||
| 104 | - expect(response).to redirect_to mezuro_configurations_url | 103 | + it 'should redirect to the kalibro_configurations page' do |
| 104 | + expect(response).to redirect_to kalibro_configurations_url | ||
| 105 | end | 105 | end |
| 106 | 106 | ||
| 107 | it { is_expected.to respond_with(:redirect) } | 107 | it { is_expected.to respond_with(:redirect) } |
| 108 | end | 108 | end |
| 109 | 109 | ||
| 110 | - context "when the user doesn't own the mezuro_configuration" do | 110 | + context "when the user doesn't own the kalibro_configuration" do |
| 111 | before :each do | 111 | before :each do |
| 112 | - @ownerships.expects(:find_by_mezuro_configuration_id).with("#{@subject.id}").returns(nil) | ||
| 113 | - User.any_instance.expects(:mezuro_configuration_ownerships).at_least_once.returns(@ownerships) | 112 | + @ownerships.expects(:find_by_kalibro_configuration_id).with("#{@subject.id}").returns(nil) |
| 113 | + User.any_instance.expects(:kalibro_configuration_ownerships).at_least_once.returns(@ownerships) | ||
| 114 | 114 | ||
| 115 | delete :destroy, :id => @subject.id | 115 | delete :destroy, :id => @subject.id |
| 116 | end | 116 | end |
| 117 | 117 | ||
| 118 | - it { is_expected.to redirect_to(mezuro_configurations_path(@subject.id)) } | 118 | + it { is_expected.to redirect_to(kalibro_configurations_path(@subject.id)) } |
| 119 | end | 119 | end |
| 120 | end | 120 | end |
| 121 | 121 | ||
| @@ -130,8 +130,8 @@ describe MezuroConfigurationsController, :type => :controller do | @@ -130,8 +130,8 @@ describe MezuroConfigurationsController, :type => :controller do | ||
| 130 | 130 | ||
| 131 | describe 'index' do | 131 | describe 'index' do |
| 132 | before :each do | 132 | before :each do |
| 133 | - @subject = FactoryGirl.build(:mezuro_configuration) | ||
| 134 | - MezuroConfiguration.expects(:all).returns([@subject]) | 133 | + @subject = FactoryGirl.build(:kalibro_configuration) |
| 134 | + KalibroConfiguration.expects(:all).returns([@subject]) | ||
| 135 | get :index | 135 | get :index |
| 136 | end | 136 | end |
| 137 | 137 | ||
| @@ -140,44 +140,44 @@ describe MezuroConfigurationsController, :type => :controller do | @@ -140,44 +140,44 @@ describe MezuroConfigurationsController, :type => :controller do | ||
| 140 | 140 | ||
| 141 | describe 'edit' do | 141 | describe 'edit' do |
| 142 | before do | 142 | before do |
| 143 | - @subject = FactoryGirl.build(:mezuro_configuration) | 143 | + @subject = FactoryGirl.build(:kalibro_configuration) |
| 144 | end | 144 | end |
| 145 | 145 | ||
| 146 | context 'with an User logged in' do | 146 | context 'with an User logged in' do |
| 147 | before do | 147 | before do |
| 148 | @user = FactoryGirl.create(:user) | 148 | @user = FactoryGirl.create(:user) |
| 149 | - @ownership = FactoryGirl.build(:mezuro_configuration_ownership) | 149 | + @ownership = FactoryGirl.build(:kalibro_configuration_ownership) |
| 150 | @ownerships = [] | 150 | @ownerships = [] |
| 151 | 151 | ||
| 152 | - User.any_instance.expects(:mezuro_configuration_ownerships).at_least_once.returns(@ownerships) | 152 | + User.any_instance.expects(:kalibro_configuration_ownerships).at_least_once.returns(@ownerships) |
| 153 | 153 | ||
| 154 | sign_in @user | 154 | sign_in @user |
| 155 | end | 155 | end |
| 156 | 156 | ||
| 157 | - context 'when the user owns the mezuro_configuration' do | 157 | + context 'when the user owns the kalibro_configuration' do |
| 158 | before :each do | 158 | before :each do |
| 159 | - subject.expects(:find_resource).with(MezuroConfiguration, @subject.id).returns(@subject) | ||
| 160 | - @ownerships.expects(:find_by_mezuro_configuration_id).with("#{@subject.id}").returns(@ownership) | 159 | + subject.expects(:find_resource).with(KalibroConfiguration, @subject.id).returns(@subject) |
| 160 | + @ownerships.expects(:find_by_kalibro_configuration_id).with("#{@subject.id}").returns(@ownership) | ||
| 161 | 161 | ||
| 162 | get :edit, :id => @subject.id | 162 | get :edit, :id => @subject.id |
| 163 | end | 163 | end |
| 164 | 164 | ||
| 165 | it { is_expected.to render_template(:edit) } | 165 | it { is_expected.to render_template(:edit) } |
| 166 | 166 | ||
| 167 | - it 'should assign to @mezuro_configuration the @subject' do | ||
| 168 | - expect(assigns(:mezuro_configuration)).to eq(@subject) | 167 | + it 'should assign to @kalibro_configuration the @subject' do |
| 168 | + expect(assigns(:kalibro_configuration)).to eq(@subject) | ||
| 169 | end | 169 | end |
| 170 | end | 170 | end |
| 171 | 171 | ||
| 172 | - context 'when the user does not own the mezuro_configuration' do | 172 | + context 'when the user does not own the kalibro_configuration' do |
| 173 | before do | 173 | before do |
| 174 | - @subject = FactoryGirl.build(:another_mezuro_configuration) | ||
| 175 | - @ownerships.expects(:find_by_mezuro_configuration_id).with("#{@subject.id}").returns(nil) | 174 | + @subject = FactoryGirl.build(:another_kalibro_configuration) |
| 175 | + @ownerships.expects(:find_by_kalibro_configuration_id).with("#{@subject.id}").returns(nil) | ||
| 176 | 176 | ||
| 177 | get :edit, :id => @subject.id | 177 | get :edit, :id => @subject.id |
| 178 | end | 178 | end |
| 179 | 179 | ||
| 180 | - it { is_expected.to redirect_to(mezuro_configurations_path(@subject.id)) } | 180 | + it { is_expected.to redirect_to(kalibro_configurations_path(@subject.id)) } |
| 181 | it { is_expected.to set_the_flash[:notice].to("You're not allowed to do this operation") } | 181 | it { is_expected.to set_the_flash[:notice].to("You're not allowed to do this operation") } |
| 182 | end | 182 | end |
| 183 | end | 183 | end |
| @@ -192,42 +192,42 @@ describe MezuroConfigurationsController, :type => :controller do | @@ -192,42 +192,42 @@ describe MezuroConfigurationsController, :type => :controller do | ||
| 192 | end | 192 | end |
| 193 | 193 | ||
| 194 | describe 'update' do | 194 | describe 'update' do |
| 195 | - let(:mezuro_configuration) {FactoryGirl.build(:mezuro_configuration)} | ||
| 196 | - let(:mezuro_configuration_params) {Hash[FactoryGirl.attributes_for(:mezuro_configuration).map { |k,v| [k.to_s, v.to_s] }] } #FIXME: Mocha is creating the expectations with strings, but FactoryGirl returns everything with sybols and integers | 195 | + let(:kalibro_configuration) {FactoryGirl.build(:kalibro_configuration)} |
| 196 | + let(:kalibro_configuration_params) {Hash[FactoryGirl.attributes_for(:kalibro_configuration).map { |k,v| [k.to_s, v.to_s] }] } #FIXME: Mocha is creating the expectations with strings, but FactoryGirl returns everything with sybols and integers | ||
| 197 | 197 | ||
| 198 | context 'when the user is logged in' do | 198 | context 'when the user is logged in' do |
| 199 | before do | 199 | before do |
| 200 | sign_in FactoryGirl.create(:user) | 200 | sign_in FactoryGirl.create(:user) |
| 201 | end | 201 | end |
| 202 | 202 | ||
| 203 | - context 'when user owns the mezuro_configuration' do | 203 | + context 'when user owns the kalibro_configuration' do |
| 204 | before do | 204 | before do |
| 205 | - @ownership = FactoryGirl.build(:mezuro_configuration_ownership) | 205 | + @ownership = FactoryGirl.build(:kalibro_configuration_ownership) |
| 206 | @ownerships = [] | 206 | @ownerships = [] |
| 207 | 207 | ||
| 208 | - @ownerships.expects(:find_by_mezuro_configuration_id).with("#{mezuro_configuration.id}").returns(@ownership) | ||
| 209 | - User.any_instance.expects(:mezuro_configuration_ownerships).at_least_once.returns(@ownerships) | 208 | + @ownerships.expects(:find_by_kalibro_configuration_id).with("#{kalibro_configuration.id}").returns(@ownership) |
| 209 | + User.any_instance.expects(:kalibro_configuration_ownerships).at_least_once.returns(@ownerships) | ||
| 210 | end | 210 | end |
| 211 | 211 | ||
| 212 | context 'with valid fields' do | 212 | context 'with valid fields' do |
| 213 | before :each do | 213 | before :each do |
| 214 | - subject.expects(:find_resource).with(MezuroConfiguration, mezuro_configuration.id).returns(mezuro_configuration) | ||
| 215 | - MezuroConfiguration.any_instance.expects(:update).with(mezuro_configuration_params).returns(true) | 214 | + subject.expects(:find_resource).with(KalibroConfiguration, kalibro_configuration.id).returns(kalibro_configuration) |
| 215 | + KalibroConfiguration.any_instance.expects(:update).with(kalibro_configuration_params).returns(true) | ||
| 216 | end | 216 | end |
| 217 | 217 | ||
| 218 | context 'rendering the show' do | 218 | context 'rendering the show' do |
| 219 | before :each do | 219 | before :each do |
| 220 | - post :update, :id => mezuro_configuration.id, :mezuro_configuration => mezuro_configuration_params | 220 | + post :update, :id => kalibro_configuration.id, :kalibro_configuration => kalibro_configuration_params |
| 221 | end | 221 | end |
| 222 | 222 | ||
| 223 | it 'should redirect to the show view' do | 223 | it 'should redirect to the show view' do |
| 224 | - expect(response).to redirect_to mezuro_configuration_path(mezuro_configuration.id) | 224 | + expect(response).to redirect_to kalibro_configuration_path(kalibro_configuration.id) |
| 225 | end | 225 | end |
| 226 | end | 226 | end |
| 227 | 227 | ||
| 228 | context 'without rendering the show view' do | 228 | context 'without rendering the show view' do |
| 229 | before :each do | 229 | before :each do |
| 230 | - post :update, :id => mezuro_configuration.id, :mezuro_configuration => mezuro_configuration_params | 230 | + post :update, :id => kalibro_configuration.id, :kalibro_configuration => kalibro_configuration_params |
| 231 | end | 231 | end |
| 232 | 232 | ||
| 233 | it { is_expected.to respond_with(:redirect) } | 233 | it { is_expected.to respond_with(:redirect) } |
| @@ -236,28 +236,28 @@ describe MezuroConfigurationsController, :type => :controller do | @@ -236,28 +236,28 @@ describe MezuroConfigurationsController, :type => :controller do | ||
| 236 | 236 | ||
| 237 | context 'with an invalid field' do | 237 | context 'with an invalid field' do |
| 238 | before :each do | 238 | before :each do |
| 239 | - subject.expects(:find_resource).with(MezuroConfiguration, mezuro_configuration.id).returns(mezuro_configuration) | ||
| 240 | - MezuroConfiguration.any_instance.expects(:update).with(mezuro_configuration_params).returns(false) | 239 | + subject.expects(:find_resource).with(KalibroConfiguration, kalibro_configuration.id).returns(kalibro_configuration) |
| 240 | + KalibroConfiguration.any_instance.expects(:update).with(kalibro_configuration_params).returns(false) | ||
| 241 | 241 | ||
| 242 | - post :update, :id => mezuro_configuration.id, :mezuro_configuration => mezuro_configuration_params | 242 | + post :update, :id => kalibro_configuration.id, :kalibro_configuration => kalibro_configuration_params |
| 243 | end | 243 | end |
| 244 | 244 | ||
| 245 | it { is_expected.to render_template(:edit) } | 245 | it { is_expected.to render_template(:edit) } |
| 246 | end | 246 | end |
| 247 | end | 247 | end |
| 248 | 248 | ||
| 249 | - context 'when the user does not own the mezuro_configuration' do | 249 | + context 'when the user does not own the kalibro_configuration' do |
| 250 | before :each do | 250 | before :each do |
| 251 | - post :update, :id => mezuro_configuration.id, :mezuro_configuration => mezuro_configuration_params | 251 | + post :update, :id => kalibro_configuration.id, :kalibro_configuration => kalibro_configuration_params |
| 252 | end | 252 | end |
| 253 | 253 | ||
| 254 | - it { is_expected.to redirect_to mezuro_configurations_path(mezuro_configuration.id) } | 254 | + it { is_expected.to redirect_to kalibro_configurations_path(kalibro_configuration.id) } |
| 255 | end | 255 | end |
| 256 | end | 256 | end |
| 257 | 257 | ||
| 258 | context 'with no user logged in' do | 258 | context 'with no user logged in' do |
| 259 | before :each do | 259 | before :each do |
| 260 | - post :update, :id => mezuro_configuration.id, :mezuro_configuration => mezuro_configuration_params | 260 | + post :update, :id => kalibro_configuration.id, :kalibro_configuration => kalibro_configuration_params |
| 261 | end | 261 | end |
| 262 | 262 | ||
| 263 | it { is_expected.to redirect_to new_user_session_path } | 263 | it { is_expected.to redirect_to new_user_session_path } |
spec/controllers/mezuro_ranges_controller_spec.rb
| @@ -5,7 +5,7 @@ describe MezuroRangesController, :type => :controller do | @@ -5,7 +5,7 @@ describe MezuroRangesController, :type => :controller do | ||
| 5 | let(:metric_configuration) { FactoryGirl.build(:metric_configuration) } | 5 | let(:metric_configuration) { FactoryGirl.build(:metric_configuration) } |
| 6 | 6 | ||
| 7 | describe 'new' do | 7 | describe 'new' do |
| 8 | - let(:mezuro_configuration) { FactoryGirl.build(:mezuro_configuration) } | 8 | + let(:kalibro_configuration) { FactoryGirl.build(:kalibro_configuration) } |
| 9 | 9 | ||
| 10 | before :each do | 10 | before :each do |
| 11 | sign_in FactoryGirl.create(:user) | 11 | sign_in FactoryGirl.create(:user) |
| @@ -16,7 +16,7 @@ describe MezuroRangesController, :type => :controller do | @@ -16,7 +16,7 @@ describe MezuroRangesController, :type => :controller do | ||
| 16 | subject.expects(:metric_configuration_owner?).returns true | 16 | subject.expects(:metric_configuration_owner?).returns true |
| 17 | MetricConfiguration.expects(:find).with(mezuro_range.metric_configuration_id).returns(metric_configuration) | 17 | MetricConfiguration.expects(:find).with(mezuro_range.metric_configuration_id).returns(metric_configuration) |
| 18 | Reading.expects(:readings_of).with(metric_configuration.reading_group_id).returns([]) | 18 | Reading.expects(:readings_of).with(metric_configuration.reading_group_id).returns([]) |
| 19 | - get :new, mezuro_configuration_id: mezuro_configuration.id, metric_configuration_id: mezuro_range.metric_configuration_id | 19 | + get :new, kalibro_configuration_id: kalibro_configuration.id, metric_configuration_id: mezuro_range.metric_configuration_id |
| 20 | end | 20 | end |
| 21 | 21 | ||
| 22 | it { is_expected.to respond_with(:success) } | 22 | it { is_expected.to respond_with(:success) } |
| @@ -25,17 +25,17 @@ describe MezuroRangesController, :type => :controller do | @@ -25,17 +25,17 @@ describe MezuroRangesController, :type => :controller do | ||
| 25 | 25 | ||
| 26 | context "when the current user doesn't owns the metric configuration" do | 26 | context "when the current user doesn't owns the metric configuration" do |
| 27 | before :each do | 27 | before :each do |
| 28 | - get :new, mezuro_configuration_id: mezuro_configuration.id, metric_configuration_id: mezuro_range.metric_configuration_id | 28 | + get :new, kalibro_configuration_id: kalibro_configuration.id, metric_configuration_id: mezuro_range.metric_configuration_id |
| 29 | end | 29 | end |
| 30 | 30 | ||
| 31 | - it { is_expected.to redirect_to(mezuro_configurations_path(mezuro_configuration.id)) } | 31 | + it { is_expected.to redirect_to(kalibro_configurations_path(kalibro_configuration.id)) } |
| 32 | it { is_expected.to respond_with(:redirect) } | 32 | it { is_expected.to respond_with(:redirect) } |
| 33 | end | 33 | end |
| 34 | end | 34 | end |
| 35 | 35 | ||
| 36 | describe 'create' do | 36 | describe 'create' do |
| 37 | let(:mezuro_range_params) { Hash[FactoryGirl.attributes_for(:mezuro_range).map { |k,v| [k.to_s, v.to_s] }] } #FIXME: Mocha is creating the expectations with strings, but FactoryGirl returns everything with symbols and integers | 37 | let(:mezuro_range_params) { Hash[FactoryGirl.attributes_for(:mezuro_range).map { |k,v| [k.to_s, v.to_s] }] } #FIXME: Mocha is creating the expectations with strings, but FactoryGirl returns everything with symbols and integers |
| 38 | - let(:mezuro_configuration) { FactoryGirl.build(:mezuro_configuration) } | 38 | + let(:kalibro_configuration) { FactoryGirl.build(:kalibro_configuration) } |
| 39 | 39 | ||
| 40 | before do | 40 | before do |
| 41 | sign_in FactoryGirl.create(:user) | 41 | sign_in FactoryGirl.create(:user) |
| @@ -50,7 +50,7 @@ describe MezuroRangesController, :type => :controller do | @@ -50,7 +50,7 @@ describe MezuroRangesController, :type => :controller do | ||
| 50 | before :each do | 50 | before :each do |
| 51 | MezuroRange.any_instance.expects(:save).returns(true) | 51 | MezuroRange.any_instance.expects(:save).returns(true) |
| 52 | 52 | ||
| 53 | - post :create, mezuro_configuration_id: mezuro_configuration.id, metric_configuration_id: metric_configuration.id, mezuro_range: mezuro_range_params | 53 | + post :create, kalibro_configuration_id: kalibro_configuration.id, metric_configuration_id: metric_configuration.id, mezuro_range: mezuro_range_params |
| 54 | end | 54 | end |
| 55 | 55 | ||
| 56 | it { is_expected.to respond_with(:redirect) } | 56 | it { is_expected.to respond_with(:redirect) } |
| @@ -62,7 +62,7 @@ describe MezuroRangesController, :type => :controller do | @@ -62,7 +62,7 @@ describe MezuroRangesController, :type => :controller do | ||
| 62 | MetricConfiguration.expects(:find).with(metric_configuration.id).returns(metric_configuration) | 62 | MetricConfiguration.expects(:find).with(metric_configuration.id).returns(metric_configuration) |
| 63 | Reading.expects(:readings_of).with(metric_configuration.reading_group_id).returns([]) | 63 | Reading.expects(:readings_of).with(metric_configuration.reading_group_id).returns([]) |
| 64 | 64 | ||
| 65 | - post :create, mezuro_configuration_id: mezuro_configuration.id, metric_configuration_id: metric_configuration.id, mezuro_range: mezuro_range_params | 65 | + post :create, kalibro_configuration_id: kalibro_configuration.id, metric_configuration_id: metric_configuration.id, mezuro_range: mezuro_range_params |
| 66 | end | 66 | end |
| 67 | 67 | ||
| 68 | it { is_expected.to render_template(:new) } | 68 | it { is_expected.to render_template(:new) } |
| @@ -82,26 +82,26 @@ describe MezuroRangesController, :type => :controller do | @@ -82,26 +82,26 @@ describe MezuroRangesController, :type => :controller do | ||
| 82 | mezuro_range.expects(:destroy) | 82 | mezuro_range.expects(:destroy) |
| 83 | subject.expects(:find_resource).with(MezuroRange, mezuro_range.id).returns(mezuro_range) | 83 | subject.expects(:find_resource).with(MezuroRange, mezuro_range.id).returns(mezuro_range) |
| 84 | 84 | ||
| 85 | - delete :destroy, id: mezuro_range.id.to_s, metric_configuration_id: metric_configuration.id.to_s, mezuro_configuration_id: metric_configuration.configuration_id.to_s | 85 | + delete :destroy, id: mezuro_range.id.to_s, metric_configuration_id: metric_configuration.id.to_s, kalibro_configuration_id: metric_configuration.configuration_id.to_s |
| 86 | end | 86 | end |
| 87 | 87 | ||
| 88 | - it { is_expected.to redirect_to(mezuro_configuration_metric_configuration_path(metric_configuration.configuration_id, metric_configuration.id)) } | 88 | + it { is_expected.to redirect_to(kalibro_configuration_metric_configuration_path(metric_configuration.configuration_id, metric_configuration.id)) } |
| 89 | it { is_expected.to respond_with(:redirect) } | 89 | it { is_expected.to respond_with(:redirect) } |
| 90 | end | 90 | end |
| 91 | 91 | ||
| 92 | context "when the user doesn't own the metric configuration" do | 92 | context "when the user doesn't own the metric configuration" do |
| 93 | before :each do | 93 | before :each do |
| 94 | - delete :destroy, id: mezuro_range.id.to_s, metric_configuration_id: metric_configuration.id.to_s, mezuro_configuration_id: metric_configuration.configuration_id.to_s | 94 | + delete :destroy, id: mezuro_range.id.to_s, metric_configuration_id: metric_configuration.id.to_s, kalibro_configuration_id: metric_configuration.configuration_id.to_s |
| 95 | end | 95 | end |
| 96 | 96 | ||
| 97 | - it { is_expected.to redirect_to(mezuro_configurations_path(metric_configuration.configuration_id)) } | 97 | + it { is_expected.to redirect_to(kalibro_configurations_path(metric_configuration.configuration_id)) } |
| 98 | it { is_expected.to respond_with(:redirect) } | 98 | it { is_expected.to respond_with(:redirect) } |
| 99 | end | 99 | end |
| 100 | end | 100 | end |
| 101 | 101 | ||
| 102 | context 'with no User logged in' do | 102 | context 'with no User logged in' do |
| 103 | before :each do | 103 | before :each do |
| 104 | - delete :destroy, id: mezuro_range.id.to_s, metric_configuration_id: metric_configuration.id.to_s, mezuro_configuration_id: metric_configuration.configuration_id.to_s | 104 | + delete :destroy, id: mezuro_range.id.to_s, metric_configuration_id: metric_configuration.id.to_s, kalibro_configuration_id: metric_configuration.configuration_id.to_s |
| 105 | end | 105 | end |
| 106 | 106 | ||
| 107 | it { is_expected.to redirect_to new_user_session_path } | 107 | it { is_expected.to redirect_to new_user_session_path } |
| @@ -124,7 +124,7 @@ describe MezuroRangesController, :type => :controller do | @@ -124,7 +124,7 @@ describe MezuroRangesController, :type => :controller do | ||
| 124 | subject.expects(:find_resource).with(MezuroRange, mezuro_range.id).returns(mezuro_range) | 124 | subject.expects(:find_resource).with(MezuroRange, mezuro_range.id).returns(mezuro_range) |
| 125 | MetricConfiguration.expects(:find).with(metric_configuration.id).returns(metric_configuration) | 125 | MetricConfiguration.expects(:find).with(metric_configuration.id).returns(metric_configuration) |
| 126 | Reading.expects(:readings_of).with(metric_configuration.reading_group_id).returns([reading]) | 126 | Reading.expects(:readings_of).with(metric_configuration.reading_group_id).returns([reading]) |
| 127 | - get :edit, id: mezuro_range.id, mezuro_configuration_id: metric_configuration.configuration_id, metric_configuration_id: metric_configuration.id | 127 | + get :edit, id: mezuro_range.id, kalibro_configuration_id: metric_configuration.configuration_id, metric_configuration_id: metric_configuration.id |
| 128 | end | 128 | end |
| 129 | 129 | ||
| 130 | it { is_expected.to render_template(:edit) } | 130 | it { is_expected.to render_template(:edit) } |
| @@ -134,10 +134,10 @@ describe MezuroRangesController, :type => :controller do | @@ -134,10 +134,10 @@ describe MezuroRangesController, :type => :controller do | ||
| 134 | let!(:reading_group) { FactoryGirl.build(:reading_group, id: metric_configuration.reading_group_id) } | 134 | let!(:reading_group) { FactoryGirl.build(:reading_group, id: metric_configuration.reading_group_id) } |
| 135 | 135 | ||
| 136 | before do | 136 | before do |
| 137 | - get :edit, id: mezuro_range.id, mezuro_configuration_id: metric_configuration.configuration_id, metric_configuration_id: metric_configuration.id | 137 | + get :edit, id: mezuro_range.id, kalibro_configuration_id: metric_configuration.configuration_id, metric_configuration_id: metric_configuration.id |
| 138 | end | 138 | end |
| 139 | 139 | ||
| 140 | - it { is_expected.to redirect_to(mezuro_configurations_url(metric_configuration.configuration_id)) } | 140 | + it { is_expected.to redirect_to(kalibro_configurations_url(metric_configuration.configuration_id)) } |
| 141 | it { is_expected.to respond_with(:redirect) } | 141 | it { is_expected.to respond_with(:redirect) } |
| 142 | it { is_expected.to set_the_flash[:notice].to("You're not allowed to do this operation") } | 142 | it { is_expected.to set_the_flash[:notice].to("You're not allowed to do this operation") } |
| 143 | end | 143 | end |
| @@ -145,7 +145,7 @@ describe MezuroRangesController, :type => :controller do | @@ -145,7 +145,7 @@ describe MezuroRangesController, :type => :controller do | ||
| 145 | 145 | ||
| 146 | context 'with no user logged in' do | 146 | context 'with no user logged in' do |
| 147 | before :each do | 147 | before :each do |
| 148 | - get :edit, id: mezuro_range.id, mezuro_configuration_id: metric_configuration.configuration_id, metric_configuration_id: metric_configuration.id | 148 | + get :edit, id: mezuro_range.id, kalibro_configuration_id: metric_configuration.configuration_id, metric_configuration_id: metric_configuration.id |
| 149 | end | 149 | end |
| 150 | 150 | ||
| 151 | it { is_expected.to redirect_to new_user_session_path } | 151 | it { is_expected.to redirect_to new_user_session_path } |
| @@ -173,10 +173,10 @@ describe MezuroRangesController, :type => :controller do | @@ -173,10 +173,10 @@ describe MezuroRangesController, :type => :controller do | ||
| 173 | subject.expects(:find_resource).with(MezuroRange, mezuro_range.id).returns(mezuro_range) | 173 | subject.expects(:find_resource).with(MezuroRange, mezuro_range.id).returns(mezuro_range) |
| 174 | MezuroRange.any_instance.expects(:update).with(mezuro_range_params).returns(true) | 174 | MezuroRange.any_instance.expects(:update).with(mezuro_range_params).returns(true) |
| 175 | 175 | ||
| 176 | - post :update, mezuro_configuration_id: metric_configuration.configuration_id, id: mezuro_range.id, metric_configuration_id: metric_configuration.id, mezuro_range: mezuro_range_params | 176 | + post :update, kalibro_configuration_id: metric_configuration.configuration_id, id: mezuro_range.id, metric_configuration_id: metric_configuration.id, mezuro_range: mezuro_range_params |
| 177 | end | 177 | end |
| 178 | 178 | ||
| 179 | - it { is_expected.to redirect_to(mezuro_configuration_metric_configuration_path(metric_configuration.configuration_id, metric_configuration.id)) } | 179 | + it { is_expected.to redirect_to(kalibro_configuration_metric_configuration_path(metric_configuration.configuration_id, metric_configuration.id)) } |
| 180 | it { is_expected.to respond_with(:redirect) } | 180 | it { is_expected.to respond_with(:redirect) } |
| 181 | end | 181 | end |
| 182 | 182 | ||
| @@ -187,7 +187,7 @@ describe MezuroRangesController, :type => :controller do | @@ -187,7 +187,7 @@ describe MezuroRangesController, :type => :controller do | ||
| 187 | MetricConfiguration.expects(:find).with(metric_configuration.id).returns(metric_configuration) | 187 | MetricConfiguration.expects(:find).with(metric_configuration.id).returns(metric_configuration) |
| 188 | Reading.expects(:readings_of).with(metric_configuration.reading_group_id).returns([reading]) | 188 | Reading.expects(:readings_of).with(metric_configuration.reading_group_id).returns([reading]) |
| 189 | 189 | ||
| 190 | - post :update, mezuro_configuration_id: metric_configuration.configuration_id, id: mezuro_range.id, metric_configuration_id: metric_configuration.id, mezuro_range: mezuro_range_params | 190 | + post :update, kalibro_configuration_id: metric_configuration.configuration_id, id: mezuro_range.id, metric_configuration_id: metric_configuration.id, mezuro_range: mezuro_range_params |
| 191 | end | 191 | end |
| 192 | 192 | ||
| 193 | it { is_expected.to render_template(:edit) } | 193 | it { is_expected.to render_template(:edit) } |
| @@ -196,10 +196,10 @@ describe MezuroRangesController, :type => :controller do | @@ -196,10 +196,10 @@ describe MezuroRangesController, :type => :controller do | ||
| 196 | 196 | ||
| 197 | context 'when the user does not own the mezuro range' do | 197 | context 'when the user does not own the mezuro range' do |
| 198 | before :each do | 198 | before :each do |
| 199 | - post :update, mezuro_configuration_id: metric_configuration.configuration_id, id: mezuro_range.id, metric_configuration_id: metric_configuration.id, mezuro_range: mezuro_range_params | 199 | + post :update, kalibro_configuration_id: metric_configuration.configuration_id, id: mezuro_range.id, metric_configuration_id: metric_configuration.id, mezuro_range: mezuro_range_params |
| 200 | end | 200 | end |
| 201 | 201 | ||
| 202 | - it { is_expected.to redirect_to mezuro_configurations_path(metric_configuration.configuration_id) } | 202 | + it { is_expected.to redirect_to kalibro_configurations_path(metric_configuration.configuration_id) } |
| 203 | end | 203 | end |
| 204 | end | 204 | end |
| 205 | end | 205 | end |
spec/controllers/repositories_controller_spec.rb
| @@ -93,7 +93,7 @@ describe RepositoriesController, :type => :controller do | @@ -93,7 +93,7 @@ describe RepositoriesController, :type => :controller do | ||
| 93 | before :each do | 93 | before :each do |
| 94 | processing = FactoryGirl.build(:processing) | 94 | processing = FactoryGirl.build(:processing) |
| 95 | 95 | ||
| 96 | - MezuroConfiguration.expects(:find).with(repository.id).returns(FactoryGirl.build(:mezuro_configuration)) | 96 | + KalibroConfiguration.expects(:find).with(repository.id).returns(FactoryGirl.build(:kalibro_configuration)) |
| 97 | subject.expects(:find_resource).with(Repository, repository.id).returns(repository) | 97 | subject.expects(:find_resource).with(Repository, repository.id).returns(repository) |
| 98 | 98 | ||
| 99 | get :show, id: repository.id.to_s, project_id: project.id.to_s | 99 | get :show, id: repository.id.to_s, project_id: project.id.to_s |
| @@ -107,7 +107,7 @@ describe RepositoriesController, :type => :controller do | @@ -107,7 +107,7 @@ describe RepositoriesController, :type => :controller do | ||
| 107 | before :each do | 107 | before :each do |
| 108 | processing = FactoryGirl.build(:processing) | 108 | processing = FactoryGirl.build(:processing) |
| 109 | 109 | ||
| 110 | - MezuroConfiguration.expects(:find).with(repository.id).returns(FactoryGirl.build(:mezuro_configuration)) | 110 | + KalibroConfiguration.expects(:find).with(repository.id).returns(FactoryGirl.build(:kalibro_configuration)) |
| 111 | subject.expects(:find_resource).with(Repository, repository.id).returns(repository) | 111 | subject.expects(:find_resource).with(Repository, repository.id).returns(repository) |
| 112 | 112 | ||
| 113 | get :show, id: repository.id.to_s, project_id: project.id.to_s | 113 | get :show, id: repository.id.to_s, project_id: project.id.to_s |
| @@ -331,7 +331,7 @@ describe RepositoriesController, :type => :controller do | @@ -331,7 +331,7 @@ describe RepositoriesController, :type => :controller do | ||
| 331 | subject.expects(:repository_owner?).returns true | 331 | subject.expects(:repository_owner?).returns true |
| 332 | repository.expects(:process) | 332 | repository.expects(:process) |
| 333 | Repository.expects(:find).at_least_once.with(repository.id).returns(repository) | 333 | Repository.expects(:find).at_least_once.with(repository.id).returns(repository) |
| 334 | - MezuroConfiguration.expects(:find).with(repository.id).returns(FactoryGirl.build(:mezuro_configuration)) | 334 | + KalibroConfiguration.expects(:find).with(repository.id).returns(FactoryGirl.build(:kalibro_configuration)) |
| 335 | get :process_repository, project_id: project.id.to_s, id: repository.id | 335 | get :process_repository, project_id: project.id.to_s, id: repository.id |
| 336 | end | 336 | end |
| 337 | it { is_expected.to redirect_to(project_repository_path(repository.project_id, repository.id)) } | 337 | it { is_expected.to redirect_to(project_repository_path(repository.project_id, repository.id)) } |
spec/factories/mezuro_configuration_ownerships.rb
| 1 | # Read about factories at https://github.com/thoughtbot/factory_girl | 1 | # Read about factories at https://github.com/thoughtbot/factory_girl |
| 2 | 2 | ||
| 3 | FactoryGirl.define do | 3 | FactoryGirl.define do |
| 4 | - factory :mezuro_configuration_ownership do | 4 | + factory :kalibro_configuration_ownership do |
| 5 | user_id 1 | 5 | user_id 1 |
| 6 | - mezuro_configuration_id 1 | 6 | + kalibro_configuration_id 1 |
| 7 | end | 7 | end |
| 8 | end | 8 | end |
spec/factories/mezuro_configurations.rb
| 1 | FactoryGirl.define do | 1 | FactoryGirl.define do |
| 2 | - factory :mezuro_configuration, class: MezuroConfiguration do | 2 | + factory :kalibro_configuration, class: KalibroConfiguration do |
| 3 | id 1 | 3 | id 1 |
| 4 | name "Java" | 4 | name "Java" |
| 5 | description "Code metrics for Java." | 5 | description "Code metrics for Java." |
| 6 | end | 6 | end |
| 7 | 7 | ||
| 8 | - factory :another_mezuro_configuration, class: MezuroConfiguration do | 8 | + factory :another_kalibro_configuration, class: KalibroConfiguration do |
| 9 | id 12 | 9 | id 12 |
| 10 | name "Perl" | 10 | name "Perl" |
| 11 | description "Code metrics for Perl." | 11 | description "Code metrics for Perl." |
spec/helpers/mezuro_configurations_helper_spec.rb
| 1 | require 'rails_helper' | 1 | require 'rails_helper' |
| 2 | 2 | ||
| 3 | -describe MezuroConfigurationsHelper, :type => :helper do | ||
| 4 | - describe 'mezuro_configuration_owner?' do | 3 | +describe KalibroConfigurationsHelper, :type => :helper do |
| 4 | + describe 'kalibro_configuration_owner?' do | ||
| 5 | before :each do | 5 | before :each do |
| 6 | - @subject = FactoryGirl.build(:mezuro_configuration) | 6 | + @subject = FactoryGirl.build(:kalibro_configuration) |
| 7 | end | 7 | end |
| 8 | 8 | ||
| 9 | context 'returns false if not logged in' do | 9 | context 'returns false if not logged in' do |
| 10 | before :each do | 10 | before :each do |
| 11 | helper.expects(:user_signed_in?).returns(false) | 11 | helper.expects(:user_signed_in?).returns(false) |
| 12 | end | 12 | end |
| 13 | - it { expect(helper.mezuro_configuration_owner?(@subject.id)).to be_falsey } | 13 | + it { expect(helper.kalibro_configuration_owner?(@subject.id)).to be_falsey } |
| 14 | end | 14 | end |
| 15 | 15 | ||
| 16 | context 'returns false if is not the owner' do | 16 | context 'returns false if is not the owner' do |
| @@ -19,40 +19,40 @@ describe MezuroConfigurationsHelper, :type => :helper do | @@ -19,40 +19,40 @@ describe MezuroConfigurationsHelper, :type => :helper do | ||
| 19 | helper.expects(:current_user).returns(FactoryGirl.build(:user)) | 19 | helper.expects(:current_user).returns(FactoryGirl.build(:user)) |
| 20 | 20 | ||
| 21 | @ownerships = [] | 21 | @ownerships = [] |
| 22 | - @ownerships.expects(:find_by_mezuro_configuration_id).with(@subject.id).returns(nil) | 22 | + @ownerships.expects(:find_by_kalibro_configuration_id).with(@subject.id).returns(nil) |
| 23 | 23 | ||
| 24 | - User.any_instance.expects(:mezuro_configuration_ownerships).returns(@ownerships) | 24 | + User.any_instance.expects(:kalibro_configuration_ownerships).returns(@ownerships) |
| 25 | end | 25 | end |
| 26 | 26 | ||
| 27 | - it { expect(helper.mezuro_configuration_owner?(@subject.id)).to be_falsey } | 27 | + it { expect(helper.kalibro_configuration_owner?(@subject.id)).to be_falsey } |
| 28 | end | 28 | end |
| 29 | 29 | ||
| 30 | - context 'returns true if user is the mezuro_configuration owner' do | 30 | + context 'returns true if user is the kalibro_configuration owner' do |
| 31 | before :each do | 31 | before :each do |
| 32 | helper.expects(:user_signed_in?).returns(true) | 32 | helper.expects(:user_signed_in?).returns(true) |
| 33 | helper.expects(:current_user).returns(FactoryGirl.build(:user)) | 33 | helper.expects(:current_user).returns(FactoryGirl.build(:user)) |
| 34 | 34 | ||
| 35 | - @ownership = FactoryGirl.build(:mezuro_configuration_ownership) | 35 | + @ownership = FactoryGirl.build(:kalibro_configuration_ownership) |
| 36 | @ownerships = [] | 36 | @ownerships = [] |
| 37 | - @ownerships.expects(:find_by_mezuro_configuration_id).with(@subject.id).returns(@ownership) | ||
| 38 | - User.any_instance.expects(:mezuro_configuration_ownerships).returns(@ownerships) | 37 | + @ownerships.expects(:find_by_kalibro_configuration_id).with(@subject.id).returns(@ownership) |
| 38 | + User.any_instance.expects(:kalibro_configuration_ownerships).returns(@ownerships) | ||
| 39 | end | 39 | end |
| 40 | 40 | ||
| 41 | - it { expect(helper.mezuro_configuration_owner?(@subject.id)).to be_truthy } | 41 | + it { expect(helper.kalibro_configuration_owner?(@subject.id)).to be_truthy } |
| 42 | end | 42 | end |
| 43 | end | 43 | end |
| 44 | 44 | ||
| 45 | describe 'link to edit form' do | 45 | describe 'link to edit form' do |
| 46 | context 'when the metric is native' do | 46 | context 'when the metric is native' do |
| 47 | let(:metric_configuration) { FactoryGirl.build(:metric_configuration) } | 47 | let(:metric_configuration) { FactoryGirl.build(:metric_configuration) } |
| 48 | - let(:response_link) {"<a class=\"btn btn-info\" href=\"/mezuro_configurations/#{metric_configuration.configuration_id}/metric_configurations/#{metric_configuration.id}/edit\">Edit</a>"} | 48 | + let(:response_link) {"<a class=\"btn btn-info\" href=\"/kalibro_configurations/#{metric_configuration.configuration_id}/metric_configurations/#{metric_configuration.id}/edit\">Edit</a>"} |
| 49 | 49 | ||
| 50 | it { expect(helper.link_to_edit_form(metric_configuration, metric_configuration.configuration_id)).to eq(response_link) } | 50 | it { expect(helper.link_to_edit_form(metric_configuration, metric_configuration.configuration_id)).to eq(response_link) } |
| 51 | end | 51 | end |
| 52 | 52 | ||
| 53 | context 'when the metric is compound' do | 53 | context 'when the metric is compound' do |
| 54 | let(:compound_metric_configuration) { FactoryGirl.build(:compound_metric_configuration) } | 54 | let(:compound_metric_configuration) { FactoryGirl.build(:compound_metric_configuration) } |
| 55 | - let(:response_link) {"<a class=\"btn btn-info\" href=\"/mezuro_configurations/#{compound_metric_configuration.configuration_id}/compound_metric_configurations/#{compound_metric_configuration.id}/edit\">Edit</a>"} | 55 | + let(:response_link) {"<a class=\"btn btn-info\" href=\"/kalibro_configurations/#{compound_metric_configuration.configuration_id}/compound_metric_configurations/#{compound_metric_configuration.id}/edit\">Edit</a>"} |
| 56 | 56 | ||
| 57 | it { expect(helper.link_to_edit_form(compound_metric_configuration, compound_metric_configuration.configuration_id)).to eq(response_link) } | 57 | it { expect(helper.link_to_edit_form(compound_metric_configuration, compound_metric_configuration.configuration_id)).to eq(response_link) } |
| 58 | end | 58 | end |
| @@ -61,14 +61,14 @@ describe MezuroConfigurationsHelper, :type => :helper do | @@ -61,14 +61,14 @@ describe MezuroConfigurationsHelper, :type => :helper do | ||
| 61 | describe 'link to show page' do | 61 | describe 'link to show page' do |
| 62 | context 'when the metric is native' do | 62 | context 'when the metric is native' do |
| 63 | let(:metric_configuration) { FactoryGirl.build(:metric_configuration) } | 63 | let(:metric_configuration) { FactoryGirl.build(:metric_configuration) } |
| 64 | - let(:response_link) {"<a class=\"btn btn-info\" href=\"/mezuro_configurations/#{metric_configuration.configuration_id}/metric_configurations/#{metric_configuration.id}\">Show</a>"} | 64 | + let(:response_link) {"<a class=\"btn btn-info\" href=\"/kalibro_configurations/#{metric_configuration.configuration_id}/metric_configurations/#{metric_configuration.id}\">Show</a>"} |
| 65 | 65 | ||
| 66 | it { expect(helper.link_to_show_page(metric_configuration, metric_configuration.configuration_id)).to eq(response_link) } | 66 | it { expect(helper.link_to_show_page(metric_configuration, metric_configuration.configuration_id)).to eq(response_link) } |
| 67 | end | 67 | end |
| 68 | 68 | ||
| 69 | context 'when the metric is compound' do | 69 | context 'when the metric is compound' do |
| 70 | let(:compound_metric_configuration) { FactoryGirl.build(:compound_metric_configuration) } | 70 | let(:compound_metric_configuration) { FactoryGirl.build(:compound_metric_configuration) } |
| 71 | - let(:response_link) {"<a class=\"btn btn-info\" href=\"/mezuro_configurations/#{compound_metric_configuration.configuration_id}/compound_metric_configurations/#{compound_metric_configuration.id}\">Show</a>"} | 71 | + let(:response_link) {"<a class=\"btn btn-info\" href=\"/kalibro_configurations/#{compound_metric_configuration.configuration_id}/compound_metric_configurations/#{compound_metric_configuration.id}\">Show</a>"} |
| 72 | 72 | ||
| 73 | it { expect(helper.link_to_show_page(compound_metric_configuration, compound_metric_configuration.configuration_id)).to eq(response_link) } | 73 | it { expect(helper.link_to_show_page(compound_metric_configuration, compound_metric_configuration.configuration_id)).to eq(response_link) } |
| 74 | end | 74 | end |
spec/models/mezuro_configuration_ownership_spec.rb
| 1 | require 'rails_helper' | 1 | require 'rails_helper' |
| 2 | 2 | ||
| 3 | -describe MezuroConfigurationOwnership, :type => :model do | 3 | +describe KalibroConfigurationOwnership, :type => :model do |
| 4 | describe 'associations' do | 4 | describe 'associations' do |
| 5 | it { is_expected.to belong_to(:user) } | 5 | it { is_expected.to belong_to(:user) } |
| 6 | end | 6 | end |
spec/models/user_spec.rb
| @@ -12,7 +12,7 @@ describe User, :type => :model do | @@ -12,7 +12,7 @@ describe User, :type => :model do | ||
| 12 | describe 'associations' do | 12 | describe 'associations' do |
| 13 | it { is_expected.to have_many(:project_ownerships) } | 13 | it { is_expected.to have_many(:project_ownerships) } |
| 14 | it { is_expected.to have_many(:reading_group_ownerships) } | 14 | it { is_expected.to have_many(:reading_group_ownerships) } |
| 15 | - it { is_expected.to have_many(:mezuro_configuration_ownerships) } | 15 | + it { is_expected.to have_many(:kalibro_configuration_ownerships) } |
| 16 | end | 16 | end |
| 17 | 17 | ||
| 18 | describe 'methods' do | 18 | describe 'methods' do |
spec/routing/compound_metric_configurations_routing_spec.rb
| @@ -2,19 +2,19 @@ require "rails_helper" | @@ -2,19 +2,19 @@ require "rails_helper" | ||
| 2 | 2 | ||
| 3 | describe CompoundMetricConfigurationsController, :type => :routing do | 3 | describe CompoundMetricConfigurationsController, :type => :routing do |
| 4 | describe "routing" do | 4 | describe "routing" do |
| 5 | - it { is_expected.to route(:get, '/mezuro_configurations/1/compound_metric_configurations/new'). | ||
| 6 | - to(controller: :compound_metric_configurations, action: :new, mezuro_configuration_id: "1") } | ||
| 7 | - it { is_expected.to route(:get, '/mezuro_configurations/1/compound_metric_configurations'). | ||
| 8 | - to(controller: :compound_metric_configurations, action: :index, mezuro_configuration_id: "1") } | ||
| 9 | - it { is_expected.to route(:post, '/mezuro_configurations/1/compound_metric_configurations'). | ||
| 10 | - to(controller: :compound_metric_configurations, action: :create, mezuro_configuration_id: "1") } | ||
| 11 | - it { is_expected.to route(:get, '/mezuro_configurations/1/compound_metric_configurations/1'). | ||
| 12 | - to(controller: :compound_metric_configurations, action: :show, mezuro_configuration_id: "1", id: "1") } | ||
| 13 | - it { is_expected.to route(:get, '/mezuro_configurations/1/compound_metric_configurations/1/edit'). | ||
| 14 | - to(controller: :compound_metric_configurations, action: :edit, mezuro_configuration_id: "1", id: "1") } | ||
| 15 | - it { is_expected.to route(:put, '/mezuro_configurations/1/compound_metric_configurations/1'). | ||
| 16 | - to(controller: :compound_metric_configurations, action: :update, mezuro_configuration_id: "1", id: "1") } | ||
| 17 | - it { is_expected.not_to route(:delete, '/mezuro_configurations/1/compound_metric_configurations/1'). | ||
| 18 | - to(controller: :compound_metric_configurations, action: :destroy, mezuro_configuration_id: "1", id: "1") } | 5 | + it { is_expected.to route(:get, '/kalibro_configurations/1/compound_metric_configurations/new'). |
| 6 | + to(controller: :compound_metric_configurations, action: :new, kalibro_configuration_id: "1") } | ||
| 7 | + it { is_expected.to route(:get, '/kalibro_configurations/1/compound_metric_configurations'). | ||
| 8 | + to(controller: :compound_metric_configurations, action: :index, kalibro_configuration_id: "1") } | ||
| 9 | + it { is_expected.to route(:post, '/kalibro_configurations/1/compound_metric_configurations'). | ||
| 10 | + to(controller: :compound_metric_configurations, action: :create, kalibro_configuration_id: "1") } | ||
| 11 | + it { is_expected.to route(:get, '/kalibro_configurations/1/compound_metric_configurations/1'). | ||
| 12 | + to(controller: :compound_metric_configurations, action: :show, kalibro_configuration_id: "1", id: "1") } | ||
| 13 | + it { is_expected.to route(:get, '/kalibro_configurations/1/compound_metric_configurations/1/edit'). | ||
| 14 | + to(controller: :compound_metric_configurations, action: :edit, kalibro_configuration_id: "1", id: "1") } | ||
| 15 | + it { is_expected.to route(:put, '/kalibro_configurations/1/compound_metric_configurations/1'). | ||
| 16 | + to(controller: :compound_metric_configurations, action: :update, kalibro_configuration_id: "1", id: "1") } | ||
| 17 | + it { is_expected.not_to route(:delete, '/kalibro_configurations/1/compound_metric_configurations/1'). | ||
| 18 | + to(controller: :compound_metric_configurations, action: :destroy, kalibro_configuration_id: "1", id: "1") } | ||
| 19 | end | 19 | end |
| 20 | end | 20 | end |
spec/routing/metric_configurations_routing_spec.rb
| @@ -2,21 +2,21 @@ require "rails_helper" | @@ -2,21 +2,21 @@ require "rails_helper" | ||
| 2 | 2 | ||
| 3 | describe MetricConfigurationsController, :type => :routing do | 3 | describe MetricConfigurationsController, :type => :routing do |
| 4 | describe "routing" do | 4 | describe "routing" do |
| 5 | - it { is_expected.to route(:post, '/mezuro_configurations/1/metric_configurations/new'). | ||
| 6 | - to(controller: :metric_configurations, action: :new, mezuro_configuration_id: "1") } | ||
| 7 | - it { is_expected.to route(:get, '/mezuro_configurations/1/metric_configurations'). | ||
| 8 | - to(controller: :metric_configurations, action: :index, mezuro_configuration_id: "1") } | ||
| 9 | - it { is_expected.to route(:post, '/mezuro_configurations/1/metric_configurations'). | ||
| 10 | - to(controller: :metric_configurations, action: :create, mezuro_configuration_id: "1") } | ||
| 11 | - it { is_expected.to route(:get, '/mezuro_configurations/1/metric_configurations/1'). | ||
| 12 | - to(controller: :metric_configurations, action: :show, mezuro_configuration_id: "1", id: "1") } | ||
| 13 | - it { is_expected.to route(:get, '/mezuro_configurations/1/metric_configurations/1/edit'). | ||
| 14 | - to(controller: :metric_configurations, action: :edit, mezuro_configuration_id: "1", id: "1") } | ||
| 15 | - it { is_expected.to route(:put, '/mezuro_configurations/1/metric_configurations/1'). | ||
| 16 | - to(controller: :metric_configurations, action: :update, mezuro_configuration_id: "1", id: "1") } | ||
| 17 | - it { is_expected.to route(:delete, '/mezuro_configurations/1/metric_configurations/1'). | ||
| 18 | - to(controller: :metric_configurations, action: :destroy, mezuro_configuration_id: "1", id: "1") } | ||
| 19 | - it { is_expected.to route(:get, '/mezuro_configurations/1/metric_configurations/choose_metric'). | ||
| 20 | - to(controller: :metric_configurations, action: :choose_metric, mezuro_configuration_id: "1") } | 5 | + it { is_expected.to route(:post, '/kalibro_configurations/1/metric_configurations/new'). |
| 6 | + to(controller: :metric_configurations, action: :new, kalibro_configuration_id: "1") } | ||
| 7 | + it { is_expected.to route(:get, '/kalibro_configurations/1/metric_configurations'). | ||
| 8 | + to(controller: :metric_configurations, action: :index, kalibro_configuration_id: "1") } | ||
| 9 | + it { is_expected.to route(:post, '/kalibro_configurations/1/metric_configurations'). | ||
| 10 | + to(controller: :metric_configurations, action: :create, kalibro_configuration_id: "1") } | ||
| 11 | + it { is_expected.to route(:get, '/kalibro_configurations/1/metric_configurations/1'). | ||
| 12 | + to(controller: :metric_configurations, action: :show, kalibro_configuration_id: "1", id: "1") } | ||
| 13 | + it { is_expected.to route(:get, '/kalibro_configurations/1/metric_configurations/1/edit'). | ||
| 14 | + to(controller: :metric_configurations, action: :edit, kalibro_configuration_id: "1", id: "1") } | ||
| 15 | + it { is_expected.to route(:put, '/kalibro_configurations/1/metric_configurations/1'). | ||
| 16 | + to(controller: :metric_configurations, action: :update, kalibro_configuration_id: "1", id: "1") } | ||
| 17 | + it { is_expected.to route(:delete, '/kalibro_configurations/1/metric_configurations/1'). | ||
| 18 | + to(controller: :metric_configurations, action: :destroy, kalibro_configuration_id: "1", id: "1") } | ||
| 19 | + it { is_expected.to route(:get, '/kalibro_configurations/1/metric_configurations/choose_metric'). | ||
| 20 | + to(controller: :metric_configurations, action: :choose_metric, kalibro_configuration_id: "1") } | ||
| 21 | end | 21 | end |
| 22 | end | 22 | end |
spec/routing/mezuro_configuration_routing_spec.rb
| 1 | require "rails_helper" | 1 | require "rails_helper" |
| 2 | 2 | ||
| 3 | -describe MezuroConfigurationsController, :type => :routing do | 3 | +describe KalibroConfigurationsController, :type => :routing do |
| 4 | describe "routing" do | 4 | describe "routing" do |
| 5 | - it { is_expected.to route(:get, '/mezuro_configurations/new'). | ||
| 6 | - to(controller: :mezuro_configurations, action: :new) } | ||
| 7 | - it { is_expected.to route(:get, '/mezuro_configurations'). | ||
| 8 | - to(controller: :mezuro_configurations, action: :index) } | ||
| 9 | - it { is_expected.to route(:post, '/mezuro_configurations'). | ||
| 10 | - to(controller: :mezuro_configurations, action: :create) } | ||
| 11 | - it { is_expected.to route(:get, '/mezuro_configurations/1'). | ||
| 12 | - to(controller: :mezuro_configurations, action: :show, id: "1") } | ||
| 13 | - it { is_expected.to route(:get, '/mezuro_configurations/1/edit'). | ||
| 14 | - to(controller: :mezuro_configurations, action: :edit, id: "1") } | ||
| 15 | - it { is_expected.to route(:put, '/mezuro_configurations/1'). | ||
| 16 | - to(controller: :mezuro_configurations, action: :update, id: "1") } | ||
| 17 | - it { is_expected.to route(:delete, '/mezuro_configurations/1'). | ||
| 18 | - to(controller: :mezuro_configurations, action: :destroy, id: "1") } | 5 | + it { is_expected.to route(:get, '/kalibro_configurations/new'). |
| 6 | + to(controller: :kalibro_configurations, action: :new) } | ||
| 7 | + it { is_expected.to route(:get, '/kalibro_configurations'). | ||
| 8 | + to(controller: :kalibro_configurations, action: :index) } | ||
| 9 | + it { is_expected.to route(:post, '/kalibro_configurations'). | ||
| 10 | + to(controller: :kalibro_configurations, action: :create) } | ||
| 11 | + it { is_expected.to route(:get, '/kalibro_configurations/1'). | ||
| 12 | + to(controller: :kalibro_configurations, action: :show, id: "1") } | ||
| 13 | + it { is_expected.to route(:get, '/kalibro_configurations/1/edit'). | ||
| 14 | + to(controller: :kalibro_configurations, action: :edit, id: "1") } | ||
| 15 | + it { is_expected.to route(:put, '/kalibro_configurations/1'). | ||
| 16 | + to(controller: :kalibro_configurations, action: :update, id: "1") } | ||
| 17 | + it { is_expected.to route(:delete, '/kalibro_configurations/1'). | ||
| 18 | + to(controller: :kalibro_configurations, action: :destroy, id: "1") } | ||
| 19 | end | 19 | end |
| 20 | end | 20 | end |
spec/routing/mezuro_ranges_routing_spec.rb
| @@ -2,19 +2,19 @@ require "rails_helper" | @@ -2,19 +2,19 @@ require "rails_helper" | ||
| 2 | 2 | ||
| 3 | describe MezuroRangesController, :type => :routing do | 3 | describe MezuroRangesController, :type => :routing do |
| 4 | describe "routing" do | 4 | describe "routing" do |
| 5 | - it { is_expected.to route(:get, '/mezuro_configurations/1/metric_configurations/1/mezuro_ranges'). | ||
| 6 | - to(controller: :mezuro_ranges, action: :index, mezuro_configuration_id: "1", metric_configuration_id: "1") } | ||
| 7 | - it { is_expected.to route(:post, '/mezuro_configurations/1/metric_configurations/1/mezuro_ranges'). | ||
| 8 | - to(controller: :mezuro_ranges, action: :create, mezuro_configuration_id: "1", metric_configuration_id: "1") } | ||
| 9 | - it { is_expected.to route(:get, '/mezuro_configurations/1/metric_configurations/1/mezuro_ranges/1/edit'). | ||
| 10 | - to(controller: :mezuro_ranges, action: :edit, mezuro_configuration_id: "1", metric_configuration_id: "1", id: "1") } | ||
| 11 | - it { is_expected.to route(:get, '/mezuro_configurations/1/metric_configurations/1/mezuro_ranges/1'). | ||
| 12 | - to(controller: :mezuro_ranges, action: :show, mezuro_configuration_id: "1", metric_configuration_id: "1", id: "1") } | ||
| 13 | - it { is_expected.to route(:delete, '/mezuro_configurations/1/metric_configurations/1/mezuro_ranges/1'). | ||
| 14 | - to(controller: :mezuro_ranges, action: :destroy, mezuro_configuration_id: "1", metric_configuration_id: "1", id: "1") } | ||
| 15 | - it { is_expected.to route(:get, '/mezuro_configurations/1/metric_configurations/1/mezuro_ranges/new'). | ||
| 16 | - to(controller: :mezuro_ranges, action: :new, mezuro_configuration_id: "1", metric_configuration_id: "1") } | ||
| 17 | - it { is_expected.to route(:put, '/mezuro_configurations/1/metric_configurations/1/mezuro_ranges/1'). | ||
| 18 | - to(controller: :mezuro_ranges, action: :update, mezuro_configuration_id: "1", metric_configuration_id: "1", id: "1") } | 5 | + it { is_expected.to route(:get, '/kalibro_configurations/1/metric_configurations/1/mezuro_ranges'). |
| 6 | + to(controller: :mezuro_ranges, action: :index, kalibro_configuration_id: "1", metric_configuration_id: "1") } | ||
| 7 | + it { is_expected.to route(:post, '/kalibro_configurations/1/metric_configurations/1/mezuro_ranges'). | ||
| 8 | + to(controller: :mezuro_ranges, action: :create, kalibro_configuration_id: "1", metric_configuration_id: "1") } | ||
| 9 | + it { is_expected.to route(:get, '/kalibro_configurations/1/metric_configurations/1/mezuro_ranges/1/edit'). | ||
| 10 | + to(controller: :mezuro_ranges, action: :edit, kalibro_configuration_id: "1", metric_configuration_id: "1", id: "1") } | ||
| 11 | + it { is_expected.to route(:get, '/kalibro_configurations/1/metric_configurations/1/mezuro_ranges/1'). | ||
| 12 | + to(controller: :mezuro_ranges, action: :show, kalibro_configuration_id: "1", metric_configuration_id: "1", id: "1") } | ||
| 13 | + it { is_expected.to route(:delete, '/kalibro_configurations/1/metric_configurations/1/mezuro_ranges/1'). | ||
| 14 | + to(controller: :mezuro_ranges, action: :destroy, kalibro_configuration_id: "1", metric_configuration_id: "1", id: "1") } | ||
| 15 | + it { is_expected.to route(:get, '/kalibro_configurations/1/metric_configurations/1/mezuro_ranges/new'). | ||
| 16 | + to(controller: :mezuro_ranges, action: :new, kalibro_configuration_id: "1", metric_configuration_id: "1") } | ||
| 17 | + it { is_expected.to route(:put, '/kalibro_configurations/1/metric_configurations/1/mezuro_ranges/1'). | ||
| 18 | + to(controller: :mezuro_ranges, action: :update, kalibro_configuration_id: "1", metric_configuration_id: "1", id: "1") } | ||
| 19 | end | 19 | end |
| 20 | end | 20 | end |