diff --git a/spec/controllers/export_card_configurations_controller_spec.rb b/spec/controllers/export_card_configurations_controller_spec.rb index e97ac8efda..d179a564de 100644 --- a/spec/controllers/export_card_configurations_controller_spec.rb +++ b/spec/controllers/export_card_configurations_controller_spec.rb @@ -29,7 +29,7 @@ require File.dirname(__FILE__) + '/../shared_examples' describe ExportCardConfigurationsController do before do - @controller.stub(:require_admin) { true } + allow(@controller).to receive(:require_admin) { true } @default_config = FactoryGirl.create(:default_export_card_configuration) @custom_config = FactoryGirl.create(:export_card_configuration) @@ -86,8 +86,8 @@ describe ExportCardConfigurationsController do @params[:export_card_configuration] = { per_page: 4 } put 'update', @params - response.should redirect_to :action => 'index' - flash[:notice].should eql(I18n.t(:notice_successful_update)) + expect(response).to redirect_to :action => 'index' + expect(flash[:notice]).to eql(I18n.t(:notice_successful_update)) end it 'should not let you update a configuration with invalid per_page' do @@ -95,7 +95,7 @@ describe ExportCardConfigurationsController do @params[:export_card_configuration] = { per_page: 0} put 'update', @params - response.should render_template('edit') + expect(response).to render_template('edit') end it 'should not let you update a configuration with invalid page_size' do @@ -103,7 +103,7 @@ describe ExportCardConfigurationsController do @params[:export_card_configuration] = { page_size: "invalid"} put 'update', @params - response.should render_template('edit') + expect(response).to render_template('edit') end it 'should not let you update a configuration with invalid orientation' do @@ -111,7 +111,7 @@ describe ExportCardConfigurationsController do @params[:export_card_configuration] = { orientation: "invalid"} put 'update', @params - response.should render_template('edit') + expect(response).to render_template('edit') end it 'should not let you update a configuration with invalid rows yaml' do @@ -119,7 +119,7 @@ describe ExportCardConfigurationsController do @params[:export_card_configuration] = { rows: "asdf ',#\""} put 'update', @params - response.should render_template('edit') + expect(response).to render_template('edit') end end @@ -128,16 +128,16 @@ describe ExportCardConfigurationsController do @params[:id] = @custom_config.id delete 'destroy', @params - response.should redirect_to :action => 'index' - flash[:notice].should eql(I18n.t(:notice_successful_delete)) + expect(response).to redirect_to :action => 'index' + expect(flash[:notice]).to eql(I18n.t(:notice_successful_delete)) end it 'should not let you delete the default configuration' do @params[:id] = @default_config.id delete 'destroy', @params - response.should redirect_to :action => 'index' - flash[:notice].should eql(I18n.t(:error_can_not_delete_export_card_configuration)) + expect(response).to redirect_to :action => 'index' + expect(flash[:notice]).to eql(I18n.t(:error_can_not_delete_export_card_configuration)) end end @@ -146,8 +146,8 @@ describe ExportCardConfigurationsController do @params[:id] = @inactive_config.id post 'activate', @params - response.should redirect_to :action => 'index' - flash[:notice].should eql(I18n.t(:notice_export_card_configuration_activated)) + expect(response).to redirect_to :action => 'index' + expect(flash[:notice]).to eql(I18n.t(:notice_export_card_configuration_activated)) end end @@ -156,16 +156,16 @@ describe ExportCardConfigurationsController do @params[:id] = @active_config.id post 'deactivate', @params - response.should redirect_to :action => 'index' - flash[:notice].should eql(I18n.t(:notice_export_card_configuration_deactivated)) + expect(response).to redirect_to :action => 'index' + expect(flash[:notice]).to eql(I18n.t(:notice_export_card_configuration_deactivated)) end it 'should not let you de-activate the default configuration' do @params[:id] = @default_config.id post 'deactivate', @params - response.should redirect_to :action => 'index' - flash[:notice].should eql(I18n.t(:error_can_not_deactivate_export_card_configuration)) + expect(response).to redirect_to :action => 'index' + expect(flash[:notice]).to eql(I18n.t(:error_can_not_deactivate_export_card_configuration)) end end end diff --git a/spec/export_card/document_generator_spec.rb b/spec/export_card/document_generator_spec.rb index 31728160a9..5537563377 100644 --- a/spec/export_card/document_generator_spec.rb +++ b/spec/export_card/document_generator_spec.rb @@ -53,17 +53,17 @@ describe OpenProject::PdfExport::ExportCard::DocumentGenerator do it 'shows work package subject' do text_analysis = PDF::Inspector::Text.analyze(@generator.render) - text_analysis.strings.include?('Work package 1').should be_true + expect(text_analysis.strings.include?('Work package 1')).to be_truthy end it 'does not show non existent field label' do text_analysis = PDF::Inspector::Text.analyze(@generator.render) - text_analysis.strings.include?('Non existent:').should be_false + expect(text_analysis.strings.include?('Non existent:')).to be_falsey end it 'should be 1 page' do page_analysis = PDF::Inspector::Page.analyze(@generator.render) - page_analysis.pages.size.should == 1 + expect(page_analysis.pages.size).to eq(1) end end @@ -75,13 +75,13 @@ describe OpenProject::PdfExport::ExportCard::DocumentGenerator do it 'shows work package subject' do text = PDF::Inspector::Text.analyze(@generator.render) - text.strings.include?('Work package 1').should be_true - text.strings.include?('Work package 2').should be_true + expect(text.strings.include?('Work package 1')).to be_truthy + expect(text.strings.include?('Work package 2')).to be_truthy end it 'should be 2 pages' do page_analysis = PDF::Inspector::Page.analyze(@generator.render) - page_analysis.pages.size.should == 2 + expect(page_analysis.pages.size).to eq(2) end end diff --git a/spec/views/edit.html.erb_spec.rb b/spec/views/edit.html.erb_spec.rb index f781a07c29..e998119013 100644 --- a/spec/views/edit.html.erb_spec.rb +++ b/spec/views/edit.html.erb_spec.rb @@ -37,12 +37,12 @@ describe 'export_card_configurations/edit' do it 'shows edit export card configuration inputs' do render - rendered.should have_field("Name", with: config.name) - rendered.should have_field("Description", with: config.description) - rendered.should have_field("Per page", with: config.per_page.to_s) - rendered.should have_field("Page size", with: config.page_size) - rendered.should have_field("Orientation", with: config.orientation) - rendered.should have_field("Rows", with: config.rows) + expect(rendered).to have_field("Name", with: config.name) + expect(rendered).to have_field("Description", with: config.description) + expect(rendered).to have_field("Per page", with: config.per_page.to_s) + expect(rendered).to have_field("Page size", with: config.page_size) + expect(rendered).to have_field("Orientation", with: config.orientation) + expect(rendered).to have_field("Rows", with: config.rows) end end diff --git a/spec/views/index.html.erb_spec.rb b/spec/views/index.html.erb_spec.rb index e7a824ec20..15e6b893f8 100644 --- a/spec/views/index.html.erb_spec.rb +++ b/spec/views/index.html.erb_spec.rb @@ -39,8 +39,8 @@ describe 'export_card_configurations/index' do it 'shows export card configurations' do render - rendered.should have_selector("a", text: config1.name) - rendered.should have_selector("a", text: config2.name) + expect(rendered).to have_selector("a", text: config1.name) + expect(rendered).to have_selector("a", text: config2.name) end end diff --git a/spec/views/new.html.erb_spec.rb b/spec/views/new.html.erb_spec.rb index 13fd1bb619..0e465367d0 100644 --- a/spec/views/new.html.erb_spec.rb +++ b/spec/views/new.html.erb_spec.rb @@ -36,11 +36,11 @@ describe 'export_card_configurations/new' do it 'shows new export card configuration empty inputs' do render - rendered.should have_css("input#export_card_configuration_name") - rendered.should have_css("input#export_card_configuration_per_page") - rendered.should have_css("input#export_card_configuration_page_size") - rendered.should have_css("select#export_card_configuration_orientation") - rendered.should have_css("textarea#export_card_configuration_rows") + expect(rendered).to have_css("input#export_card_configuration_name") + expect(rendered).to have_css("input#export_card_configuration_per_page") + expect(rendered).to have_css("input#export_card_configuration_page_size") + expect(rendered).to have_css("select#export_card_configuration_orientation") + expect(rendered).to have_css("textarea#export_card_configuration_rows") end end