diff --git a/spec/controllers/base_metric_configurations_controller_spec.rb b/spec/controllers/base_metric_configurations_controller_spec.rb index 5217a66..5e54e8a 100644 --- a/spec/controllers/base_metric_configurations_controller_spec.rb +++ b/spec/controllers/base_metric_configurations_controller_spec.rb @@ -40,7 +40,7 @@ class InheritsFromBaseMetricConfigurationsController < BaseMetricConfigurationsC end -describe InheritsFromBaseMetricConfigurationsController do +describe InheritsFromBaseMetricConfigurationsController, :type => :controller do let(:mezuro_configuration) { FactoryGirl.build(:mezuro_configuration) } before do @@ -71,8 +71,8 @@ describe InheritsFromBaseMetricConfigurationsController do get :new, mezuro_configuration_id: mezuro_configuration.id end - it { metric_configuration.should_not be_nil } - it { should respond_with(:success) } + it { expect(metric_configuration).not_to be_nil } + it { is_expected.to respond_with(:success) } end context "when the current user doesn't owns the mezuro configuration" do @@ -80,8 +80,8 @@ describe InheritsFromBaseMetricConfigurationsController do get :new, mezuro_configuration_id: mezuro_configuration.id end - it { should redirect_to(mezuro_configurations_url(mezuro_configuration.id)) } - it { should respond_with(:redirect) } + it { is_expected.to redirect_to(mezuro_configurations_url(mezuro_configuration.id)) } + it { is_expected.to respond_with(:redirect) } end end @@ -104,8 +104,8 @@ describe InheritsFromBaseMetricConfigurationsController do post :create, mezuro_configuration_id: mezuro_configuration.id, metric_configuration: metric_configuration_params, base_tool_name: base_tool.name end - it { subject.metric_configuration.should_not be_nil } - it { should respond_with(:success) } + it { expect(subject.metric_configuration).not_to be_nil } + it { is_expected.to respond_with(:success) } end end end @@ -124,8 +124,8 @@ describe InheritsFromBaseMetricConfigurationsController do get :show, mezuro_configuration_id: metric_configuration.configuration_id.to_s, id: metric_configuration.id end - it { subject.mezuro_ranges.should_not be_nil} - it { subject.reading_group.should_not be_nil } + it { expect(subject.mezuro_ranges).not_to be_nil} + it { expect(subject.reading_group).not_to be_nil } end context 'with a invalid metric_configuration' do diff --git a/spec/controllers/compound_metric_configurations_controller_spec.rb b/spec/controllers/compound_metric_configurations_controller_spec.rb index c19e07c..d547777 100644 --- a/spec/controllers/compound_metric_configurations_controller_spec.rb +++ b/spec/controllers/compound_metric_configurations_controller_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe CompoundMetricConfigurationsController do +describe CompoundMetricConfigurationsController, :type => :controller do let(:mezuro_configuration) { FactoryGirl.build(:mezuro_configuration) } describe 'new' do @@ -16,8 +16,8 @@ describe CompoundMetricConfigurationsController do get :new, mezuro_configuration_id: mezuro_configuration.id end - it { should respond_with(:success) } - it { should render_template(:new) } + it { is_expected.to respond_with(:success) } + it { is_expected.to render_template(:new) } end context "when the current user doesn't owns the mezuro configuration" do @@ -25,8 +25,8 @@ describe CompoundMetricConfigurationsController do get :new, mezuro_configuration_id: mezuro_configuration.id end - it { should redirect_to(mezuro_configurations_url(mezuro_configuration.id)) } - it { should respond_with(:redirect) } + it { is_expected.to redirect_to(mezuro_configurations_url(mezuro_configuration.id)) } + it { is_expected.to respond_with(:redirect) } end end @@ -52,7 +52,7 @@ describe CompoundMetricConfigurationsController do post :create, mezuro_configuration_id: mezuro_configuration.id, metric_configuration: metric_configuration_params end - it { should respond_with(:redirect) } + it { is_expected.to respond_with(:redirect) } end context 'with invalid fields' do @@ -62,7 +62,7 @@ describe CompoundMetricConfigurationsController do post :create, mezuro_configuration_id: mezuro_configuration.id, metric_configuration: metric_configuration_params end - it { should render_template(:new) } + it { is_expected.to render_template(:new) } end end end @@ -80,7 +80,7 @@ describe CompoundMetricConfigurationsController do get :show, mezuro_configuration_id: compound_metric_configuration.configuration_id.to_s, id: compound_metric_configuration.id end - it { should render_template(:show) } + it { is_expected.to render_template(:show) } end describe 'edit' do @@ -99,7 +99,7 @@ describe CompoundMetricConfigurationsController do get :edit, id: compound_metric_configuration.id, mezuro_configuration_id: compound_metric_configuration.configuration_id.to_s end - it { should render_template(:edit) } + it { is_expected.to render_template(:edit) } end context 'when the user does not own the compound metric configuration' do @@ -107,9 +107,9 @@ describe CompoundMetricConfigurationsController do get :edit, id: compound_metric_configuration.id, mezuro_configuration_id: compound_metric_configuration.configuration_id.to_s end - it { should redirect_to(mezuro_configurations_path(mezuro_configuration.id)) } - it { should respond_with(:redirect) } - it { should set_the_flash[:notice].to("You're not allowed to do this operation") } + it { is_expected.to redirect_to(mezuro_configurations_path(mezuro_configuration.id)) } + it { is_expected.to respond_with(:redirect) } + it { is_expected.to set_the_flash[:notice].to("You're not allowed to do this operation") } end end @@ -118,7 +118,7 @@ describe CompoundMetricConfigurationsController do get :edit, id: compound_metric_configuration.id, mezuro_configuration_id: compound_metric_configuration.configuration_id.to_s end - it { should redirect_to new_user_session_path } + it { is_expected.to redirect_to new_user_session_path } end end end diff --git a/spec/controllers/concerns/ownership_authentication_spec.rb b/spec/controllers/concerns/ownership_authentication_spec.rb index be4f7a3..ec8c412 100644 --- a/spec/controllers/concerns/ownership_authentication_spec.rb +++ b/spec/controllers/concerns/ownership_authentication_spec.rb @@ -43,7 +43,7 @@ describe OwnershipAuthentication, type: :controller do end it 'should return true' do - readings_controller.reading_group_owner?.should be_true + expect(readings_controller.reading_group_owner?).to be_truthy end end @@ -120,7 +120,7 @@ describe OwnershipAuthentication, type: :controller do end it 'should return true' do - repositories_controller.project_owner?.should be_true + expect(repositories_controller.project_owner?).to be_truthy end end diff --git a/spec/controllers/home_controller_spec.rb b/spec/controllers/home_controller_spec.rb index 4f2c99f..f14c387 100644 --- a/spec/controllers/home_controller_spec.rb +++ b/spec/controllers/home_controller_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe HomeController do +describe HomeController, :type => :controller do context 'Method' do context '#index' do before :each do @@ -9,7 +9,7 @@ describe HomeController do get :index end - it {should render_template(:index)} + it {is_expected.to render_template(:index)} end end end diff --git a/spec/controllers/metric_configurations_controller_spec.rb b/spec/controllers/metric_configurations_controller_spec.rb index a3e633c..c5bd877 100644 --- a/spec/controllers/metric_configurations_controller_spec.rb +++ b/spec/controllers/metric_configurations_controller_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe MetricConfigurationsController do +describe MetricConfigurationsController, :type => :controller do let(:mezuro_configuration) { FactoryGirl.build(:mezuro_configuration) } describe 'choose_metric' do let(:base_tool) { FactoryGirl.build(:base_tool) } @@ -15,8 +15,8 @@ describe MetricConfigurationsController do get :choose_metric, mezuro_configuration_id: mezuro_configuration.id end - it { should respond_with(:success) } - it { should render_template(:choose_metric) } + it { is_expected.to respond_with(:success) } + it { is_expected.to render_template(:choose_metric) } end end @@ -33,8 +33,8 @@ describe MetricConfigurationsController do post :new, mezuro_configuration_id: mezuro_configuration.id, metric_name: "Lines of Code", base_tool_name: base_tool.name end - it { should respond_with(:success) } - it { should render_template(:new) } + it { is_expected.to respond_with(:success) } + it { is_expected.to render_template(:new) } end context "when the current user doesn't owns the mezuro configuration" do @@ -42,8 +42,8 @@ describe MetricConfigurationsController do post :new, mezuro_configuration_id: mezuro_configuration.id, metric_name: "Lines of Code", base_tool_name: base_tool.name end - it { should redirect_to(mezuro_configurations_url(mezuro_configuration.id)) } - it { should respond_with(:redirect) } + it { is_expected.to redirect_to(mezuro_configurations_url(mezuro_configuration.id)) } + it { is_expected.to respond_with(:redirect) } end end @@ -69,7 +69,7 @@ describe MetricConfigurationsController do post :create, mezuro_configuration_id: mezuro_configuration.id, metric_configuration: metric_configuration_params, base_tool_name: base_tool.name end - it { should respond_with(:redirect) } + it { is_expected.to respond_with(:redirect) } end context 'with invalid fields' do @@ -80,7 +80,7 @@ describe MetricConfigurationsController do post :create, mezuro_configuration_id: mezuro_configuration.id, metric_configuration: metric_configuration_params, base_tool_name: base_tool.name end - it { should render_template(:new) } + it { is_expected.to render_template(:new) } end end end @@ -98,7 +98,7 @@ describe MetricConfigurationsController do get :show, mezuro_configuration_id: metric_configuration.configuration_id.to_s, id: metric_configuration.id end - it { should render_template(:show) } + it { is_expected.to render_template(:show) } end describe 'edit' do @@ -116,7 +116,7 @@ describe MetricConfigurationsController do get :edit, id: metric_configuration.id, mezuro_configuration_id: metric_configuration.configuration_id.to_s end - it { should render_template(:edit) } + it { is_expected.to render_template(:edit) } end context 'when the user does not own the metric configuration' do @@ -124,9 +124,9 @@ describe MetricConfigurationsController do get :edit, id: metric_configuration.id, mezuro_configuration_id: metric_configuration.configuration_id.to_s end - it { should redirect_to(mezuro_configurations_path(metric_configuration.configuration_id)) } - it { should respond_with(:redirect) } - it { should set_the_flash[:notice].to("You're not allowed to do this operation") } + it { is_expected.to redirect_to(mezuro_configurations_path(metric_configuration.configuration_id)) } + it { is_expected.to respond_with(:redirect) } + it { is_expected.to set_the_flash[:notice].to("You're not allowed to do this operation") } end end @@ -135,7 +135,7 @@ describe MetricConfigurationsController do get :edit, id: metric_configuration.id, mezuro_configuration_id: metric_configuration.configuration_id.to_s end - it { should redirect_to new_user_session_path } + it { is_expected.to redirect_to new_user_session_path } end end @@ -161,8 +161,8 @@ describe MetricConfigurationsController do post :update, mezuro_configuration_id: metric_configuration.configuration_id, id: metric_configuration.id, metric_configuration: metric_configuration_params end - it { should redirect_to(mezuro_configuration_path(metric_configuration.configuration_id)) } - it { should respond_with(:redirect) } + it { is_expected.to redirect_to(mezuro_configuration_path(metric_configuration.configuration_id)) } + it { is_expected.to respond_with(:redirect) } end context 'with an invalid field' do @@ -173,7 +173,7 @@ describe MetricConfigurationsController do post :update, mezuro_configuration_id: metric_configuration.configuration_id, id: metric_configuration.id, metric_configuration: metric_configuration_params end - it { should render_template(:edit) } + it { is_expected.to render_template(:edit) } end end @@ -182,7 +182,7 @@ describe MetricConfigurationsController do post :update, mezuro_configuration_id: metric_configuration.configuration_id, id: metric_configuration.id, metric_configuration: metric_configuration_params end - it { should redirect_to mezuro_configurations_path(metric_configuration.configuration_id) } + it { is_expected.to redirect_to mezuro_configurations_path(metric_configuration.configuration_id) } end end end @@ -205,8 +205,8 @@ describe MetricConfigurationsController do delete :destroy, id: metric_configuration.id, mezuro_configuration_id: metric_configuration.configuration_id.to_s end - it { should redirect_to(mezuro_configuration_path(metric_configuration.configuration_id)) } - it { should respond_with(:redirect) } + it { is_expected.to redirect_to(mezuro_configuration_path(metric_configuration.configuration_id)) } + it { is_expected.to respond_with(:redirect) } end context "when the user doesn't own the configuration" do @@ -214,8 +214,8 @@ describe MetricConfigurationsController do delete :destroy, id: metric_configuration.id, mezuro_configuration_id: metric_configuration.configuration_id.to_s end - it { should redirect_to(mezuro_configurations_path(metric_configuration.configuration_id)) } - it { should respond_with(:redirect) } + it { is_expected.to redirect_to(mezuro_configurations_path(metric_configuration.configuration_id)) } + it { is_expected.to respond_with(:redirect) } end end @@ -224,7 +224,7 @@ describe MetricConfigurationsController do delete :destroy, id: metric_configuration.id, mezuro_configuration_id: mezuro_configuration.id.to_s end - it { should redirect_to new_user_session_path } + it { is_expected.to redirect_to new_user_session_path } end end end diff --git a/spec/controllers/mezuro_configurations_controller_spec.rb b/spec/controllers/mezuro_configurations_controller_spec.rb index c1a92e6..54f1bb3 100644 --- a/spec/controllers/mezuro_configurations_controller_spec.rb +++ b/spec/controllers/mezuro_configurations_controller_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe MezuroConfigurationsController do +describe MezuroConfigurationsController, :type => :controller do describe 'new' do before :each do @@ -8,8 +8,8 @@ describe MezuroConfigurationsController do get :new end - it { should respond_with(:success) } - it { should render_template(:new) } + it { is_expected.to respond_with(:success) } + it { is_expected.to render_template(:new) } end describe 'create' do @@ -33,7 +33,7 @@ describe MezuroConfigurationsController do end it 'should redirect to the show view' do - response.should redirect_to mezuro_configuration_path(mezuro_configuration) + expect(response).to redirect_to mezuro_configuration_path(mezuro_configuration) end end @@ -42,7 +42,7 @@ describe MezuroConfigurationsController do post :create, :mezuro_configuration => subject_params end - it { should respond_with(:redirect) } + it { is_expected.to respond_with(:redirect) } end end @@ -57,7 +57,7 @@ describe MezuroConfigurationsController do post :create, :mezuro_configuration => @subject_params end - it { should render_template(:new) } + it { is_expected.to render_template(:new) } end end @@ -70,7 +70,7 @@ describe MezuroConfigurationsController do get :show, :id => subject.id end - it { should render_template(:show) } + it { is_expected.to render_template(:show) } end describe 'destroy' do @@ -101,10 +101,10 @@ describe MezuroConfigurationsController do end it 'should redirect to the mezuro_configurations page' do - response.should redirect_to mezuro_configurations_url + expect(response).to redirect_to mezuro_configurations_url end - it { should respond_with(:redirect) } + it { is_expected.to respond_with(:redirect) } end context "when the user doesn't own the mezuro_configuration" do @@ -115,7 +115,7 @@ describe MezuroConfigurationsController do delete :destroy, :id => @subject.id end - it { should redirect_to(mezuro_configurations_path(@subject.id)) } + it { is_expected.to redirect_to(mezuro_configurations_path(@subject.id)) } end end @@ -124,7 +124,7 @@ describe MezuroConfigurationsController do delete :destroy, :id => @subject.id end - it { should redirect_to new_user_session_path } + it { is_expected.to redirect_to new_user_session_path } end end @@ -135,7 +135,7 @@ describe MezuroConfigurationsController do get :index end - it { should render_template(:index) } + it { is_expected.to render_template(:index) } end describe 'edit' do @@ -162,10 +162,10 @@ describe MezuroConfigurationsController do get :edit, :id => @subject.id end - it { should render_template(:edit) } + it { is_expected.to render_template(:edit) } it 'should assign to @mezuro_configuration the @subject' do - assigns(:mezuro_configuration).should eq(@subject) + expect(assigns(:mezuro_configuration)).to eq(@subject) end end @@ -177,8 +177,8 @@ describe MezuroConfigurationsController do get :edit, :id => @subject.id end - it { should redirect_to(mezuro_configurations_path(@subject.id)) } - it { should set_the_flash[:notice].to("You're not allowed to do this operation") } + it { is_expected.to redirect_to(mezuro_configurations_path(@subject.id)) } + it { is_expected.to set_the_flash[:notice].to("You're not allowed to do this operation") } end end @@ -187,7 +187,7 @@ describe MezuroConfigurationsController do get :edit, :id => @subject.id end - it { should redirect_to new_user_session_path } + it { is_expected.to redirect_to new_user_session_path } end end @@ -225,7 +225,7 @@ describe MezuroConfigurationsController do end it 'should redirect to the show view' do - response.should redirect_to mezuro_configuration_path(@subject) + expect(response).to redirect_to mezuro_configuration_path(@subject) end end @@ -234,7 +234,7 @@ describe MezuroConfigurationsController do post :update, :id => @subject.id, :mezuro_configuration => @subject_params end - it { should respond_with(:redirect) } + it { is_expected.to respond_with(:redirect) } end end @@ -246,7 +246,7 @@ describe MezuroConfigurationsController do post :update, :id => @subject.id, :mezuro_configuration => @subject_params end - it { should render_template(:edit) } + it { is_expected.to render_template(:edit) } end end @@ -255,7 +255,7 @@ describe MezuroConfigurationsController do post :update, :id => @subject.id, :mezuro_configuration => @subject_params end - it { should redirect_to mezuro_configurations_path(@subject.id) } + it { is_expected.to redirect_to mezuro_configurations_path(@subject.id) } end end @@ -264,7 +264,7 @@ describe MezuroConfigurationsController do post :update, :id => @subject.id, :mezuro_configuration => @subject_params end - it { should redirect_to new_user_session_path } + it { is_expected.to redirect_to new_user_session_path } end end end diff --git a/spec/controllers/mezuro_ranges_controller_spec.rb b/spec/controllers/mezuro_ranges_controller_spec.rb index 197389d..3a4cd75 100644 --- a/spec/controllers/mezuro_ranges_controller_spec.rb +++ b/spec/controllers/mezuro_ranges_controller_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe MezuroRangesController do +describe MezuroRangesController, :type => :controller do let(:mezuro_range) { FactoryGirl.build(:mezuro_range, id: 1) } let(:metric_configuration) { FactoryGirl.build(:metric_configuration) } @@ -19,8 +19,8 @@ describe MezuroRangesController do get :new, mezuro_configuration_id: mezuro_configuration.id, metric_configuration_id: mezuro_range.metric_configuration_id end - it { should respond_with(:success) } - it { should render_template(:new) } + it { is_expected.to respond_with(:success) } + it { is_expected.to render_template(:new) } end context "when the current user doesn't owns the metric configuration" do @@ -28,8 +28,8 @@ describe MezuroRangesController do get :new, mezuro_configuration_id: mezuro_configuration.id, metric_configuration_id: mezuro_range.metric_configuration_id end - it { should redirect_to(mezuro_configurations_path(mezuro_configuration.id)) } - it { should respond_with(:redirect) } + it { is_expected.to redirect_to(mezuro_configurations_path(mezuro_configuration.id)) } + it { is_expected.to respond_with(:redirect) } end end @@ -53,7 +53,7 @@ describe MezuroRangesController do post :create, mezuro_configuration_id: mezuro_configuration.id, metric_configuration_id: metric_configuration.id, mezuro_range: mezuro_range_params end - it { should respond_with(:redirect) } + it { is_expected.to respond_with(:redirect) } end context 'with invalid fields' do @@ -65,7 +65,7 @@ describe MezuroRangesController do post :create, mezuro_configuration_id: mezuro_configuration.id, metric_configuration_id: metric_configuration.id, mezuro_range: mezuro_range_params end - it { should render_template(:new) } + it { is_expected.to render_template(:new) } end end end @@ -85,8 +85,8 @@ describe MezuroRangesController do 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 end - it { should redirect_to(mezuro_configuration_metric_configuration_path(metric_configuration.configuration_id, metric_configuration.id)) } - it { should respond_with(:redirect) } + it { is_expected.to redirect_to(mezuro_configuration_metric_configuration_path(metric_configuration.configuration_id, metric_configuration.id)) } + it { is_expected.to respond_with(:redirect) } end context "when the user doesn't own the metric configuration" do @@ -94,8 +94,8 @@ describe MezuroRangesController do 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 end - it { should redirect_to(mezuro_configurations_path(metric_configuration.configuration_id)) } - it { should respond_with(:redirect) } + it { is_expected.to redirect_to(mezuro_configurations_path(metric_configuration.configuration_id)) } + it { is_expected.to respond_with(:redirect) } end end @@ -104,7 +104,7 @@ describe MezuroRangesController do 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 end - it { should redirect_to new_user_session_path } + it { is_expected.to redirect_to new_user_session_path } end end @@ -127,7 +127,7 @@ describe MezuroRangesController do get :edit, id: mezuro_range.id, mezuro_configuration_id: metric_configuration.configuration_id, metric_configuration_id: metric_configuration.id end - it { should render_template(:edit) } + it { is_expected.to render_template(:edit) } end context 'when the user does not own the mezuro range' do @@ -137,9 +137,9 @@ describe MezuroRangesController do get :edit, id: mezuro_range.id, mezuro_configuration_id: metric_configuration.configuration_id, metric_configuration_id: metric_configuration.id end - it { should redirect_to(mezuro_configurations_url(metric_configuration.configuration_id)) } - it { should respond_with(:redirect) } - it { should set_the_flash[:notice].to("You're not allowed to do this operation") } + it { is_expected.to redirect_to(mezuro_configurations_url(metric_configuration.configuration_id)) } + it { is_expected.to respond_with(:redirect) } + it { is_expected.to set_the_flash[:notice].to("You're not allowed to do this operation") } end end @@ -148,7 +148,7 @@ describe MezuroRangesController do get :edit, id: mezuro_range.id, mezuro_configuration_id: metric_configuration.configuration_id, metric_configuration_id: metric_configuration.id end - it { should redirect_to new_user_session_path } + it { is_expected.to redirect_to new_user_session_path } end end @@ -176,8 +176,8 @@ describe MezuroRangesController do post :update, mezuro_configuration_id: metric_configuration.configuration_id, id: mezuro_range.id, metric_configuration_id: metric_configuration.id, mezuro_range: mezuro_range_params end - it { should redirect_to(mezuro_configuration_metric_configuration_path(metric_configuration.configuration_id, metric_configuration.id)) } - it { should respond_with(:redirect) } + it { is_expected.to redirect_to(mezuro_configuration_metric_configuration_path(metric_configuration.configuration_id, metric_configuration.id)) } + it { is_expected.to respond_with(:redirect) } end context 'with an invalid field' do @@ -190,7 +190,7 @@ describe MezuroRangesController do post :update, mezuro_configuration_id: metric_configuration.configuration_id, id: mezuro_range.id, metric_configuration_id: metric_configuration.id, mezuro_range: mezuro_range_params end - it { should render_template(:edit) } + it { is_expected.to render_template(:edit) } end end @@ -199,7 +199,7 @@ describe MezuroRangesController do post :update, mezuro_configuration_id: metric_configuration.configuration_id, id: mezuro_range.id, metric_configuration_id: metric_configuration.id, mezuro_range: mezuro_range_params end - it { should redirect_to mezuro_configurations_path(metric_configuration.configuration_id) } + it { is_expected.to redirect_to mezuro_configurations_path(metric_configuration.configuration_id) } end end end diff --git a/spec/controllers/modules_controller_spec.rb b/spec/controllers/modules_controller_spec.rb index 0432563..6ba9270 100644 --- a/spec/controllers/modules_controller_spec.rb +++ b/spec/controllers/modules_controller_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe ModulesController do +describe ModulesController, :type => :controller do describe "load_module_tree" do before :each do ModuleResult.expects(:find).with(42).returns(FactoryGirl.build(:module_result)) @@ -8,8 +8,8 @@ describe ModulesController do post :load_module_tree, id: 42, format: :js end - it { should respond_with(:success) } - it { should render_template(:load_module_tree) } + it { is_expected.to respond_with(:success) } + it { is_expected.to render_template(:load_module_tree) } end describe "metric_history" do @@ -26,7 +26,7 @@ describe ModulesController do xhr :get, :metric_history, {id: module_result.id, metric_name: metric_name, module_id: module_id} end - it { should respond_with(:success) } - it { should render_template(:metric_history) } + it { is_expected.to respond_with(:success) } + it { is_expected.to render_template(:metric_history) } end end \ No newline at end of file diff --git a/spec/controllers/projects_controller_spec.rb b/spec/controllers/projects_controller_spec.rb index aa6c097..ab97557 100644 --- a/spec/controllers/projects_controller_spec.rb +++ b/spec/controllers/projects_controller_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe ProjectsController do +describe ProjectsController, :type => :controller do describe 'new' do before :each do @@ -8,8 +8,8 @@ describe ProjectsController do get :new end - it { should respond_with(:success) } - it { should render_template(:new) } + it { is_expected.to respond_with(:success) } + it { is_expected.to render_template(:new) } end describe 'create' do @@ -33,7 +33,7 @@ describe ProjectsController do end it 'should redirect to the show view' do - response.should redirect_to project_path(project) + expect(response).to redirect_to project_path(project) end end @@ -42,7 +42,7 @@ describe ProjectsController do post :create, :project => subject_params end - it { should respond_with(:redirect) } + it { is_expected.to respond_with(:redirect) } end end @@ -57,7 +57,7 @@ describe ProjectsController do post :create, :project => @subject_params end - it { should render_template(:new) } + it { is_expected.to render_template(:new) } end end @@ -70,7 +70,7 @@ describe ProjectsController do get :show, :id => subject.id end - it { should render_template(:show) } + it { is_expected.to render_template(:show) } end describe 'destroy' do @@ -102,10 +102,10 @@ describe ProjectsController do end it 'should redirect to the projects page' do - response.should redirect_to projects_url + expect(response).to redirect_to projects_url end - it { should respond_with(:redirect) } + it { is_expected.to respond_with(:redirect) } end context "when the user doesn't own the project" do @@ -116,7 +116,7 @@ describe ProjectsController do delete :destroy, :id => @subject.id end - it { should redirect_to(projects_path) } + it { is_expected.to redirect_to(projects_path) } end end @@ -125,7 +125,7 @@ describe ProjectsController do delete :destroy, :id => @subject.id end - it { should redirect_to new_user_session_path } + it { is_expected.to redirect_to new_user_session_path } end end @@ -136,7 +136,7 @@ describe ProjectsController do get :index end - it { should render_template(:index) } + it { is_expected.to render_template(:index) } end describe 'edit' do @@ -163,10 +163,10 @@ describe ProjectsController do get :edit, :id => @subject.id end - it { should render_template(:edit) } + it { is_expected.to render_template(:edit) } it 'should assign to @project the @subject' do - assigns(:project).should eq(@subject) + expect(assigns(:project)).to eq(@subject) end end @@ -178,8 +178,8 @@ describe ProjectsController do get :edit, :id => @subject.id end - it { should redirect_to(projects_path) } - it { should set_the_flash[:notice].to("You're not allowed to do this operation") } + it { is_expected.to redirect_to(projects_path) } + it { is_expected.to set_the_flash[:notice].to("You're not allowed to do this operation") } end end @@ -188,7 +188,7 @@ describe ProjectsController do get :edit, :id => @subject.id end - it { should redirect_to new_user_session_path } + it { is_expected.to redirect_to new_user_session_path } end end @@ -226,7 +226,7 @@ describe ProjectsController do end it 'should redirect to the show view' do - response.should redirect_to project_path(@subject) + expect(response).to redirect_to project_path(@subject) end end @@ -235,7 +235,7 @@ describe ProjectsController do post :update, :id => @subject.id, :project => @subject_params end - it { should respond_with(:redirect) } + it { is_expected.to respond_with(:redirect) } end end @@ -247,7 +247,7 @@ describe ProjectsController do post :update, :id => @subject.id, :project => @subject_params end - it { should render_template(:edit) } + it { is_expected.to render_template(:edit) } end end @@ -256,7 +256,7 @@ describe ProjectsController do post :update, :id => @subject.id, :project => @subject_params end - it { should redirect_to projects_path } + it { is_expected.to redirect_to projects_path } end end @@ -265,7 +265,7 @@ describe ProjectsController do post :update, :id => @subject.id, :project => @subject_params end - it { should redirect_to new_user_session_path } + it { is_expected.to redirect_to new_user_session_path } end end end diff --git a/spec/controllers/reading_groups_controller_spec.rb b/spec/controllers/reading_groups_controller_spec.rb index 0a6d758..1f57fd3 100644 --- a/spec/controllers/reading_groups_controller_spec.rb +++ b/spec/controllers/reading_groups_controller_spec.rb @@ -1,14 +1,14 @@ require 'spec_helper' -describe ReadingGroupsController do +describe ReadingGroupsController, :type => :controller do describe 'new' do before :each do sign_in FactoryGirl.create(:user) get :new end - it { should respond_with(:success) } - it { should render_template(:new) } + it { is_expected.to respond_with(:success) } + it { is_expected.to render_template(:new) } end describe 'create' do @@ -32,7 +32,7 @@ describe ReadingGroupsController do end it 'should redirect to the show view' do - response.should redirect_to reading_group_path(reading_group) + expect(response).to redirect_to reading_group_path(reading_group) end end @@ -41,7 +41,7 @@ describe ReadingGroupsController do post :create, :reading_group => subject_params end - it { should respond_with(:redirect) } + it { is_expected.to respond_with(:redirect) } end end @@ -56,7 +56,7 @@ describe ReadingGroupsController do post :create, :reading_group => @subject_params end - it { should render_template(:new) } + it { is_expected.to render_template(:new) } end end @@ -68,7 +68,7 @@ describe ReadingGroupsController do get :show, :id => subject.id end - it { should render_template(:show) } + it { is_expected.to render_template(:show) } end describe 'destroy' do @@ -100,10 +100,10 @@ describe ReadingGroupsController do end it 'should redirect to the reading groups page' do - response.should redirect_to reading_groups_url + expect(response).to redirect_to reading_groups_url end - it { should respond_with(:redirect) } + it { is_expected.to respond_with(:redirect) } end context "when the user doesn't own the reading group" do @@ -114,7 +114,7 @@ describe ReadingGroupsController do delete :destroy, :id => @subject.id end - it { should redirect_to(reading_group_path) } + it { is_expected.to redirect_to(reading_group_path) } end end @@ -123,7 +123,7 @@ describe ReadingGroupsController do delete :destroy, :id => @subject.id end - it { should redirect_to new_user_session_path } + it { is_expected.to redirect_to new_user_session_path } end end @@ -134,7 +134,7 @@ describe ReadingGroupsController do get :index end - it { should render_template(:index) } + it { is_expected.to render_template(:index) } end describe 'edit' do @@ -161,10 +161,10 @@ describe ReadingGroupsController do get :edit, :id => @subject.id end - it { should render_template(:edit) } + it { is_expected.to render_template(:edit) } it 'should assign to @reading group the @subject' do - assigns(:reading_group).should eq(@subject) + expect(assigns(:reading_group)).to eq(@subject) end end @@ -176,8 +176,8 @@ describe ReadingGroupsController do get :edit, :id => @subject.id end - it { should redirect_to(reading_group_path) } - it { should set_the_flash[:notice].to("You're not allowed to do this operation") } + it { is_expected.to redirect_to(reading_group_path) } + it { is_expected.to set_the_flash[:notice].to("You're not allowed to do this operation") } end end @@ -186,7 +186,7 @@ describe ReadingGroupsController do get :edit, :id => @subject.id end - it { should redirect_to new_user_session_path } + it { is_expected.to redirect_to new_user_session_path } end end @@ -224,7 +224,7 @@ describe ReadingGroupsController do end it 'should redirect to the show view' do - response.should redirect_to reading_group_path(@subject) + expect(response).to redirect_to reading_group_path(@subject) end end @@ -233,7 +233,7 @@ describe ReadingGroupsController do post :update, :id => @subject.id, :reading_group => @subject_params end - it { should respond_with(:redirect) } + it { is_expected.to respond_with(:redirect) } end end @@ -245,7 +245,7 @@ describe ReadingGroupsController do post :update, :id => @subject.id, :reading_group => @subject_params end - it { should render_template(:edit) } + it { is_expected.to render_template(:edit) } end end @@ -254,7 +254,7 @@ describe ReadingGroupsController do post :update, :id => @subject.id, :reading_group => @subject_params end - it { should redirect_to reading_group_path } + it { is_expected.to redirect_to reading_group_path } end end @@ -263,7 +263,7 @@ describe ReadingGroupsController do post :update, :id => @subject.id, :reading_group => @subject_params end - it { should redirect_to new_user_session_path } + it { is_expected.to redirect_to new_user_session_path } end end end diff --git a/spec/controllers/readings_controller_spec.rb b/spec/controllers/readings_controller_spec.rb index 8aa8adc..e9d532c 100644 --- a/spec/controllers/readings_controller_spec.rb +++ b/spec/controllers/readings_controller_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe ReadingsController do +describe ReadingsController, :type => :controller do let(:reading_group) { FactoryGirl.build(:reading_group) } describe 'new' do @@ -14,8 +14,8 @@ describe ReadingsController do get :new, reading_group_id: reading_group.id end - it { should respond_with(:success) } - it { should render_template(:new) } + it { is_expected.to respond_with(:success) } + it { is_expected.to render_template(:new) } end context "when the current user doesn't owns the reading group" do @@ -23,8 +23,8 @@ describe ReadingsController do get :new, reading_group_id: reading_group.id end - it { should redirect_to(reading_group_url(reading_group.id)) } - it { should respond_with(:redirect) } + it { is_expected.to redirect_to(reading_group_url(reading_group.id)) } + it { is_expected.to respond_with(:redirect) } end end @@ -48,7 +48,7 @@ describe ReadingsController do post :create, reading_group_id: reading_group.id, reading: reading_params end - it { should respond_with(:redirect) } + it { is_expected.to respond_with(:redirect) } end context 'with invalid fields' do @@ -58,7 +58,7 @@ describe ReadingsController do post :create, reading_group_id: reading_group.id, reading: reading_params end - it { should render_template(:new) } + it { is_expected.to render_template(:new) } end end end @@ -78,7 +78,7 @@ describe ReadingsController do get :edit, id: reading.id, reading_group_id: reading_group.id.to_s end - it { should render_template(:edit) } + it { is_expected.to render_template(:edit) } end context 'when the user does not own the reading' do @@ -86,9 +86,9 @@ describe ReadingsController do get :edit, id: reading.id, reading_group_id: reading_group.id.to_s end - it { should redirect_to(reading_group_url(reading_group.id)) } - it { should respond_with(:redirect) } - it { should set_the_flash[:notice].to("You're not allowed to do this operation") } + it { is_expected.to redirect_to(reading_group_url(reading_group.id)) } + it { is_expected.to respond_with(:redirect) } + it { is_expected.to set_the_flash[:notice].to("You're not allowed to do this operation") } end end @@ -97,7 +97,7 @@ describe ReadingsController do get :edit, id: reading.id, reading_group_id: reading_group.id.to_s end - it { should redirect_to new_user_session_path } + it { is_expected.to redirect_to new_user_session_path } end end @@ -123,8 +123,8 @@ describe ReadingsController do post :update, reading_group_id: reading_group.id, id: reading.id, reading: reading_params end - it { should redirect_to(reading_group_path(reading_group.id)) } - it { should respond_with(:redirect) } + it { is_expected.to redirect_to(reading_group_path(reading_group.id)) } + it { is_expected.to respond_with(:redirect) } end context 'with an invalid field' do @@ -135,7 +135,7 @@ describe ReadingsController do post :update, reading_group_id: reading_group.id, id: reading.id, reading: reading_params end - it { should render_template(:edit) } + it { is_expected.to render_template(:edit) } end end @@ -144,7 +144,7 @@ describe ReadingsController do post :update, reading_group_id: reading_group.id, id: reading.id, reading: reading_params end - it { should redirect_to reading_group_path(reading_group.id) } + it { is_expected.to redirect_to reading_group_path(reading_group.id) } end end @@ -153,7 +153,7 @@ describe ReadingsController do post :update, reading_group_id: reading_group.id, id: reading.id, reading: reading_params end - it { should redirect_to new_user_session_path } + it { is_expected.to redirect_to new_user_session_path } end end @@ -174,8 +174,8 @@ describe ReadingsController do delete :destroy, id: reading.id, reading_group_id: reading.group_id.to_s end - it { should redirect_to(reading_group_path(reading.group_id)) } - it { should respond_with(:redirect) } + it { is_expected.to redirect_to(reading_group_path(reading.group_id)) } + it { is_expected.to respond_with(:redirect) } end context "when the user doesn't own the reading group" do @@ -183,8 +183,8 @@ describe ReadingsController do delete :destroy, id: reading.id, reading_group_id: reading.group_id.to_s end - it { should redirect_to(reading_group_path(reading.group_id)) } - it { should respond_with(:redirect) } + it { is_expected.to redirect_to(reading_group_path(reading.group_id)) } + it { is_expected.to respond_with(:redirect) } end end @@ -193,7 +193,7 @@ describe ReadingsController do delete :destroy, id: reading.id, reading_group_id: reading.group_id.to_s end - it { should redirect_to new_user_session_path } + it { is_expected.to redirect_to new_user_session_path } end end diff --git a/spec/controllers/repositories_controller_spec.rb b/spec/controllers/repositories_controller_spec.rb index ea1a23c..df50ff7 100644 --- a/spec/controllers/repositories_controller_spec.rb +++ b/spec/controllers/repositories_controller_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe RepositoriesController do +describe RepositoriesController, :type => :controller do let(:project) { FactoryGirl.build(:project) } describe 'new' do @@ -16,8 +16,8 @@ describe RepositoriesController do get :new, project_id: project.id.to_s end - it { should respond_with(:success) } - it { should render_template(:new) } + it { is_expected.to respond_with(:success) } + it { is_expected.to render_template(:new) } end context "when the current user doesn't owns the project" do @@ -25,8 +25,8 @@ describe RepositoriesController do get :new, project_id: project.id.to_s end - it { should redirect_to(projects_url) } - it { should respond_with(:redirect) } + it { is_expected.to redirect_to(projects_url) } + it { is_expected.to respond_with(:redirect) } end end @@ -50,8 +50,8 @@ describe RepositoriesController do post :create, project_id: project.id, repository: repository_params end - it { should redirect_to(project_repository_process_path(repository.project_id, repository.id)) } - it { should respond_with(:redirect) } + it { is_expected.to redirect_to(project_repository_process_path(repository.project_id, repository.id)) } + it { is_expected.to respond_with(:redirect) } end context 'with an invalid field' do @@ -62,7 +62,7 @@ describe RepositoriesController do post :create, project_id: project.id.to_s, repository: repository_params end - it { should render_template(:new) } + it { is_expected.to render_template(:new) } end end @@ -71,8 +71,8 @@ describe RepositoriesController do post :create, project_id: project.id, repository: repository_params end - it { should redirect_to(projects_url) } - it { should respond_with(:redirect) } + it { is_expected.to redirect_to(projects_url) } + it { is_expected.to respond_with(:redirect) } end end @@ -89,7 +89,7 @@ describe RepositoriesController do get :show, id: repository.id.to_s, project_id: project.id.to_s end - it { should render_template(:show) } + it { is_expected.to render_template(:show) } end context 'for an specific module_result' do @@ -103,7 +103,7 @@ describe RepositoriesController do get :show, id: repository.id.to_s, project_id: project.id.to_s end - it { should render_template(:show) } + it { is_expected.to render_template(:show) } end end @@ -124,8 +124,8 @@ describe RepositoriesController do delete :destroy, id: repository.id, project_id: project.id.to_s end - it { should redirect_to(project_path(repository.project_id)) } - it { should respond_with(:redirect) } + it { is_expected.to redirect_to(project_path(repository.project_id)) } + it { is_expected.to respond_with(:redirect) } end context "when the user doesn't own the project" do @@ -133,8 +133,8 @@ describe RepositoriesController do delete :destroy, id: repository.id, project_id: project.id.to_s end - it { should redirect_to(projects_url) } - it { should respond_with(:redirect) } + it { is_expected.to redirect_to(projects_url) } + it { is_expected.to respond_with(:redirect) } end end @@ -143,7 +143,7 @@ describe RepositoriesController do delete :destroy, id: repository.id, project_id: project.id.to_s end - it { should redirect_to new_user_session_path } + it { is_expected.to redirect_to new_user_session_path } end end @@ -163,7 +163,7 @@ describe RepositoriesController do get :edit, id: repository.id, project_id: project.id.to_s end - it { should render_template(:edit) } + it { is_expected.to render_template(:edit) } end context 'when the user does not own the repository' do @@ -171,9 +171,9 @@ describe RepositoriesController do get :edit, id: repository.id, project_id: project.id.to_s end - it { should redirect_to(projects_url) } - it { should respond_with(:redirect) } - it { should set_the_flash[:notice].to("You're not allowed to do this operation") } + it { is_expected.to redirect_to(projects_url) } + it { is_expected.to respond_with(:redirect) } + it { is_expected.to set_the_flash[:notice].to("You're not allowed to do this operation") } end end @@ -182,7 +182,7 @@ describe RepositoriesController do get :edit, id: repository.id, project_id: project.id.to_s end - it { should redirect_to new_user_session_path } + it { is_expected.to redirect_to new_user_session_path } end end @@ -208,8 +208,8 @@ describe RepositoriesController do post :update, project_id: project.id.to_s, id: repository.id, repository: repository_params end - it { should redirect_to(project_repository_path(repository.project_id, repository.id)) } - it { should respond_with(:redirect) } + it { is_expected.to redirect_to(project_repository_path(repository.project_id, repository.id)) } + it { is_expected.to respond_with(:redirect) } end context 'with an invalid field' do @@ -221,7 +221,7 @@ describe RepositoriesController do post :update, project_id: project.id.to_s, id: repository.id, repository: repository_params end - it { should render_template(:edit) } + it { is_expected.to render_template(:edit) } end end @@ -230,7 +230,7 @@ describe RepositoriesController do post :update, project_id: project.id.to_s, id: repository.id, repository: repository_params end - it { should redirect_to projects_path } + it { is_expected.to redirect_to projects_path } end end @@ -239,7 +239,7 @@ describe RepositoriesController do post :update, project_id: project.id.to_s, id: repository.id, repository: repository_params end - it { should redirect_to new_user_session_path } + it { is_expected.to redirect_to new_user_session_path } end end @@ -254,8 +254,8 @@ describe RepositoriesController do xhr :get, :state, {project_id: project.id.to_s, id: repository.id, last_state: ''} end - it { should respond_with(:success) } - it { should render_template(:unprocessed) } + it { is_expected.to respond_with(:success) } + it { is_expected.to render_template(:unprocessed) } end context 'with a READY state' do @@ -268,8 +268,8 @@ describe RepositoriesController do xhr :get, :state, {project_id: project.id.to_s, id: repository.id, last_state: 'ANALYZING'} end - it { should respond_with(:success) } - it { should render_template(:load_ready_processing) } + it { is_expected.to respond_with(:success) } + it { is_expected.to render_template(:load_ready_processing) } end context 'with another state then READY' do @@ -282,8 +282,8 @@ describe RepositoriesController do xhr :get, :state, {project_id: project.id.to_s, id: repository.id, last_state: 'LOADING'} end - it { should respond_with(:success) } - it { should render_template(:reload_processing) } + it { is_expected.to respond_with(:success) } + it { is_expected.to render_template(:reload_processing) } end context 'when it was already READY' do @@ -293,8 +293,8 @@ describe RepositoriesController do xhr :get, :state, {project_id: project.id.to_s, id: repository.id, last_state: 'READY'} end - it { should respond_with(:ok) } - it { should_not render_with_layout } + it { is_expected.to respond_with(:ok) } + it { is_expected.not_to render_with_layout } end context 'with a given date' do @@ -307,8 +307,8 @@ describe RepositoriesController do xhr :get, :state, {project_id: project.id.to_s, id: repository.id, last_state: '', day: '11', month: '11', year: '2013'} end - it { should respond_with(:ok) } - it { should_not render_with_layout } + it { is_expected.to respond_with(:ok) } + it { is_expected.not_to render_with_layout } end end @@ -322,6 +322,6 @@ describe RepositoriesController do MezuroConfiguration.expects(:find).with(repository.id).returns(FactoryGirl.build(:mezuro_configuration)) get :process_repository, project_id: project.id.to_s, id: repository.id end - it { should redirect_to(project_repository_path(repository.project_id, repository.id)) } + it { is_expected.to redirect_to(project_repository_path(repository.project_id, repository.id)) } end end diff --git a/spec/controllers/users_controller_spec.rb b/spec/controllers/users_controller_spec.rb index d5ecd1c..74e2583 100644 --- a/spec/controllers/users_controller_spec.rb +++ b/spec/controllers/users_controller_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe UsersController do +describe UsersController, :type => :controller do describe 'projects' do let(:user) { FactoryGirl.build(:user) } @@ -10,6 +10,6 @@ describe UsersController do get :projects, user_id: user.id end - it { should render_template(:projects) } + it { is_expected.to render_template(:projects) } end end diff --git a/spec/helpers/compound_metric_configurations_helper_spec.rb b/spec/helpers/compound_metric_configurations_helper_spec.rb index 65dec2a..7576718 100644 --- a/spec/helpers/compound_metric_configurations_helper_spec.rb +++ b/spec/helpers/compound_metric_configurations_helper_spec.rb @@ -1,9 +1,9 @@ require 'spec_helper' -describe CompoundMetricConfigurationsHelper do +describe CompoundMetricConfigurationsHelper, :type => :helper do describe 'scope_options' do it 'should return an array with the supported scope options' do - helper.scope_options.should eq [["Method","METHOD"], ["Class", "CLASS"], ["Package", "PACKAGE"], ["Software", "SOFTWARE"]] + expect(helper.scope_options).to eq [["Method","METHOD"], ["Class", "CLASS"], ["Package", "PACKAGE"], ["Software", "SOFTWARE"]] end end end diff --git a/spec/helpers/metric_configurations_helper_spec.rb b/spec/helpers/metric_configurations_helper_spec.rb index 98f3996..83b2515 100644 --- a/spec/helpers/metric_configurations_helper_spec.rb +++ b/spec/helpers/metric_configurations_helper_spec.rb @@ -1,9 +1,9 @@ require 'spec_helper' -describe MetricConfigurationsHelper do +describe MetricConfigurationsHelper, :type => :helper do describe 'aggregation_form_options' do it 'should return an array with the supported aggregation forms' do - helper.aggregation_options.should eq [["Average","AVERAGE"], ["Median", "MEDIAN"], ["Maximum", "MAXIMUM"], ["Minimum", "MINIMUM"], + expect(helper.aggregation_options).to eq [["Average","AVERAGE"], ["Median", "MEDIAN"], ["Maximum", "MAXIMUM"], ["Minimum", "MINIMUM"], ["Count", "COUNT"], ["Standard Deviation", "STANDARD_DEVIATION"]] end end @@ -16,7 +16,7 @@ describe MetricConfigurationsHelper do end it 'should return a pair with the reading group name and id' do - helper.reading_group_options.should eq [[reading_group.name, reading_group.id]] + expect(helper.reading_group_options).to eq [[reading_group.name, reading_group.id]] end end @@ -28,7 +28,7 @@ describe MetricConfigurationsHelper do end it 'should return a pair with the metric configuration code and metric name' do - helper.native_metrics_of(metric_configuration.configuration_id).should eq [[metric_configuration.code, metric_configuration.metric.name]] + expect(helper.native_metrics_of(metric_configuration.configuration_id)).to eq [[metric_configuration.code, metric_configuration.metric.name]] end end end diff --git a/spec/helpers/mezuro_configurations_helper_spec.rb b/spec/helpers/mezuro_configurations_helper_spec.rb index db11da4..3edab6a 100644 --- a/spec/helpers/mezuro_configurations_helper_spec.rb +++ b/spec/helpers/mezuro_configurations_helper_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe MezuroConfigurationsHelper do +describe MezuroConfigurationsHelper, :type => :helper do describe 'mezuro_configuration_owner?' do before :each do @subject = FactoryGirl.build(:mezuro_configuration) @@ -10,7 +10,7 @@ describe MezuroConfigurationsHelper do before :each do helper.expects(:user_signed_in?).returns(false) end - it { helper.mezuro_configuration_owner?(@subject.id).should be_false } + it { expect(helper.mezuro_configuration_owner?(@subject.id)).to be_falsey } end context 'returns false if is not the owner' do @@ -24,7 +24,7 @@ describe MezuroConfigurationsHelper do User.any_instance.expects(:mezuro_configuration_ownerships).returns(@ownerships) end - it { helper.mezuro_configuration_owner?(@subject.id).should be_false } + it { expect(helper.mezuro_configuration_owner?(@subject.id)).to be_falsey } end context 'returns true if user is the mezuro_configuration owner' do @@ -38,7 +38,7 @@ describe MezuroConfigurationsHelper do User.any_instance.expects(:mezuro_configuration_ownerships).returns(@ownerships) end - it { helper.mezuro_configuration_owner?(@subject.id).should be_true } + it { expect(helper.mezuro_configuration_owner?(@subject.id)).to be_truthy } end end @@ -47,14 +47,14 @@ describe MezuroConfigurationsHelper do let(:metric_configuration) { FactoryGirl.build(:metric_configuration) } let(:response_link) {"Edit"} - it { helper.link_to_edit_form(metric_configuration, metric_configuration.configuration_id).should eq(response_link) } + it { expect(helper.link_to_edit_form(metric_configuration, metric_configuration.configuration_id)).to eq(response_link) } end context 'when the metric is compound' do let(:compound_metric_configuration) { FactoryGirl.build(:compound_metric_configuration) } let(:response_link) {"Edit"} - it { helper.link_to_edit_form(compound_metric_configuration, compound_metric_configuration.configuration_id).should eq(response_link) } + it { expect(helper.link_to_edit_form(compound_metric_configuration, compound_metric_configuration.configuration_id)).to eq(response_link) } end end @@ -63,14 +63,14 @@ describe MezuroConfigurationsHelper do let(:metric_configuration) { FactoryGirl.build(:metric_configuration) } let(:response_link) {"Show"} - it { helper.link_to_show_page(metric_configuration, metric_configuration.configuration_id).should eq(response_link) } + it { expect(helper.link_to_show_page(metric_configuration, metric_configuration.configuration_id)).to eq(response_link) } end context 'when the metric is compound' do let(:compound_metric_configuration) { FactoryGirl.build(:compound_metric_configuration) } let(:response_link) {"Show"} - it { helper.link_to_show_page(compound_metric_configuration, compound_metric_configuration.configuration_id).should eq(response_link) } + it { expect(helper.link_to_show_page(compound_metric_configuration, compound_metric_configuration.configuration_id)).to eq(response_link) } end end end diff --git a/spec/helpers/mezuro_ranges_helper_spec.rb b/spec/helpers/mezuro_ranges_helper_spec.rb index 836010a..120be41 100644 --- a/spec/helpers/mezuro_ranges_helper_spec.rb +++ b/spec/helpers/mezuro_ranges_helper_spec.rb @@ -1,10 +1,10 @@ require 'spec_helper' -describe MezuroRangesHelper do +describe MezuroRangesHelper, :type => :helper do describe 'readings_options' do let(:reading) { FactoryGirl.build(:reading) } it 'should return a pair with the reading label and id' do - helper.readings_options([reading]).should eq [[reading.label, reading.id]] + expect(helper.readings_options([reading])).to eq [[reading.label, reading.id]] end end end diff --git a/spec/helpers/processings_helper_spec.rb b/spec/helpers/processings_helper_spec.rb index dba1ee1..4225b93 100644 --- a/spec/helpers/processings_helper_spec.rb +++ b/spec/helpers/processings_helper_spec.rb @@ -1,15 +1,15 @@ require 'spec_helper' -describe ProcessingsHelper do +describe ProcessingsHelper, :type => :helper do describe 'humanize_eplased_time' do it 'should convert it to readable words' do - helper.humanize_eplased_time(6000).should eq('less than a minute') + expect(helper.humanize_eplased_time(6000)).to eq('less than a minute') end end describe 'format_grade' do it 'should format a Float to a readable format' do - helper.format_grade(1.333333333).should eq("1.33") + expect(helper.format_grade(1.333333333)).to eq("1.33") end end @@ -28,7 +28,7 @@ describe ProcessingsHelper do end it 'should return the range snapshot in which the value was in between' do - helper.find_range_snapshot(metric_result).should eq(range_snapshot_5dot1_to_10) + expect(helper.find_range_snapshot(metric_result)).to eq(range_snapshot_5dot1_to_10) end end @@ -37,7 +37,7 @@ describe ProcessingsHelper do let(:name) { 'org' } it 'should not make any change' do - helper.format_module_name(name).should eq(name) + expect(helper.format_module_name(name)).to eq(name) end end @@ -45,7 +45,7 @@ describe ProcessingsHelper do let(:name) { ['org', 'mezuro'] } it "should return it's last element" do - helper.format_module_name(name).should eq(name.last) + expect(helper.format_module_name(name)).to eq(name.last) end end diff --git a/spec/helpers/projects_helper_spec.rb b/spec/helpers/projects_helper_spec.rb index 0f4ff78..ee84051 100644 --- a/spec/helpers/projects_helper_spec.rb +++ b/spec/helpers/projects_helper_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe ProjectsHelper do +describe ProjectsHelper, :type => :helper do describe 'project_owner?' do before :each do @@ -11,7 +11,7 @@ describe ProjectsHelper do before :each do helper.expects(:user_signed_in?).returns(false) end - it { helper.project_owner?(@subject.id).should be_false } + it { expect(helper.project_owner?(@subject.id)).to be_falsey } end context 'returns false if is not the owner' do @@ -25,7 +25,7 @@ describe ProjectsHelper do User.any_instance.expects(:project_ownerships).returns(@ownerships) end - it { helper.project_owner?(@subject.id).should be_false } + it { expect(helper.project_owner?(@subject.id)).to be_falsey } end context 'returns true if user is the project owner' do @@ -39,7 +39,7 @@ describe ProjectsHelper do User.any_instance.expects(:project_ownerships).returns(@ownerships) end - it { helper.project_owner?(@subject.id).should be_true } + it { expect(helper.project_owner?(@subject.id)).to be_truthy } end end diff --git a/spec/helpers/reading_groups_helper_spec.rb b/spec/helpers/reading_groups_helper_spec.rb index ae9c92c..7c460a8 100644 --- a/spec/helpers/reading_groups_helper_spec.rb +++ b/spec/helpers/reading_groups_helper_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe ReadingGroupsHelper do +describe ReadingGroupsHelper, :type => :helper do describe 'reading_group_owner?' do before :each do @@ -11,7 +11,7 @@ describe ReadingGroupsHelper do before :each do helper.expects(:user_signed_in?).returns(false) end - it { helper.reading_groups_owner?(@subject.id).should be_false } + it { expect(helper.reading_groups_owner?(@subject.id)).to be_falsey } end context 'returns false if is not the owner' do @@ -25,7 +25,7 @@ describe ReadingGroupsHelper do User.any_instance.expects(:reading_group_ownerships).returns(@ownerships) end - it { helper.reading_groups_owner?(@subject.id).should be_false } + it { expect(helper.reading_groups_owner?(@subject.id)).to be_falsey } end context 'returns true if user is the reading_group owner' do @@ -39,7 +39,7 @@ describe ReadingGroupsHelper do User.any_instance.expects(:reading_group_ownerships).returns(@ownerships) end - it { helper.reading_groups_owner?(@subject.id).should be_true } + it { expect(helper.reading_groups_owner?(@subject.id)).to be_truthy } end end diff --git a/spec/helpers/repository_helper_spec.rb b/spec/helpers/repository_helper_spec.rb index 21b2416..389564b 100644 --- a/spec/helpers/repository_helper_spec.rb +++ b/spec/helpers/repository_helper_spec.rb @@ -1,43 +1,43 @@ require 'spec_helper' -describe RepositoryHelper do +describe RepositoryHelper, :type => :helper do describe 'periodicity_options' do it 'should return an array with some sample periods' do - helper.periodicity_options.should eq [["Not Periodically", 0], ["1 day", 1], ["2 days", 2], ["Weekly", 7], ["Biweekly", 15], ["Monthly", 30]] + expect(helper.periodicity_options).to eq [["Not Periodically", 0], ["1 day", 1], ["2 days", 2], ["Weekly", 7], ["Biweekly", 15], ["Monthly", 30]] end end describe 'license_options' do it 'should return an array with some sample licenses names' do - helper.license_options.should eq YAML.load_file("config/licenses.yml").split("; ") + expect(helper.license_options).to eq YAML.load_file("config/licenses.yml").split("; ") end end describe 'periodicity_option' do it 'should return the periodicity option associated to the given number' do - helper.periodicity_option(1).should eq "1 day" + expect(helper.periodicity_option(1)).to eq "1 day" end it 'should return Undefined when there is no periodicity value' do - helper.periodicity_option(nil).should eq "Undefined" + expect(helper.periodicity_option(nil)).to eq "Undefined" end end describe 'calendar' do it 'should return an array with the number of days' do days = (1..31).to_a.map {|day| [day, day]} - helper.day_options.should eq days + expect(helper.day_options).to eq days end it 'should return an array with the number of months' do months = (1..12).to_a.map {|month| [month, month]} - helper.month_options.should eq months + expect(helper.month_options).to eq months end it 'should return a range of years' do years = (2013..2020).to_a.map {|year| [year, year]} - helper.year_options.should eq years + expect(helper.year_options).to eq years end end diff --git a/spec/models/metric_configuration_spec.rb b/spec/models/metric_configuration_spec.rb index 5182bcc..01bbff4 100644 --- a/spec/models/metric_configuration_spec.rb +++ b/spec/models/metric_configuration_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe MetricConfiguration do +describe MetricConfiguration, :type => :model do subject {FactoryGirl.build(:metric_configuration)} describe 'methods' do @@ -11,7 +11,7 @@ describe MetricConfiguration do end it 'should returns a list with its ranges' do - subject.mezuro_ranges.should eq([mezuro_range]) + expect(subject.mezuro_ranges).to eq([mezuro_range]) end end end @@ -23,9 +23,9 @@ describe MetricConfiguration do MetricConfiguration.expects(:metric_configurations_of).at_least_once.returns([]) end - it { should validate_presence_of(:code) } - it { should validate_presence_of(:weight) } - it { should validate_presence_of(:aggregation_form) } + it { is_expected.to validate_presence_of(:code) } + it { is_expected.to validate_presence_of(:weight) } + it { is_expected.to validate_presence_of(:aggregation_form) } end context 'code validations' do diff --git a/spec/models/mezuro_configuration_ownership_spec.rb b/spec/models/mezuro_configuration_ownership_spec.rb index 204c469..1c63d22 100644 --- a/spec/models/mezuro_configuration_ownership_spec.rb +++ b/spec/models/mezuro_configuration_ownership_spec.rb @@ -1,8 +1,8 @@ require 'spec_helper' -describe MezuroConfigurationOwnership do +describe MezuroConfigurationOwnership, :type => :model do describe 'associations' do - it { should belong_to(:user) } + it { is_expected.to belong_to(:user) } end describe 'methods' do @@ -15,7 +15,7 @@ describe MezuroConfigurationOwnership do end it 'should return the mezuro_configuration' do - subject.mezuro_configuration.should eq(mezuro_configuration) + expect(subject.mezuro_configuration).to eq(mezuro_configuration) end end end diff --git a/spec/models/mezuro_configuration_spec.rb b/spec/models/mezuro_configuration_spec.rb index 92c7ba4..bbd3c4c 100644 --- a/spec/models/mezuro_configuration_spec.rb +++ b/spec/models/mezuro_configuration_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe MezuroConfiguration do +describe MezuroConfiguration, :type => :model do subject { FactoryGirl.build(:mezuro_configuration) } describe 'methods' do describe 'persisted?' do @@ -9,7 +9,7 @@ describe MezuroConfiguration do end it 'should return false' do - subject.persisted?.should eq(false) + expect(subject.persisted?).to eq(false) end end @@ -24,7 +24,7 @@ describe MezuroConfiguration do end it 'should return true' do - subject.update(@subject_params).should eq(true) + expect(subject.update(@subject_params)).to eq(true) end end @@ -34,7 +34,7 @@ describe MezuroConfiguration do end it 'should return false' do - subject.update(@subject_params).should eq(false) + expect(subject.update(@subject_params)).to eq(false) end end end @@ -46,7 +46,7 @@ describe MezuroConfiguration do it 'should call metric_configurations_of on the Metric Configuration model' do MetricConfiguration.expects(:metric_configurations_of).with(subject.id).returns([metric_configuration]) - subject.metric_configurations.should include(metric_configuration) + expect(subject.metric_configurations).to include(metric_configuration) end end end @@ -56,7 +56,7 @@ describe MezuroConfiguration do before :each do MezuroConfiguration.expects(:all).at_least_once.returns([]) end - it { should validate_presence_of(:name) } + it { is_expected.to validate_presence_of(:name) } end context 'kalibro validations' do diff --git a/spec/models/mezuro_range_spec.rb b/spec/models/mezuro_range_spec.rb index e90cbe5..d9cf102 100644 --- a/spec/models/mezuro_range_spec.rb +++ b/spec/models/mezuro_range_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe MezuroRange do +describe MezuroRange, :type => :model do subject { FactoryGirl.build(:mezuro_range, { metric_configuration_id: 42 }) } describe 'validations' do context 'active model validations' do @@ -8,36 +8,36 @@ describe MezuroRange do MezuroRange.expects(:ranges_of).with(subject.metric_configuration_id).at_least_once.returns([]) end - it { should validate_presence_of(:beginning) } - it { should validate_presence_of(:end) } - it { should validate_presence_of(:reading_id) } + it { is_expected.to validate_presence_of(:beginning) } + it { is_expected.to validate_presence_of(:end) } + it { is_expected.to validate_presence_of(:reading_id) } context 'beginning and end numericality' do - it { should validate_presence_of(:beginning) } - it { should validate_presence_of(:end) } + it { is_expected.to validate_presence_of(:beginning) } + it { is_expected.to validate_presence_of(:end) } it 'should allow -INF and INF to beginning' do subject.beginning = '-INF' subject.save - subject.errors.messages.should be_empty + expect(subject.errors.messages).to be_empty subject.beginning = 'INF' subject.save - subject.errors.messages.should be_empty + expect(subject.errors.messages).to be_empty end it 'should allow -INF and INF to end' do subject.end = '-INF' subject.save - subject.errors.messages.should be_empty + expect(subject.errors.messages).to be_empty subject.end = 'INF' subject.save - subject.errors.messages.should be_empty + expect(subject.errors.messages).to be_empty end end end diff --git a/spec/models/module_result_spec.rb b/spec/models/module_result_spec.rb index a2a7bc6..1eef95d 100644 --- a/spec/models/module_result_spec.rb +++ b/spec/models/module_result_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe ModuleResult do +describe ModuleResult, :type => :model do describe 'methods' do subject { FactoryGirl.build(:module_result) } @@ -18,7 +18,7 @@ describe ModuleResult do end it 'should return a array of DateModuleResults' do - subject.history.first.should be_a(DateModuleResult) + expect(subject.history.first).to be_a(DateModuleResult) end end @@ -32,7 +32,7 @@ describe ModuleResult do end it 'should return the history for the given metric name' do - subject.metric_history(metric_result.metric_configuration_snapshot.metric.name).should eq({date_module_result.date => metric_result.value}) + expect(subject.metric_history(metric_result.metric_configuration_snapshot.metric.name)).to eq({date_module_result.date => metric_result.value}) end end end diff --git a/spec/models/processing_spec.rb b/spec/models/processing_spec.rb index 15c07fb..0295e9b 100644 --- a/spec/models/processing_spec.rb +++ b/spec/models/processing_spec.rb @@ -1,13 +1,13 @@ require 'spec_helper' -describe Processing do +describe Processing, :type => :model do describe 'methods' do subject { FactoryGirl.build(:processing) } describe 'ready?' do context 'with a READY processing' do it 'should return true' do - subject.ready?.should be_true + expect(subject.ready?).to be_truthy end end @@ -15,7 +15,7 @@ describe Processing do subject { FactoryGirl.build(:processing, state: 'COLLECTING') } it 'should return false' do - subject.ready?.should be_false + expect(subject.ready?).to be_falsey end end end diff --git a/spec/models/project_ownership_spec.rb b/spec/models/project_ownership_spec.rb index 7343d18..1fc2bf8 100644 --- a/spec/models/project_ownership_spec.rb +++ b/spec/models/project_ownership_spec.rb @@ -1,8 +1,8 @@ require 'spec_helper' -describe ProjectOwnership do +describe ProjectOwnership, :type => :model do describe 'associations' do - it { should belong_to(:user) } + it { is_expected.to belong_to(:user) } end describe 'methods' do @@ -15,7 +15,7 @@ describe ProjectOwnership do end it 'should return the project' do - subject.project.should eq(project) + expect(subject.project).to eq(project) end end end diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index fb7654c..9d99f79 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Project do +describe Project, :type => :model do describe 'methods' do describe 'persisted?' do before :each do @@ -9,7 +9,7 @@ describe Project do end it 'should return false' do - @subject.persisted?.should eq(false) + expect(@subject.persisted?).to eq(false) end end @@ -22,12 +22,12 @@ describe Project do end it 'should return the two projects ordered' do - Project.latest(2).should eq([@kalibro, @qt]) + expect(Project.latest(2)).to eq([@kalibro, @qt]) end context 'when no parameter is passed' do it 'should return just the most recent project' do - Project.latest.should eq([@kalibro]) + expect(Project.latest).to eq([@kalibro]) end end end @@ -44,7 +44,7 @@ describe Project do end it 'should return true' do - @qt.update(@qt_params).should eq(true) + expect(@qt.update(@qt_params)).to eq(true) end end @@ -54,7 +54,7 @@ describe Project do end it 'should return false' do - @qt.update(@qt_params).should eq(false) + expect(@qt.update(@qt_params)).to eq(false) end end end @@ -66,7 +66,7 @@ describe Project do it 'should call repositories_of on the Repository model' do Repository.expects(:repositories_of).with(subject.id).returns([repository]) - subject.repositories.should include(repository) + expect(subject.repositories).to include(repository) end end end @@ -77,7 +77,7 @@ describe Project do before :each do Project.expects(:all).at_least_once.returns([]) end - it { should validate_presence_of(:name) } + it { is_expected.to validate_presence_of(:name) } end context 'kalibro validations' do diff --git a/spec/models/reading_group_ownership_spec.rb b/spec/models/reading_group_ownership_spec.rb index 5da1bd1..3cba3fa 100644 --- a/spec/models/reading_group_ownership_spec.rb +++ b/spec/models/reading_group_ownership_spec.rb @@ -1,8 +1,8 @@ require 'spec_helper' -describe ReadingGroupOwnership do +describe ReadingGroupOwnership, :type => :model do describe 'associations' do - it { should belong_to(:user) } + it { is_expected.to belong_to(:user) } end describe 'methods' do @@ -15,7 +15,7 @@ describe ReadingGroupOwnership do end it 'should return the reading_group' do - subject.reading_group.should eq(reading_group) + expect(subject.reading_group).to eq(reading_group) end end end diff --git a/spec/models/reading_group_spec.rb b/spec/models/reading_group_spec.rb index 5a135f2..f3f29ba 100644 --- a/spec/models/reading_group_spec.rb +++ b/spec/models/reading_group_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe ReadingGroup do +describe ReadingGroup, :type => :model do describe 'methods' do describe 'persisted?' do before :each do @@ -9,7 +9,7 @@ describe ReadingGroup do end it 'should return false' do - @subject.persisted?.should eq(false) + expect(@subject.persisted?).to eq(false) end end @@ -25,7 +25,7 @@ describe ReadingGroup do end it 'should return true' do - @qt.update(@qt_params).should eq(true) + expect(@qt.update(@qt_params)).to eq(true) end end @@ -35,7 +35,7 @@ describe ReadingGroup do end it 'should return false' do - @qt.update(@qt_params).should eq(false) + expect(@qt.update(@qt_params)).to eq(false) end end end @@ -47,7 +47,7 @@ describe ReadingGroup do it 'should call readings_of on the Reading model' do Reading.expects(:readings_of).with(subject.id).returns([reading]) - subject.readings.should include(reading) + expect(subject.readings).to include(reading) end end end @@ -58,7 +58,7 @@ describe ReadingGroup do before :each do ReadingGroup.expects(:all).at_least_once.returns([]) end - it { should validate_presence_of(:name) } + it { is_expected.to validate_presence_of(:name) } end context 'kalibro validations' do diff --git a/spec/models/reading_spec.rb b/spec/models/reading_spec.rb index d6f8116..00ae9c2 100644 --- a/spec/models/reading_spec.rb +++ b/spec/models/reading_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Reading do +describe Reading, :type => :model do describe 'validations' do subject {FactoryGirl.build(:reading)} @@ -9,10 +9,10 @@ describe Reading do Reading.expects(:all).at_least_once.returns([]) end - it { should validate_presence_of(:label) } - it { should validate_presence_of(:color) } - it { should validate_presence_of(:grade) } - it { should validate_numericality_of(:grade) } + it { is_expected.to validate_presence_of(:label) } + it { is_expected.to validate_presence_of(:color) } + it { is_expected.to validate_presence_of(:grade) } + it { is_expected.to validate_numericality_of(:grade) } end context 'kalibro validations' do diff --git a/spec/models/repository_spec.rb b/spec/models/repository_spec.rb index 0c7b43c..ba5699a 100644 --- a/spec/models/repository_spec.rb +++ b/spec/models/repository_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Repository do +describe Repository, :type => :model do describe 'methods' do describe 'last_processing' do subject { FactoryGirl.build(:repository) } @@ -11,7 +11,7 @@ describe Repository do end it 'should return nil' do - subject.last_processing.should be_nil + expect(subject.last_processing).to be_nil end end @@ -26,7 +26,7 @@ describe Repository do it 'should return a ready processing processing' do Processing.expects(:last_ready_processing_of).with(subject.id).returns(processing) - subject.last_processing.should eq(processing) + expect(subject.last_processing).to eq(processing) end end @@ -41,7 +41,7 @@ describe Repository do it 'should return the latest processing' do Processing.expects(:last_processing_of).with(subject.id).returns(processing) - subject.last_processing.should eq(processing) + expect(subject.last_processing).to eq(processing) end end end @@ -55,8 +55,8 @@ describe Repository do Repository.expects(:all).at_least_once.returns([]) end - it { should validate_presence_of(:name) } - it { should validate_presence_of(:address) } + it { is_expected.to validate_presence_of(:name) } + it { is_expected.to validate_presence_of(:address) } end context 'kalibro validations' do diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 226f83a..a43dd6a 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -1,18 +1,18 @@ require 'spec_helper' -describe User do +describe User, :type => :model do context 'validations' do subject { FactoryGirl.build(:user) } - it { should validate_presence_of(:name) } - it { should validate_presence_of(:email) } - it { should validate_uniqueness_of(:email) } + it { is_expected.to validate_presence_of(:name) } + it { is_expected.to validate_presence_of(:email) } + it { is_expected.to validate_uniqueness_of(:email) } end describe 'associations' do - it { should have_many(:project_ownerships) } - it { should have_many(:reading_group_ownerships) } - it { should have_many(:mezuro_configuration_ownerships) } + it { is_expected.to have_many(:project_ownerships) } + it { is_expected.to have_many(:reading_group_ownerships) } + it { is_expected.to have_many(:mezuro_configuration_ownerships) } end describe 'methods' do @@ -27,7 +27,7 @@ describe User do end it 'should return a list of projects owned by the user' do - subject.projects.should eq([project]) + expect(subject.projects).to eq([project]) end end @@ -42,7 +42,7 @@ describe User do end it 'should return a list of reading groups owned by the user' do - subject.reading_groups.should eq([reading_group]) + expect(subject.reading_groups).to eq([reading_group]) end end @@ -57,7 +57,7 @@ describe User do end it 'should return a list of mezuro configurations owned by the user' do - subject.mezuro_configurations.should eq([mezuro_configuration]) + expect(subject.mezuro_configurations).to eq([mezuro_configuration]) end end end diff --git a/spec/models/validators/beginning_uniqueness_validator_spec.rb b/spec/models/validators/beginning_uniqueness_validator_spec.rb index a2fb8ae..8c9cd22 100644 --- a/spec/models/validators/beginning_uniqueness_validator_spec.rb +++ b/spec/models/validators/beginning_uniqueness_validator_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe BeginningUniquenessValidator do +describe BeginningUniquenessValidator, :type => :model do describe 'methods' do describe 'validate_each' do let(:metric_configuration) { FactoryGirl.build(:metric_configuration) } @@ -13,7 +13,7 @@ describe BeginningUniquenessValidator do subject { FactoryGirl.build(:mezuro_range, metric_configuration_id: metric_configuration.id) } it 'should contain no errors' do subject.save - subject.errors.should be_empty + expect(subject.errors).to be_empty end end @@ -26,7 +26,7 @@ describe BeginningUniquenessValidator do it 'should contain errors' do @subject.save - @subject.errors[:beginning].should eq(["There's already a MezuroRange with beginning #{@subject.beginning}! Please, choose another one."]) + expect(@subject.errors[:beginning]).to eq(["There's already a MezuroRange with beginning #{@subject.beginning}! Please, choose another one."]) end end end diff --git a/spec/models/validators/code_uniqueness_validator_spec.rb b/spec/models/validators/code_uniqueness_validator_spec.rb index e2412b2..167b271 100644 --- a/spec/models/validators/code_uniqueness_validator_spec.rb +++ b/spec/models/validators/code_uniqueness_validator_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe CodeUniquenessValidator do +describe CodeUniquenessValidator, :type => :model do describe 'methods' do describe 'validate_each' do context 'without saved metric_configurations' do @@ -12,7 +12,7 @@ describe CodeUniquenessValidator do subject { FactoryGirl.build(:metric_configuration) } it 'should contain no errors' do subject.save - subject.errors.should be_empty + expect(subject.errors).to be_empty end end @@ -24,7 +24,7 @@ describe CodeUniquenessValidator do it 'should contain errors' do @subject.save - @subject.errors[:code].should eq(["There's already a MetricConfiguration with code #{@subject.code}! Please, choose another one."]) + expect(@subject.errors[:code]).to eq(["There's already a MetricConfiguration with code #{@subject.code}! Please, choose another one."]) end end end diff --git a/spec/models/validators/kalibro_uniqueness_validator_spec.rb b/spec/models/validators/kalibro_uniqueness_validator_spec.rb index 125db8e..d78cce1 100644 --- a/spec/models/validators/kalibro_uniqueness_validator_spec.rb +++ b/spec/models/validators/kalibro_uniqueness_validator_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe KalibroUniquenessValidator do +describe KalibroUniquenessValidator, :type => :model do describe 'methods' do describe 'validate_each' do context 'without saved projects' do @@ -12,7 +12,7 @@ describe KalibroUniquenessValidator do subject { FactoryGirl.build(:project) } it 'should contain no errors' do subject.save - subject.errors.should be_empty + expect(subject.errors).to be_empty end end @@ -24,7 +24,7 @@ describe KalibroUniquenessValidator do it 'should contain errors' do @subject.save - @subject.errors[:name].should eq(["There's already a Project with name #{@subject.name}! Please, choose another one."]) + expect(@subject.errors[:name]).to eq(["There's already a Project with name #{@subject.name}! Please, choose another one."]) end end end diff --git a/spec/routing/compound_metric_configurations_routing_spec.rb b/spec/routing/compound_metric_configurations_routing_spec.rb index c66f56d..d77648e 100644 --- a/spec/routing/compound_metric_configurations_routing_spec.rb +++ b/spec/routing/compound_metric_configurations_routing_spec.rb @@ -1,20 +1,20 @@ require "spec_helper" -describe CompoundMetricConfigurationsController do +describe CompoundMetricConfigurationsController, :type => :routing do describe "routing" do - it { should route(:get, '/mezuro_configurations/1/compound_metric_configurations/new'). + it { is_expected.to route(:get, '/mezuro_configurations/1/compound_metric_configurations/new'). to(controller: :compound_metric_configurations, action: :new, mezuro_configuration_id: "1") } - it { should route(:get, '/mezuro_configurations/1/compound_metric_configurations'). + it { is_expected.to route(:get, '/mezuro_configurations/1/compound_metric_configurations'). to(controller: :compound_metric_configurations, action: :index, mezuro_configuration_id: "1") } - it { should route(:post, '/mezuro_configurations/1/compound_metric_configurations'). + it { is_expected.to route(:post, '/mezuro_configurations/1/compound_metric_configurations'). to(controller: :compound_metric_configurations, action: :create, mezuro_configuration_id: "1") } - it { should route(:get, '/mezuro_configurations/1/compound_metric_configurations/1'). + it { is_expected.to route(:get, '/mezuro_configurations/1/compound_metric_configurations/1'). to(controller: :compound_metric_configurations, action: :show, mezuro_configuration_id: "1", id: "1") } - it { should route(:get, '/mezuro_configurations/1/compound_metric_configurations/1/edit'). + it { is_expected.to route(:get, '/mezuro_configurations/1/compound_metric_configurations/1/edit'). to(controller: :compound_metric_configurations, action: :edit, mezuro_configuration_id: "1", id: "1") } - it { should route(:put, '/mezuro_configurations/1/compound_metric_configurations/1'). + it { is_expected.to route(:put, '/mezuro_configurations/1/compound_metric_configurations/1'). to(controller: :compound_metric_configurations, action: :update, mezuro_configuration_id: "1", id: "1") } - it { should_not route(:delete, '/mezuro_configurations/1/compound_metric_configurations/1'). + it { is_expected.not_to route(:delete, '/mezuro_configurations/1/compound_metric_configurations/1'). to(controller: :compound_metric_configurations, action: :destroy, mezuro_configuration_id: "1", id: "1") } end end diff --git a/spec/routing/home_routing_spec.rb b/spec/routing/home_routing_spec.rb index 8e10046..605e8b0 100644 --- a/spec/routing/home_routing_spec.rb +++ b/spec/routing/home_routing_spec.rb @@ -1,8 +1,8 @@ require "spec_helper" -describe HomeController do +describe HomeController, :type => :routing do describe "routing" do - it { should route(:get, '/'). + it { is_expected.to route(:get, '/'). to(controller: :home, action: :index) } end end \ No newline at end of file diff --git a/spec/routing/metric_configurations_routing_spec.rb b/spec/routing/metric_configurations_routing_spec.rb index bba1853..0ca56fe 100644 --- a/spec/routing/metric_configurations_routing_spec.rb +++ b/spec/routing/metric_configurations_routing_spec.rb @@ -1,22 +1,22 @@ require "spec_helper" -describe MetricConfigurationsController do +describe MetricConfigurationsController, :type => :routing do describe "routing" do - it { should route(:post, '/mezuro_configurations/1/metric_configurations/new'). + it { is_expected.to route(:post, '/mezuro_configurations/1/metric_configurations/new'). to(controller: :metric_configurations, action: :new, mezuro_configuration_id: "1") } - it { should route(:get, '/mezuro_configurations/1/metric_configurations'). + it { is_expected.to route(:get, '/mezuro_configurations/1/metric_configurations'). to(controller: :metric_configurations, action: :index, mezuro_configuration_id: "1") } - it { should route(:post, '/mezuro_configurations/1/metric_configurations'). + it { is_expected.to route(:post, '/mezuro_configurations/1/metric_configurations'). to(controller: :metric_configurations, action: :create, mezuro_configuration_id: "1") } - it { should route(:get, '/mezuro_configurations/1/metric_configurations/1'). + it { is_expected.to route(:get, '/mezuro_configurations/1/metric_configurations/1'). to(controller: :metric_configurations, action: :show, mezuro_configuration_id: "1", id: "1") } - it { should route(:get, '/mezuro_configurations/1/metric_configurations/1/edit'). + it { is_expected.to route(:get, '/mezuro_configurations/1/metric_configurations/1/edit'). to(controller: :metric_configurations, action: :edit, mezuro_configuration_id: "1", id: "1") } - it { should route(:put, '/mezuro_configurations/1/metric_configurations/1'). + it { is_expected.to route(:put, '/mezuro_configurations/1/metric_configurations/1'). to(controller: :metric_configurations, action: :update, mezuro_configuration_id: "1", id: "1") } - it { should route(:delete, '/mezuro_configurations/1/metric_configurations/1'). + it { is_expected.to route(:delete, '/mezuro_configurations/1/metric_configurations/1'). to(controller: :metric_configurations, action: :destroy, mezuro_configuration_id: "1", id: "1") } - it { should route(:get, '/mezuro_configurations/1/metric_configurations/choose_metric'). + it { is_expected.to route(:get, '/mezuro_configurations/1/metric_configurations/choose_metric'). to(controller: :metric_configurations, action: :choose_metric, mezuro_configuration_id: "1") } end end diff --git a/spec/routing/mezuro_configuration_routing_spec.rb b/spec/routing/mezuro_configuration_routing_spec.rb index 18d450d..a387e67 100644 --- a/spec/routing/mezuro_configuration_routing_spec.rb +++ b/spec/routing/mezuro_configuration_routing_spec.rb @@ -1,20 +1,20 @@ require "spec_helper" -describe MezuroConfigurationsController do +describe MezuroConfigurationsController, :type => :routing do describe "routing" do - it { should route(:get, '/mezuro_configurations/new'). + it { is_expected.to route(:get, '/mezuro_configurations/new'). to(controller: :mezuro_configurations, action: :new) } - it { should route(:get, '/mezuro_configurations'). + it { is_expected.to route(:get, '/mezuro_configurations'). to(controller: :mezuro_configurations, action: :index) } - it { should route(:post, '/mezuro_configurations'). + it { is_expected.to route(:post, '/mezuro_configurations'). to(controller: :mezuro_configurations, action: :create) } - it { should route(:get, '/mezuro_configurations/1'). + it { is_expected.to route(:get, '/mezuro_configurations/1'). to(controller: :mezuro_configurations, action: :show, id: "1") } - it { should route(:get, '/mezuro_configurations/1/edit'). + it { is_expected.to route(:get, '/mezuro_configurations/1/edit'). to(controller: :mezuro_configurations, action: :edit, id: "1") } - it { should route(:put, '/mezuro_configurations/1'). + it { is_expected.to route(:put, '/mezuro_configurations/1'). to(controller: :mezuro_configurations, action: :update, id: "1") } - it { should route(:delete, '/mezuro_configurations/1'). + it { is_expected.to route(:delete, '/mezuro_configurations/1'). to(controller: :mezuro_configurations, action: :destroy, id: "1") } end end diff --git a/spec/routing/mezuro_ranges_routing_spec.rb b/spec/routing/mezuro_ranges_routing_spec.rb index 6b605c2..67df3ef 100644 --- a/spec/routing/mezuro_ranges_routing_spec.rb +++ b/spec/routing/mezuro_ranges_routing_spec.rb @@ -1,20 +1,20 @@ require "spec_helper" -describe MezuroRangesController do +describe MezuroRangesController, :type => :routing do describe "routing" do - it { should route(:get, '/mezuro_configurations/1/metric_configurations/1/mezuro_ranges'). + it { is_expected.to route(:get, '/mezuro_configurations/1/metric_configurations/1/mezuro_ranges'). to(controller: :mezuro_ranges, action: :index, mezuro_configuration_id: "1", metric_configuration_id: "1") } - it { should route(:post, '/mezuro_configurations/1/metric_configurations/1/mezuro_ranges'). + it { is_expected.to route(:post, '/mezuro_configurations/1/metric_configurations/1/mezuro_ranges'). to(controller: :mezuro_ranges, action: :create, mezuro_configuration_id: "1", metric_configuration_id: "1") } - it { should route(:get, '/mezuro_configurations/1/metric_configurations/1/mezuro_ranges/1/edit'). + it { is_expected.to route(:get, '/mezuro_configurations/1/metric_configurations/1/mezuro_ranges/1/edit'). to(controller: :mezuro_ranges, action: :edit, mezuro_configuration_id: "1", metric_configuration_id: "1", id: "1") } - it { should route(:get, '/mezuro_configurations/1/metric_configurations/1/mezuro_ranges/1'). + it { is_expected.to route(:get, '/mezuro_configurations/1/metric_configurations/1/mezuro_ranges/1'). to(controller: :mezuro_ranges, action: :show, mezuro_configuration_id: "1", metric_configuration_id: "1", id: "1") } - it { should route(:delete, '/mezuro_configurations/1/metric_configurations/1/mezuro_ranges/1'). + it { is_expected.to route(:delete, '/mezuro_configurations/1/metric_configurations/1/mezuro_ranges/1'). to(controller: :mezuro_ranges, action: :destroy, mezuro_configuration_id: "1", metric_configuration_id: "1", id: "1") } - it { should route(:get, '/mezuro_configurations/1/metric_configurations/1/mezuro_ranges/new'). + it { is_expected.to route(:get, '/mezuro_configurations/1/metric_configurations/1/mezuro_ranges/new'). to(controller: :mezuro_ranges, action: :new, mezuro_configuration_id: "1", metric_configuration_id: "1") } - it { should route(:put, '/mezuro_configurations/1/metric_configurations/1/mezuro_ranges/1'). + it { is_expected.to route(:put, '/mezuro_configurations/1/metric_configurations/1/mezuro_ranges/1'). to(controller: :mezuro_ranges, action: :update, mezuro_configuration_id: "1", metric_configuration_id: "1", id: "1") } end end diff --git a/spec/routing/modules_routing_spec.rb b/spec/routing/modules_routing_spec.rb index 73fb978..3818c40 100644 --- a/spec/routing/modules_routing_spec.rb +++ b/spec/routing/modules_routing_spec.rb @@ -1,10 +1,10 @@ require "spec_helper" -describe ModulesController do +describe ModulesController, :type => :routing do describe "routing" do - it { should route(:post, '/modules/1/tree'). + it { is_expected.to route(:post, '/modules/1/tree'). to(controller: :modules, action: :load_module_tree, id: 1) } - it { should route(:post, '/modules/1/metric_history'). + it { is_expected.to route(:post, '/modules/1/metric_history'). to(controller: :modules, action: :metric_history, id: 1) } end end \ No newline at end of file diff --git a/spec/routing/project_routing_spec.rb b/spec/routing/project_routing_spec.rb index 07ad793..83a76cd 100644 --- a/spec/routing/project_routing_spec.rb +++ b/spec/routing/project_routing_spec.rb @@ -1,26 +1,26 @@ require "spec_helper" -describe ProjectsController do +describe ProjectsController, :type => :routing do describe "routing" do - it { should route(:get, '/projects/new'). + it { is_expected.to route(:get, '/projects/new'). to(controller: :projects, action: :new) } - it { should route(:get, '/projects'). + it { is_expected.to route(:get, '/projects'). to(controller: :projects, action: :index) } - it { should route(:post, '/projects'). + it { is_expected.to route(:post, '/projects'). to(controller: :projects, action: :create) } - it { should route(:get, '/projects/1'). + it { is_expected.to route(:get, '/projects/1'). to(controller: :projects, action: :show, id: "1") } - it { should route(:get, '/projects/1/edit'). + it { is_expected.to route(:get, '/projects/1/edit'). to(controller: :projects, action: :edit, id: "1") } - it { should route(:put, '/projects/1'). + it { is_expected.to route(:put, '/projects/1'). to(controller: :projects, action: :update, id: "1") } - it { should route(:delete, '/projects/1'). + it { is_expected.to route(:delete, '/projects/1'). to(controller: :projects, action: :destroy, id: "1") } end end \ No newline at end of file diff --git a/spec/routing/reading_groups_routing_spec.rb b/spec/routing/reading_groups_routing_spec.rb index 631aef0..c255978 100644 --- a/spec/routing/reading_groups_routing_spec.rb +++ b/spec/routing/reading_groups_routing_spec.rb @@ -1,26 +1,26 @@ require "spec_helper" -describe ReadingGroupsController do +describe ReadingGroupsController, :type => :routing do describe "routing" do - it { should route(:get, '/reading_groups/new'). + it { is_expected.to route(:get, '/reading_groups/new'). to(controller: :reading_groups, action: :new) } - it { should route(:get, '/reading_groups'). + it { is_expected.to route(:get, '/reading_groups'). to(controller: :reading_groups, action: :index) } - it { should route(:post, '/reading_groups'). + it { is_expected.to route(:post, '/reading_groups'). to(controller: :reading_groups, action: :create) } - it { should route(:get, '/reading_groups/1'). + it { is_expected.to route(:get, '/reading_groups/1'). to(controller: :reading_groups, action: :show, id: "1") } - it { should route(:get, '/reading_groups/1/edit'). + it { is_expected.to route(:get, '/reading_groups/1/edit'). to(controller: :reading_groups, action: :edit, id: "1") } - it { should route(:put, '/reading_groups/1'). + it { is_expected.to route(:put, '/reading_groups/1'). to(controller: :reading_groups, action: :update, id: "1") } - it { should route(:delete, '/reading_groups/1'). + it { is_expected.to route(:delete, '/reading_groups/1'). to(controller: :reading_groups, action: :destroy, id: "1") } end end diff --git a/spec/routing/readings_routing_spec.rb b/spec/routing/readings_routing_spec.rb index 6b4e012..e18315a 100644 --- a/spec/routing/readings_routing_spec.rb +++ b/spec/routing/readings_routing_spec.rb @@ -1,20 +1,20 @@ require "spec_helper" -describe ReadingsController do +describe ReadingsController, :type => :routing do describe "routing" do - it { should route(:post, '/reading_groups/1/readings'). + it { is_expected.to route(:post, '/reading_groups/1/readings'). to(controller: :readings, action: :create, reading_group_id: 1) } - it { should route(:get, '/reading_groups/1/readings/new'). + it { is_expected.to route(:get, '/reading_groups/1/readings/new'). to(controller: :readings, action: :new, reading_group_id: 1) } - it { should route(:get, '/reading_groups/1/readings/1/edit'). + it { is_expected.to route(:get, '/reading_groups/1/readings/1/edit'). to(controller: :readings, action: :edit, reading_group_id: 1, id: 1) } - it { should_not route(:get, '/reading_groups/1/readings/1'). + it { is_expected.not_to route(:get, '/reading_groups/1/readings/1'). to(controller: :readings, action: :show, reading_group_id: 1, id: 1) } - it { should route(:delete, '/reading_groups/1/readings/1'). + it { is_expected.to route(:delete, '/reading_groups/1/readings/1'). to(controller: :readings, action: :destroy, reading_group_id: 1, id: 1) } - it { should route(:put, '/reading_groups/1/readings/1'). + it { is_expected.to route(:put, '/reading_groups/1/readings/1'). to(controller: :readings, action: :update, reading_group_id: 1, id: 1) } - it { should_not route(:get, '/reading_groups/1/readings'). + it { is_expected.not_to route(:get, '/reading_groups/1/readings'). to(controller: :readings, action: :index, reading_group_id: 1) } end end diff --git a/spec/routing/repositories_routing_spec.rb b/spec/routing/repositories_routing_spec.rb index ee49f75..ecd5aed 100644 --- a/spec/routing/repositories_routing_spec.rb +++ b/spec/routing/repositories_routing_spec.rb @@ -1,26 +1,26 @@ require "spec_helper" -describe RepositoriesController do +describe RepositoriesController, :type => :routing do describe "routing" do - it { should route(:post, '/projects/1/repositories'). + it { is_expected.to route(:post, '/projects/1/repositories'). to(controller: :repositories, action: :create, project_id: 1) } - it { should route(:get, '/projects/1/repositories/new'). + it { is_expected.to route(:get, '/projects/1/repositories/new'). to(controller: :repositories, action: :new, project_id: 1) } - it { should route(:get, '/projects/1/repositories/1/edit'). + it { is_expected.to route(:get, '/projects/1/repositories/1/edit'). to(controller: :repositories, action: :edit, project_id: 1, id: 1) } - it { should route(:get, '/projects/1/repositories/1'). + it { is_expected.to route(:get, '/projects/1/repositories/1'). to(controller: :repositories, action: :show, project_id: 1, id: 1) } - it { should route(:get, '/projects/1/repositories/1/modules/1'). + it { is_expected.to route(:get, '/projects/1/repositories/1/modules/1'). to(controller: :repositories, action: :show, project_id: 1, module_result_id: 1, id: 1) } - it { should route(:delete, '/projects/1/repositories/1'). + it { is_expected.to route(:delete, '/projects/1/repositories/1'). to(controller: :repositories, action: :destroy, project_id: 1, id: 1) } - it { should route(:put, '/projects/1/repositories/1'). + it { is_expected.to route(:put, '/projects/1/repositories/1'). to(controller: :repositories, action: :update, project_id: 1, id: 1) } - it { should_not route(:get, '/projects/1/repositories'). + it { is_expected.not_to route(:get, '/projects/1/repositories'). to(controller: :repositories, action: :index, project_id: 1) } - it { should route(:post, '/projects/1/repositories/1/state'). + it { is_expected.to route(:post, '/projects/1/repositories/1/state'). to(controller: :repositories, action: :state, project_id: 1, id: 1) } - it { should route(:get, '/projects/1/repositories/1/process'). + it { is_expected.to route(:get, '/projects/1/repositories/1/process'). to(controller: :repositories, action: :process_repository, project_id: 1, id: 1) } end end diff --git a/spec/routing/user_routing_spec.rb b/spec/routing/user_routing_spec.rb index f77d485..51fcdc8 100644 --- a/spec/routing/user_routing_spec.rb +++ b/spec/routing/user_routing_spec.rb @@ -1,8 +1,8 @@ require "spec_helper" -describe UsersController do +describe UsersController, :type => :routing do describe "routing" do - it { should route(:get, '/users/1/projects'). + it { is_expected.to route(:get, '/users/1/projects'). to(controller: :users, action: :projects, user_id: 1) } end end \ No newline at end of file -- libgit2 0.21.2