Convert specs to RSpec 2.99.0.beta2 syntax with Transpec

This conversion is done by Transpec 1.10.4 with the following command:
    transpec

* 402 conversions
    from: it { should ... }
      to: it { is_expected.to ... }

* 67 conversions
    from: be_true
      to: be_truthy

* 55 conversions
    from: be_false
      to: be_falsey

* 35 conversions
    from: it { should_not ... }
      to: it { is_expected.not_to ... }

* 20 conversions
    from: == expected
      to: eq(expected)

* 5 conversions
    from: obj.stub(:message)
      to: allow(obj).to receive(:message)

* 4 conversions
    from: =~ /pattern/
      to: match(/pattern/)

* 1 conversion
    from: obj.should_receive(:message)
      to: expect(obj).to receive(:message)

* 1 conversion
    from: Klass.any_instance.stub(:message)
      to: allow_any_instance_of(Klass).to receive(:message)

* 1 conversion
    from: after { example }
      to: after { |example| example }

* 1 conversion
    from: pending
      to: skip
pull/1461/head
Alex Coles 11 years ago
parent c9eb092cd7
commit 5cdc438c52
  1. 14
      spec/controllers/account_controller_spec.rb
  2. 2
      spec/controllers/api/v2/authentication_spec.rb
  3. 6
      spec/controllers/attachments_controller_spec.rb
  4. 32
      spec/controllers/auth_sources_controller_spec.rb
  5. 26
      spec/controllers/categories_controller_spec.rb
  6. 2
      spec/controllers/concerns/omniauth_login_spec.rb
  7. 4
      spec/controllers/ldap_auth_sources_controller_spec.rb
  8. 14
      spec/controllers/messages_controller_spec.rb
  9. 14
      spec/controllers/projects_controller_spec.rb
  10. 2
      spec/controllers/query_menu_items_controller_spec.rb
  11. 20
      spec/controllers/search_controller_spec.rb
  12. 14
      spec/controllers/statuses_controller_spec.rb
  13. 8
      spec/controllers/users_controller_spec.rb
  14. 22
      spec/controllers/versions_controller_spec.rb
  15. 8
      spec/controllers/wiki_menu_items_controller_spec.rb
  16. 8
      spec/controllers/work_packages/auto_completes_controller_spec.rb
  17. 44
      spec/controllers/work_packages/bulk_controller_spec.rb
  18. 6
      spec/controllers/work_packages/calendars_controller_spec.rb
  19. 4
      spec/controllers/work_packages/context_menus_controller_spec.rb
  20. 16
      spec/controllers/work_packages/moves_controller_spec.rb
  21. 12
      spec/controllers/work_packages/reports_controller_spec.rb
  22. 20
      spec/controllers/work_packages_controller_spec.rb
  23. 94
      spec/helpers/application_helper_spec.rb
  24. 12
      spec/helpers/search_helper_spec.rb
  25. 2
      spec/lib/acts_as_journalized/journaled_spec.rb
  26. 6
      spec/lib/acts_as_watchable/lib/acts_as_watchable/routes_spec.rb
  27. 2
      spec/lib/open_project/themes/default_theme_spec.rb
  28. 4
      spec/lib/open_project/themes/theme_spec.rb
  29. 70
      spec/mailers/user_mailer_spec.rb
  30. 4
      spec/models/activity/work_package_activity_provider_spec.rb
  31. 6
      spec/models/deleted_user_spec.rb
  32. 4
      spec/models/group_spec.rb
  33. 14
      spec/models/journal_manager_spec.rb
  34. 6
      spec/models/mail_handler_spec.rb
  35. 2
      spec/models/menu_item_spec.rb
  36. 30
      spec/models/project/copy_spec.rb
  37. 26
      spec/models/queries/work_packages/filter_spec.rb
  38. 10
      spec/models/query_spec.rb
  39. 6
      spec/models/setting_spec.rb
  40. 10
      spec/models/system_user_spec.rb
  41. 6
      spec/models/user_password_spec.rb
  42. 38
      spec/models/user_spec.rb
  43. 6
      spec/models/version_spec.rb
  44. 2
      spec/models/wiki_page_spec.rb
  45. 26
      spec/models/work_package/ask_before_destruction_spec.rb
  46. 8
      spec/models/work_package/work_package_action_mailer_spec.rb
  47. 28
      spec/models/work_package/work_package_acts_as_journalized_spec.rb
  48. 22
      spec/models/work_package/work_package_acts_as_watchable_spec.rb
  49. 34
      spec/models/work_package/work_package_copy_spec.rb
  50. 22
      spec/models/work_package/work_package_custom_fields_spec.rb
  51. 20
      spec/models/work_package/work_package_relations_spec.rb
  52. 8
      spec/models/work_package/work_package_scheduling_spec.rb
  53. 4
      spec/models/work_package/work_package_status_spec.rb
  54. 10
      spec/models/work_package/work_package_validations_spec.rb
  55. 100
      spec/models/work_package_spec.rb
  56. 6
      spec/spec_helper.rb
  57. 4
      spec/support/permission_specs.rb
  58. 4
      spec/views/api/v2/planning_element_type_colors/show_api_json_spec.rb
  59. 2
      spec/views/api/v2/planning_element_types/index_api_json_spec.rb
  60. 4
      spec/views/api/v2/planning_element_types/show_api_json_spec.rb
  61. 6
      spec/views/api/v2/planning_elements/index_api_json_spec.rb
  62. 8
      spec/views/api/v2/planning_elements/index_api_xml_spec.rb
  63. 34
      spec/views/api/v2/planning_elements/show_api_json_spec.rb
  64. 4
      spec/views/api/v2/project_associations/available_projects_api_json_spec.rb
  65. 4
      spec/views/api/v2/project_associations/show_api_json_spec.rb
  66. 10
      spec/views/api/v2/projects/index_api_json_spec.rb
  67. 16
      spec/views/api/v2/projects/level_list_api_json_spec.rb
  68. 20
      spec/views/api/v2/projects/show_api_json_spec.rb
  69. 4
      spec/views/api/v2/reported_project_statuses/show_api_json_spec.rb
  70. 4
      spec/views/api/v2/reportings/show_api_json_spec.rb
  71. 8
      spec/views/api/v2/users/index_api_json_spec.rb
  72. 4
      spec/views/api/v2/workflows/index_api_xml_spec.rb
  73. 2
      spec/views/users/edit.html.erb_spec.rb

@ -180,7 +180,7 @@ describe AccountController do
end
it 'is successful' do
should respond_with :success
is_expected.to respond_with :success
expect(response).to render_template :register
expect(assigns[:user]).not_to be_nil
end
@ -194,7 +194,7 @@ describe AccountController do
end
it 'redirects to home' do
should redirect_to('/') { home_url }
is_expected.to redirect_to('/') { home_url }
end
end
end
@ -215,9 +215,9 @@ describe AccountController do
end
it 'redirects to first_login page' do
should respond_with :redirect
is_expected.to respond_with :redirect
expect(assigns[:user]).not_to be_nil
should redirect_to(my_first_login_path)
is_expected.to redirect_to(my_first_login_path)
expect(User.last(:conditions => { :login => 'register' })).not_to be_nil
end
@ -243,7 +243,7 @@ describe AccountController do
end
it 'redirects to the login page' do
should redirect_to '/login'
is_expected.to redirect_to '/login'
end
it "doesn't activate the user but sends out a token instead" do
@ -310,7 +310,7 @@ describe AccountController do
end
it 'redirects to home' do
should redirect_to('/') { home_url }
is_expected.to redirect_to('/') { home_url }
end
end
@ -328,7 +328,7 @@ describe AccountController do
end
it 'registers the user on-the-fly' do
should respond_with :success
is_expected.to respond_with :success
expect(response).to render_template :register
post :register, :user => { firstname: 'Foo',

@ -62,7 +62,7 @@ describe Api::V2::AuthenticationController do
it { expect(subject).not_to be_nil }
it { expect(subject.authorized).to be_true }
it { expect(subject.authorized).to be_truthy }
it { expect(subject.authenticated_user_id).to eq(user.id) }
end

@ -49,15 +49,15 @@ describe AttachmentsController do
shared_examples_for :deleted do
subject { Attachment.find_by_id(attachment.id) }
it { should be_nil }
it { is_expected.to be_nil }
end
shared_examples_for :redirected do
subject { response }
it { should be_redirect }
it { is_expected.to be_redirect }
it { should redirect_to(redirect_path) }
it { is_expected.to redirect_to(redirect_path) }
end
context :work_package do

@ -41,8 +41,8 @@ describe AuthSourcesController do
end
it { expect(assigns(:auth_source)).to eq @auth_source }
it { should respond_with :success }
it { should render_template :index }
it { is_expected.to respond_with :success }
it { is_expected.to render_template :index }
end
describe "new" do
@ -51,8 +51,8 @@ describe AuthSourcesController do
end
it { expect(assigns(:auth_source)).not_to be_nil }
it { should respond_with :success }
it { should render_template :new }
it { is_expected.to respond_with :success }
it { is_expected.to render_template :new }
it "initializes a new AuthSource" do
expect(assigns(:auth_source).class).to eq(AuthSource)
@ -65,9 +65,9 @@ describe AuthSourcesController do
post :create, :auth_source => {:name => 'Test'}
end
it { should respond_with :redirect }
it { should redirect_to auth_sources_path }
it { should set_the_flash.to /success/i }
it { is_expected.to respond_with :redirect }
it { is_expected.to redirect_to auth_sources_path }
it { is_expected.to set_the_flash.to /success/i }
end
describe "edit" do
@ -77,8 +77,8 @@ describe AuthSourcesController do
end
it { expect(assigns(:auth_source)).to eq @auth_source }
it { should respond_with :success }
it { should render_template :edit }
it { is_expected.to respond_with :success }
it { is_expected.to render_template :edit }
end
describe "update" do
@ -87,9 +87,9 @@ describe AuthSourcesController do
post :update, id: @auth_source.id, auth_source: {name: 'TestUpdate'}
end
it { should respond_with :redirect }
it { should redirect_to auth_sources_path }
it { should set_the_flash.to /update/i }
it { is_expected.to respond_with :redirect }
it { is_expected.to redirect_to auth_sources_path }
it { is_expected.to set_the_flash.to /update/i }
end
describe "destroy" do
@ -102,9 +102,9 @@ describe AuthSourcesController do
post :destroy, id: @auth_source.id
end
it { should respond_with :redirect }
it { should redirect_to auth_sources_path }
it { should set_the_flash.to /deletion/i }
it { is_expected.to respond_with :redirect }
it { is_expected.to redirect_to auth_sources_path }
it { is_expected.to set_the_flash.to /deletion/i }
end
context "with users" do
@ -113,7 +113,7 @@ describe AuthSourcesController do
post :destroy, id: @auth_source.id
end
it { should respond_with :redirect }
it { is_expected.to respond_with :redirect }
it "doesn not destroy the AuthSource" do
expect(AuthSource.find(@auth_source.id)).not_to be_nil
end

@ -47,9 +47,9 @@ describe CategoriesController do
shared_examples_for :redirect do
subject { response }
it { should be_redirect }
it { is_expected.to be_redirect }
it { should redirect_to("/projects/#{project.identifier}/settings/categories") }
it { is_expected.to redirect_to("/projects/#{project.identifier}/settings/categories") }
end
describe :new do
@ -57,9 +57,9 @@ describe CategoriesController do
subject { response }
it { should be_success }
it { is_expected.to be_success }
it { should render_template('new') }
it { is_expected.to render_template('new') }
end
describe :create do
@ -94,12 +94,12 @@ describe CategoriesController do
subject { Category.find(category.id).name }
it { should eq(name) }
it { is_expected.to eq(name) }
describe :category_count do
subject { Category.count }
it { should eq(1) }
it { is_expected.to eq(1) }
end
it_behaves_like :redirect
@ -112,7 +112,7 @@ describe CategoriesController do
subject { response.response_code }
it { should eq(404) }
it { is_expected.to eq(404) }
end
end
@ -128,7 +128,7 @@ describe CategoriesController do
shared_examples_for :delete do
subject { Category.find_by_id(category.id) }
it { should be_nil }
it { is_expected.to be_nil }
end
context "unused" do
@ -148,14 +148,14 @@ describe CategoriesController do
subject { Category.find_by_id(category.id) }
it { should_not be_nil }
it { is_expected.not_to be_nil }
describe :response do
subject { response }
it { should be_success }
it { is_expected.to be_success }
it { should render_template('destroy') }
it { is_expected.to render_template('destroy') }
end
end
@ -173,7 +173,7 @@ describe CategoriesController do
subject { work_package.reload.category_id }
it { should eq(target.id) }
it { is_expected.to eq(target.id) }
it_behaves_like :delete
@ -191,7 +191,7 @@ describe CategoriesController do
subject { work_package.reload.category_id }
it { should be_nil }
it { is_expected.to be_nil }
it_behaves_like :delete

@ -210,7 +210,7 @@ describe AccountController do
end
it 'should not sign in the user' do
expect(controller.send(:current_user).logged?).to be_false
expect(controller.send(:current_user).logged?).to be_falsey
end
it 'does not set registration information in the session' do

@ -41,8 +41,8 @@ describe LdapAuthSourcesController do
end
it { expect(assigns(:auth_source)).not_to be_nil }
it { should respond_with :success }
it { should render_template :new }
it { is_expected.to respond_with :success }
it { is_expected.to render_template :new }
it "initializes a new AuthSource" do
expect(assigns(:auth_source).class).to eq LdapAuthSource

@ -65,7 +65,7 @@ describe MessagesController do
subject { Message.last.journals.last.changed_data }
it { should have_key attachment_id }
it { is_expected.to have_key attachment_id }
it { expect(subject[attachment_id]).to eq([nil, filename]) }
end
@ -114,13 +114,13 @@ describe MessagesController do
describe :view do
subject { response }
it { should render_template('messages/edit', formats: ["html"]) }
it { is_expected.to render_template('messages/edit', formats: ["html"]) }
end
describe :error do
subject { assigns(:message).errors.messages }
it { should have_key(:attachments) }
it { is_expected.to have_key(:attachments) }
it { subject[:attachments] =~ /too long/ }
end
@ -136,13 +136,13 @@ describe MessagesController do
describe :key do
subject { message.journals.last.changed_data }
it { should have_key attachment_id }
it { is_expected.to have_key attachment_id }
end
describe :value do
subject { message.journals.last.changed_data[attachment_id].last }
it { should eq(filename) }
it { is_expected.to eq(filename) }
end
end
end
@ -169,13 +169,13 @@ describe MessagesController do
describe :key do
subject { message.journals.last.changed_data }
it { should have_key attachment_id }
it { is_expected.to have_key attachment_id }
end
describe :value do
subject { message.journals.last.changed_data[attachment_id].first }
it { should eq(filename) }
it { is_expected.to eq(filename) }
end
end
end

@ -280,7 +280,7 @@ describe ProjectsController do
shared_examples_for :redirect do
subject { response }
it { should be_redirect }
it { is_expected.to be_redirect }
end
before { allow(User).to receive(:current).and_return user }
@ -298,7 +298,7 @@ describe ProjectsController do
subject { flash[:notice].last }
it { should match(regex) }
it { is_expected.to match(regex) }
end
context "no type missing" do
@ -331,13 +331,13 @@ describe ProjectsController do
subject { flash[:error] }
it { should =~ regex }
it { is_expected.to match(regex) }
it { should =~ Regexp.new(type_standard.name) }
it { is_expected.to match(Regexp.new(type_standard.name)) }
it { should =~ Regexp.new(type_bug.name) }
it { is_expected.to match(Regexp.new(type_bug.name)) }
it { should =~ Regexp.new(type_feature.name) }
it { is_expected.to match(Regexp.new(type_feature.name)) }
end
end
@ -351,7 +351,7 @@ describe ProjectsController do
subject { flash[:notice].all? {|n| regex.match(n).nil? } }
it { should be_false }
it { is_expected.to be_falsey }
end
end
end

@ -59,7 +59,7 @@ describe QueryMenuItemsController do
it 'destroys the query_menu_item' do
delete :destroy, id: query_menu_item, project_id: project, query_id: public_query
expect(MenuItems::QueryMenuItem.exists?(query_menu_item.id)).to be_false
expect(MenuItems::QueryMenuItem.exists?(query_menu_item.id)).to be_falsey
end
end
end

@ -57,7 +57,7 @@ describe SearchController do
subject { get :index, q: "##{work_package.id}" }
it { should redirect_to work_package }
it { is_expected.to redirect_to work_package }
end
end
end
@ -119,7 +119,7 @@ describe SearchController do
describe 'second note predecessor' do
subject { note_2.send :predecessor }
it { should eq note_1 }
it { is_expected.to eq note_1 }
it { expect(note_1.data).to_not be nil }
it { expect(subject.data).to_not be nil }
end
@ -161,24 +161,24 @@ describe SearchController do
context 'with one token' do
let(:query) { 'word' }
it { should eq %w(word) }
it { is_expected.to eq %w(word) }
context 'with double quotes' do
let(:query) { '"hello world"' }
it { should eq ['hello world'] }
it { is_expected.to eq ['hello world'] }
end
end
context 'with multiple tokens' do
let(:query) { 'hello world something-hyphenated' }
it { should eq %w(hello world something-hyphenated) }
it { is_expected.to eq %w(hello world something-hyphenated) }
context 'with double quotes' do
let(:query) { 'hello "fallen world" something-hyphenated' }
it { should eq ['hello', 'fallen world', 'something-hyphenated'] }
it { is_expected.to eq ['hello', 'fallen world', 'something-hyphenated'] }
end
end
end
@ -189,13 +189,13 @@ describe SearchController do
context 'with normal query' do
let(:query) { 'lorem' }
it { should be nil }
it { is_expected.to be nil }
end
context 'with work package reference' do
let(:query) { '#4123' }
it { should_not be nil }
it { is_expected.not_to be nil }
describe 'captures' do
let!(:check_block) { Proc.new { |id| @work_package_id = id } }
@ -204,7 +204,7 @@ describe SearchController do
# NOTE: this is how it is favored to do in RSpec3
# expect(check_block).to receive :call
# but we have only RSpec2 here, so:
check_block.should_receive :call
expect(check_block).to receive :call
@controller.send(:scan_work_package_reference, query, &check_block)
end
@ -218,7 +218,7 @@ describe SearchController do
context 'and with additional text' do
let(:query) { '#4123 and some text' }
it { should be nil }
it { is_expected.to be nil }
end
end
end

@ -37,23 +37,23 @@ describe StatusesController do
shared_examples_for :response do
subject { response }
it { should be_success }
it { is_expected.to be_success }
it { should render_template(template) }
it { is_expected.to render_template(template) }
end
shared_examples_for :redirect do
subject { response }
it { should be_redirect }
it { is_expected.to be_redirect }
it { should redirect_to({ action: :index }) }
it { is_expected.to redirect_to({ action: :index }) }
end
shared_examples_for :statuses do
subject { Status.find_by_name(name) }
it { should_not be_nil }
it { is_expected.not_to be_nil }
end
describe :index do
@ -146,7 +146,7 @@ describe StatusesController do
shared_examples_for :destroyed do
subject { Status.find_by_name(name) }
it { should be_nil }
it { is_expected.to be_nil }
end
context "unused" do
@ -179,7 +179,7 @@ describe StatusesController do
describe :update_work_package_done_ratio do
shared_examples_for :flash do
it { should set_the_flash.to(message) }
it { is_expected.to set_the_flash.to(message) }
end
context "with 'work_package_done_ratio' using 'field'" do

@ -373,17 +373,17 @@ describe UsersController do
it 'should be assigned their new values' do
user_from_db = User.find(user.id)
expect(user_from_db.admin).to be_false
expect(user_from_db.admin).to be_falsey
expect(user_from_db.firstname).to eql('Changed')
expect(user_from_db.login).to eql('changedlogin')
expect(user_from_db.mail_notification).to eql('only_assigned')
expect(user_from_db.force_password_change).to eql(true)
expect(user_from_db.pref[:hide_mail]).to be_true
expect(user_from_db.pref[:hide_mail]).to be_truthy
expect(user_from_db.pref[:comments_sorting]).to eql('desc')
end
it 'should not send an email' do
expect(ActionMailer::Base.deliveries.empty?).to be_true
expect(ActionMailer::Base.deliveries.empty?).to be_truthy
end
end
@ -412,7 +412,7 @@ describe UsersController do
end
expect(user.reload.auth_source).to be_nil
expect(user.check_password?('newpassPASS!')).to be_true
expect(user.check_password?('newpassPASS!')).to be_truthy
end
end
end

@ -56,13 +56,13 @@ describe VersionsController do
subject { assigns(:versions) }
it "shows Version with no date set" do
expect(subject.include?(version1)).to be_true
expect(subject.include?(version1)).to be_truthy
end
it "shows Version with date set" do
expect(subject.include?(version2)).to be_true
expect(subject.include?(version2)).to be_truthy
end
it "not shows Completed version" do
expect(subject.include?(version3)).to be_false
expect(subject.include?(version3)).to be_falsey
end
end
@ -77,13 +77,13 @@ describe VersionsController do
subject { assigns(:versions) }
it "shows Version with no date set" do
expect(subject.include?(version1)).to be_true
expect(subject.include?(version1)).to be_truthy
end
it "shows Version with date set" do
expect(subject.include?(version2)).to be_true
expect(subject.include?(version2)).to be_truthy
end
it "not shows Completed version" do
expect(subject.include?(version3)).to be_true
expect(subject.include?(version3)).to be_truthy
end
end
@ -102,13 +102,13 @@ describe VersionsController do
subject { assigns(:versions) }
it "shows Version with no date set" do
expect(subject.include?(version1)).to be_true
expect(subject.include?(version1)).to be_truthy
end
it "shows Version with date set" do
expect(subject.include?(version2)).to be_true
expect(subject.include?(version2)).to be_truthy
end
it "shows Version from sub project" do
expect(subject.include?(version4)).to be_true
expect(subject.include?(version4)).to be_truthy
end
end
end
@ -127,7 +127,7 @@ describe VersionsController do
it { assert_tag :tag => 'h2', :content => version2.name }
subject { assigns(:version) }
it { should == version2 }
it { is_expected.to eq(version2) }
end
describe "#create" do
@ -177,7 +177,7 @@ describe VersionsController do
post :create, :project_id => project.id, :version => {:name => harmful}, :format => :js
version = Version.last
expect(response.body.include?("lt;script>alert('pwned');</script>")).to be_true
expect(response.body.include?("lt;script>alert('pwned');</script>")).to be_truthy
end
end
end

@ -107,10 +107,10 @@ describe WikiMenuItemsController do
subject { assigns['possible_wiki_pages'] }
context 'when selecting a new wiki page to replace the current main menu item' do
it { should include wiki_page }
it { should include child_page }
it { should include another_wiki_page }
it { should include another_child_page }
it { is_expected.to include wiki_page }
it { is_expected.to include child_page }
it { is_expected.to include another_wiki_page }
it { is_expected.to include another_child_page }
end
end

@ -59,13 +59,13 @@ describe WorkPackages::AutoCompletesController do
shared_examples_for "successful response" do
subject { response }
it { should be_success }
it { is_expected.to be_success }
end
shared_examples_for "contains expected values" do
subject { assigns(:work_packages) }
it { should include(*expected_values) }
it { is_expected.to include(*expected_values) }
end
describe :work_packages do
@ -139,7 +139,7 @@ describe WorkPackages::AutoCompletesController do
subject { assigned.size }
it { should eq(assigned.uniq.size) }
it { is_expected.to eq(assigned.uniq.size) }
end
end
@ -210,7 +210,7 @@ describe WorkPackages::AutoCompletesController do
subject { assigns(:work_packages) }
it { should eq([]) }
it { is_expected.to eq([]) }
end
end
end

@ -98,9 +98,9 @@ describe WorkPackages::BulkController do
shared_examples_for :response do
subject { response }
it { should be_success }
it { is_expected.to be_success }
it { should render_template('edit') }
it { is_expected.to render_template('edit') }
end
context "same project" do
@ -175,9 +175,9 @@ describe WorkPackages::BulkController do
subject { response }
it { should be_redirect }
it { is_expected.to be_redirect }
it { should redirect_to(url) }
it { is_expected.to redirect_to(url) }
end
context "of host" do
@ -187,9 +187,9 @@ describe WorkPackages::BulkController do
subject { response }
it { should be_redirect }
it { is_expected.to be_redirect }
it { should redirect_to(project_work_packages_path(project_1)) }
it { is_expected.to redirect_to(project_work_packages_path(project_1)) }
end
end
@ -263,7 +263,7 @@ describe WorkPackages::BulkController do
describe :priority do
subject { WorkPackage.find_all_by_priority_id(priority.id).collect(&:id) }
it { should match_array(work_package_ids) }
it { is_expected.to match_array(work_package_ids) }
end
describe :custom_fields do
@ -273,7 +273,7 @@ describe WorkPackages::BulkController do
.collect {|w| w.custom_value_for(custom_field_1.id).value }
.uniq }
it { should match_array(result) }
it { is_expected.to match_array(result) }
end
describe :journal do
@ -284,7 +284,7 @@ describe WorkPackages::BulkController do
.collect {|w| w.last_journal.notes }
.uniq }
it { should match_array(result) }
it { is_expected.to match_array(result) }
end
describe :details do
@ -294,7 +294,7 @@ describe WorkPackages::BulkController do
.collect {|w| w.last_journal.details.size }
.uniq }
it { should match_array(result) }
it { is_expected.to match_array(result) }
end
end
end
@ -332,7 +332,7 @@ describe WorkPackages::BulkController do
describe :journal do
subject { Journal.count }
it { should eq(work_package_ids.count) }
it { is_expected.to eq(work_package_ids.count) }
end
end
end
@ -346,7 +346,7 @@ describe WorkPackages::BulkController do
subject { work_packages.collect {|w| w.assigned_to_id }.uniq }
it { should match_array [group_id] }
it { is_expected.to match_array [group_id] }
end
describe :responsible do
@ -356,7 +356,7 @@ describe WorkPackages::BulkController do
subject { work_packages.collect {|w| w.responsible_id }.uniq }
it { should match_array [responsible_id] }
it { is_expected.to match_array [responsible_id] }
end
describe :status do
@ -377,7 +377,7 @@ describe WorkPackages::BulkController do
subject { work_packages.collect(&:status_id).uniq }
it { should match_array [closed_status.id] }
it { is_expected.to match_array [closed_status.id] }
end
describe :parent do
@ -393,7 +393,7 @@ describe WorkPackages::BulkController do
subject { work_packages.collect(&:parent_id).uniq }
it { should match_array [parent.id] }
it { is_expected.to match_array [parent.id] }
end
describe :custom_fields do
@ -408,7 +408,7 @@ describe WorkPackages::BulkController do
subject { work_packages.collect {|w| w.custom_value_for(custom_field_1.id).value }
.uniq }
it { should match_array [result] }
it { is_expected.to match_array [result] }
end
describe :unassign do
@ -420,7 +420,7 @@ describe WorkPackages::BulkController do
subject { work_packages.collect(&:assigned_to_id).uniq }
it { should match_array [nil] }
it { is_expected.to match_array [nil] }
end
describe :delete_responsible do
@ -432,7 +432,7 @@ describe WorkPackages::BulkController do
subject { work_packages.collect(&:responsible_id).uniq }
it { should match_array [nil] }
it { is_expected.to match_array [nil] }
end
describe :version do
@ -453,19 +453,19 @@ describe WorkPackages::BulkController do
subject { response }
it { should be_redirect }
it { is_expected.to be_redirect }
describe :work_package do
describe :fixed_version do
subject { work_packages.collect(&:fixed_version_id).uniq }
it { should match_array [version.id] }
it { is_expected.to match_array [version.id] }
end
describe :project do
subject { work_packages.collect(&:project_id).uniq }
it { should_not match_array [subproject.id] }
it { is_expected.not_to match_array [subproject.id] }
end
end
end
@ -481,7 +481,7 @@ describe WorkPackages::BulkController do
describe :fixed_version do
subject { work_packages.collect(&:fixed_version_id).uniq }
it { should == [nil] }
it { is_expected.to eq([nil]) }
end
end
end

@ -44,14 +44,14 @@ describe WorkPackages::CalendarsController do
shared_examples_for "calendar#index" do
subject { response }
it { should be_success }
it { is_expected.to be_success }
it { should render_template('calendar') }
it { is_expected.to render_template('calendar') }
context :assigns do
subject { assigns(:calendar) }
it { should be_true }
it { is_expected.to be_truthy }
end
end

@ -77,9 +77,9 @@ describe WorkPackages::ContextMenusController do
subject { response }
it { should be_success }
it { is_expected.to be_success }
it { should render_template('context_menu') }
it { is_expected.to render_template('context_menu') }
end
shared_examples_for :edit do

@ -133,8 +133,8 @@ describe WorkPackages::MovesController do
end
it "redirects to the project's work packages page" do
should be_redirect
should redirect_to(project_work_packages_path(project))
is_expected.to be_redirect
is_expected.to redirect_to(project_work_packages_path(project))
end
end
@ -153,8 +153,8 @@ describe WorkPackages::MovesController do
end
it "redirects to the work package page" do
should be_redirect
should redirect_to(work_package_path(work_package))
is_expected.to be_redirect
is_expected.to redirect_to(work_package_path(work_package))
end
end
end
@ -267,7 +267,7 @@ describe WorkPackages::MovesController do
it "redirects to the work package copy" do
copy = WorkPackage.first(:order => 'id desc')
should redirect_to(work_package_path(copy))
is_expected.to redirect_to(work_package_path(copy))
end
end
@ -393,7 +393,7 @@ describe WorkPackages::MovesController do
end
before do
User.stub(:current).and_return(current_user)
allow(User).to receive(:current).and_return(current_user)
def self.copy_child_work_package
post :create,
@ -407,7 +407,7 @@ describe WorkPackages::MovesController do
context "when cross_project_work_package_relations is disabled" do
before do
Setting.stub(:cross_project_work_package_relations?).and_return(false)
allow(Setting).to receive(:cross_project_work_package_relations?).and_return(false)
copy_child_work_package
end
@ -419,7 +419,7 @@ describe WorkPackages::MovesController do
context "when cross_project_work_package_relations is enabled" do
before do
Setting.stub(:cross_project_work_package_relations?).and_return(true)
allow(Setting).to receive(:cross_project_work_package_relations?).and_return(true)
copy_child_work_package
end

@ -65,9 +65,9 @@ describe WorkPackages::ReportsController do
subject { response }
it { should be_success }
it { is_expected.to be_success }
it { should render_template('report') }
it { is_expected.to render_template('report') }
it { assigns :work_packages_by_type }
@ -90,9 +90,9 @@ describe WorkPackages::ReportsController do
subject { response }
it { should be_success }
it { is_expected.to be_success }
it { should render_template('report_details') }
it { is_expected.to render_template('report_details') }
it { assigns :field }
@ -156,9 +156,9 @@ describe WorkPackages::ReportsController do
subject { response }
it { should be_redirect }
it { is_expected.to be_redirect }
it { should redirect_to(report_project_work_packages_path(project.identifier)) }
it { is_expected.to redirect_to(report_project_work_packages_path(project.identifier)) }
end
end
end

@ -301,7 +301,7 @@ describe WorkPackagesController do
describe 'index with a broken project reference' do
before { get('index', :project_id => 'project_that_doesnt_exist') }
it { should respond_with :not_found }
it { is_expected.to respond_with :not_found }
end
@ -858,8 +858,8 @@ describe WorkPackagesController do
context "description" do
subject { get :quoted, id: planning_element.id }
it { should be_success }
it { should render_template('edit') }
it { is_expected.to be_success }
it { is_expected.to render_template('edit') }
end
context "journal" do
@ -867,8 +867,8 @@ describe WorkPackagesController do
subject { get :quoted, id: planning_element.id, journal_id: journal_id }
it { should be_success }
it { should render_template('edit') }
it { is_expected.to be_success }
it { is_expected.to render_template('edit') }
end
end
end
@ -931,7 +931,7 @@ describe WorkPackagesController do
subject { new_work_package.journals.last.changed_data }
it { should have_key attachment_id }
it { is_expected.to have_key attachment_id }
it { expect(subject[attachment_id]).to eq([nil, filename]) }
end
@ -949,13 +949,13 @@ describe WorkPackagesController do
describe :view do
subject { response }
it { should render_template('work_packages/new', formats: ["html"]) }
it { is_expected.to render_template('work_packages/new', formats: ["html"]) }
end
describe :error do
subject { new_work_package.errors.messages }
it { should have_key(:attachments) }
it { is_expected.to have_key(:attachments) }
it { subject[:attachments] =~ /too long/ }
end
@ -1000,13 +1000,13 @@ describe WorkPackagesController do
describe :view do
subject { response }
it { should render_template('work_packages/edit', formats: ["html"]) }
it { is_expected.to render_template('work_packages/edit', formats: ["html"]) }
end
describe :error do
subject { work_package.errors.messages }
it { should have_key(:attachments) }
it { is_expected.to have_key(:attachments) }
it { subject[:attachments] =~ /too long/ }
end

@ -42,12 +42,12 @@ describe ApplicationHelper do
text = "Lorem ipsum dolor sit \namet, consetetur sadipscing elitr, sed diam nonumy eirmod\r tempor invidunt"
text_html = "Lorem ipsum dolor sit <br />amet, consetetur sadipscing elitr, sed diam nonumy eirmod<br /> tempor invidunt"
expect(format_activity_description(text)).to eq(text_html)
expect(format_activity_description(text).html_safe?).to be_true
expect(format_activity_description(text).html_safe?).to be_truthy
end
it "escapes potentially harmful code" do
text = "Lorem ipsum dolor <script>alert('pwnd');</script> tempor invidunt"
expect(format_activity_description(text).include?("lt;script&gt;alert(&#x27;pwnd&#x27;);&lt;/script&gt;")).to be_true
expect(format_activity_description(text).include?("lt;script&gt;alert(&#x27;pwnd&#x27;);&lt;/script&gt;")).to be_truthy
end
end
@ -66,8 +66,8 @@ describe ApplicationHelper do
OpenProject::Footer.add_content("openproject","footer")
end
it { expect(footer_content.include?(I18n.t(:text_powered_by, :link => link_to(OpenProject::Info.app_name, OpenProject::Info.url)))).to be_true }
it { expect(footer_content.include?("<span class=\"footer_openproject\">footer</span>")).to be_true }
it { expect(footer_content.include?(I18n.t(:text_powered_by, :link => link_to(OpenProject::Info.app_name, OpenProject::Info.url)))).to be_truthy }
it { expect(footer_content.include?("<span class=\"footer_openproject\">footer</span>")).to be_truthy }
end
context "proc as additional footer content" do
@ -76,7 +76,7 @@ describe ApplicationHelper do
OpenProject::Footer.add_content("openproject",Proc.new{Date.parse(Time.now.to_s)})
end
it { expect(footer_content.include?("<span class=\"footer_openproject\">#{Date.parse(Time.now.to_s)}</span>")).to be_true }
it { expect(footer_content.include?("<span class=\"footer_openproject\">#{Date.parse(Time.now.to_s)}</span>")).to be_truthy }
end
context "proc which returns nothing" do
@ -85,7 +85,7 @@ describe ApplicationHelper do
OpenProject::Footer.add_content("openproject",Proc.new{"footer" if false})
end
it { expect(footer_content.include?("<span class=\"footer_openproject\">")).to be_false }
it { expect(footer_content.include?("<span class=\"footer_openproject\">")).to be_falsey }
end
end
@ -114,9 +114,9 @@ describe ApplicationHelper do
subject { @response }
it { should match /href/ }
it { is_expected.to match /href/ }
it { should match /fancy_css_class/ }
it { is_expected.to match /fancy_css_class/ }
end
context "if user is unauthorized" do
@ -131,7 +131,7 @@ describe ApplicationHelper do
subject { @response }
it { should be_nil }
it { is_expected.to be_nil }
end
context "allow using the :controller and :action for the target link" do
@ -145,7 +145,7 @@ describe ApplicationHelper do
subject { @response }
it { should match /href/ }
it { is_expected.to match /href/ }
end
end
@ -198,31 +198,31 @@ describe ApplicationHelper do
context "Single link" do
subject { textilizable("r#{changeset1.revision}") }
it { should eq("<p>#{changeset_link}</p>") }
it { is_expected.to eq("<p>#{changeset_link}</p>") }
end
context "Single link with dot" do
subject { textilizable("r#{changeset1.revision}.") }
it { should eq("<p>#{changeset_link}.</p>") }
it { is_expected.to eq("<p>#{changeset_link}.</p>") }
end
context "Two links comma separated" do
subject { textilizable("r#{changeset1.revision}, r#{changeset2.revision}") }
it { should eq("<p>#{changeset_link}, #{changeset_link2}</p>") }
it { is_expected.to eq("<p>#{changeset_link}, #{changeset_link2}</p>") }
end
context "Single link comma separated without a space" do
subject { textilizable("r#{changeset1.revision},r#{changeset2.revision}") }
it { should eq("<p>#{changeset_link},#{changeset_link2}</p>") }
it { is_expected.to eq("<p>#{changeset_link},#{changeset_link2}</p>") }
end
context "Escaping" do
subject { textilizable("!r#{changeset1.id}") }
it { should eq("<p>r#{changeset1.id}</p>") }
it { is_expected.to eq("<p>r#{changeset1.id}</p>") }
end
end
@ -237,36 +237,36 @@ describe ApplicationHelper do
context "Link with version id" do
subject { textilizable("version##{version.id}") }
it { should eq("<p>#{version_link}</p>") }
it { is_expected.to eq("<p>#{version_link}</p>") }
end
context "Link with version" do
subject { textilizable("version:1.0") }
it { should eq("<p>#{version_link}</p>") }
it { is_expected.to eq("<p>#{version_link}</p>") }
end
context "Link with quoted version" do
subject { textilizable('version:"1.0"') }
it { should eq("<p>#{version_link}</p>") }
it { is_expected.to eq("<p>#{version_link}</p>") }
end
context "Escaping link with version id" do
subject { textilizable("!version##{version.id}") }
it { should eq("<p>version##{version.id}</p>") }
it { is_expected.to eq("<p>version##{version.id}</p>") }
end
context "Escaping link with version" do
subject { textilizable("!version:1.0") }
it { should eq("<p>version:1.0</p>") }
it { is_expected.to eq("<p>version:1.0</p>") }
end
context "Escaping link with quoted version" do
subject { textilizable('!version:"1.0"') }
it { should eq('<p>version:"1.0"</p>') }
it { is_expected.to eq('<p>version:"1.0"</p>') }
end
end
@ -284,13 +284,13 @@ describe ApplicationHelper do
context "Plain message" do
subject { textilizable("message##{message1.id}") }
it { should eq("<p>#{link_to(message1.subject, topic_path(message1), :class => 'message')}</p>") }
it { is_expected.to eq("<p>#{link_to(message1.subject, topic_path(message1), :class => 'message')}</p>") }
end
context "Message with parent" do
subject { textilizable("message##{message2.id}") }
it { should eq("<p>#{link_to(message2.subject, topic_path(message1, :anchor => "message-#{message2.id}", :r => message2.id), :class => 'message')}</p>") }
it { is_expected.to eq("<p>#{link_to(message2.subject, topic_path(message1, :anchor => "message-#{message2.id}", :r => message2.id), :class => 'message')}</p>") }
end
end
@ -302,19 +302,19 @@ describe ApplicationHelper do
context "Plain issue link" do
subject { textilizable("##{issue.id}, [##{issue.id}], (##{issue.id}) and ##{issue.id}.") }
it { should eq("<p>#{issue_link}, [#{issue_link}], (#{issue_link}) and #{issue_link}.</p>") }
it { is_expected.to eq("<p>#{issue_link}, [#{issue_link}], (#{issue_link}) and #{issue_link}.</p>") }
end
context "Plain issue link to non-existing element" do
subject { textilizable('#0123456789') }
it { should eq('<p>#0123456789</p>') }
it { is_expected.to eq('<p>#0123456789</p>') }
end
context "Escaping issue link" do
subject { textilizable("!##{issue.id}.") }
it { should eq("<p>##{issue.id}.</p>") }
it { is_expected.to eq("<p>##{issue.id}.</p>") }
end
context "Cyclic Description Links" do
@ -353,26 +353,26 @@ describe ApplicationHelper do
context "Plain project link" do
subject { textilizable("project##{subproject.id}") }
it { should eq("<p>#{link_to(subproject.name, project_url, :class => 'project')}</p>") }
it { is_expected.to eq("<p>#{link_to(subproject.name, project_url, :class => 'project')}</p>") }
end
context "Plain project link via identifier" do
subject { textilizable("project:#{subproject.identifier}") }
it { should eq("<p>#{link_to(subproject.name, project_url, :class => 'project')}</p>") }
it { is_expected.to eq("<p>#{link_to(subproject.name, project_url, :class => 'project')}</p>") }
end
context "Plain project link via name" do
subject { textilizable("project:\"#{subproject.name}\"") }
it { should eq("<p>#{link_to(subproject.name, project_url, :class => 'project')}</p>") }
it { is_expected.to eq("<p>#{link_to(subproject.name, project_url, :class => 'project')}</p>") }
end
end
context "Url links" do
subject { textilizable("http://foo.bar/FAQ#3") }
it { should eq('<p><a class="external" href="http://foo.bar/FAQ#3">http://foo.bar/FAQ#3</a></p>') }
it { is_expected.to eq('<p><a class="external" href="http://foo.bar/FAQ#3">http://foo.bar/FAQ#3</a></p>') }
end
context "Wiki links" do
@ -408,97 +408,97 @@ describe ApplicationHelper do
context "Plain wiki link" do
subject { textilizable('[[CookBook documentation]]') }
it { should eq("<p><a href=\"/projects/#{project.identifier}/wiki/CookBook_documentation\" class=\"wiki-page\">CookBook documentation</a></p>") }
it { is_expected.to eq("<p><a href=\"/projects/#{project.identifier}/wiki/CookBook_documentation\" class=\"wiki-page\">CookBook documentation</a></p>") }
end
context "Plain wiki page link" do
subject { textilizable('[[Another page|Page]]') }
it { should eq("<p><a href=\"/projects/#{project.identifier}/wiki/Another_page\" class=\"wiki-page\">Page</a></p>") }
it { is_expected.to eq("<p><a href=\"/projects/#{project.identifier}/wiki/Another_page\" class=\"wiki-page\">Page</a></p>") }
end
context "Wiki link with anchor" do
subject { textilizable('[[CookBook documentation#One-section]]') }
it { should eq("<p><a href=\"/projects/#{project.identifier}/wiki/CookBook_documentation#One-section\" class=\"wiki-page\">CookBook documentation</a></p>") }
it { is_expected.to eq("<p><a href=\"/projects/#{project.identifier}/wiki/CookBook_documentation#One-section\" class=\"wiki-page\">CookBook documentation</a></p>") }
end
context "Wiki page link with anchor" do
subject { textilizable('[[Another page#anchor|Page]]') }
it { should eq("<p><a href=\"/projects/#{project.identifier}/wiki/Another_page#anchor\" class=\"wiki-page\">Page</a></p>") }
it { is_expected.to eq("<p><a href=\"/projects/#{project.identifier}/wiki/Another_page#anchor\" class=\"wiki-page\">Page</a></p>") }
end
context "Wiki link to an unknown page" do
subject { textilizable('[[Unknown page]]') }
it { should eq("<p><a href=\"/projects/#{project.identifier}/wiki/Unknown_page\" class=\"wiki-page new\">Unknown page</a></p>") }
it { is_expected.to eq("<p><a href=\"/projects/#{project.identifier}/wiki/Unknown_page\" class=\"wiki-page new\">Unknown page</a></p>") }
end
context "Wiki page link to an unknown page" do
subject { textilizable('[[Unknown page|404]]') }
it { should eq("<p><a href=\"/projects/#{project.identifier}/wiki/Unknown_page\" class=\"wiki-page new\">404</a></p>") }
it { is_expected.to eq("<p><a href=\"/projects/#{project.identifier}/wiki/Unknown_page\" class=\"wiki-page new\">404</a></p>") }
end
context "Link to another project's wiki" do
subject { textilizable('[[onlinestore:]]') }
it { should eq("<p><a href=\"/projects/onlinestore/wiki\" class=\"wiki-page\">onlinestore</a></p>") }
it { is_expected.to eq("<p><a href=\"/projects/onlinestore/wiki\" class=\"wiki-page\">onlinestore</a></p>") }
end
context "Link to another project's wiki with label" do
subject { textilizable('[[onlinestore:|Wiki]]') }
it { should eq("<p><a href=\"/projects/onlinestore/wiki\" class=\"wiki-page\">Wiki</a></p>") }
it { is_expected.to eq("<p><a href=\"/projects/onlinestore/wiki\" class=\"wiki-page\">Wiki</a></p>") }
end
context "Link to another project's wiki page" do
subject { textilizable('[[onlinestore:Start page]]') }
it { should eq("<p><a href=\"/projects/onlinestore/wiki/Start_page\" class=\"wiki-page\">Start page</a></p>") }
it { is_expected.to eq("<p><a href=\"/projects/onlinestore/wiki/Start_page\" class=\"wiki-page\">Start page</a></p>") }
end
context "Link to another project's wiki page with label" do
subject { textilizable('[[onlinestore:Start page|Text]]') }
it { should eq("<p><a href=\"/projects/onlinestore/wiki/Start_page\" class=\"wiki-page\">Text</a></p>") }
it { is_expected.to eq("<p><a href=\"/projects/onlinestore/wiki/Start_page\" class=\"wiki-page\">Text</a></p>") }
end
context "Link to an unknown wiki page in another project" do
subject { textilizable('[[onlinestore:Unknown page]]') }
it { should eq("<p><a href=\"/projects/onlinestore/wiki/Unknown_page\" class=\"wiki-page new\">Unknown page</a></p>") }
it { is_expected.to eq("<p><a href=\"/projects/onlinestore/wiki/Unknown_page\" class=\"wiki-page new\">Unknown page</a></p>") }
end
context "Struck through link to wiki page" do
subject { textilizable('-[[Another page|Page]]-') }
it { should eql("<p><del><a href=\"/projects/#{project.identifier}/wiki/Another_page\" class=\"wiki-page\">Page</a></del></p>") }
it { is_expected.to eql("<p><del><a href=\"/projects/#{project.identifier}/wiki/Another_page\" class=\"wiki-page\">Page</a></del></p>") }
end
context "Named struck through link to wiki page" do
subject { textilizable('-[[Another page|Page]] link-') }
it { should eql("<p><del><a href=\"/projects/#{project.identifier}/wiki/Another_page\" class=\"wiki-page\">Page</a> link</del></p>") }
it { is_expected.to eql("<p><del><a href=\"/projects/#{project.identifier}/wiki/Another_page\" class=\"wiki-page\">Page</a> link</del></p>") }
end
context "Escaped link to wiki page" do
subject { textilizable('![[Another page|Page]]') }
it { should eql('<p>[[Another page|Page]]</p>') }
it { is_expected.to eql('<p>[[Another page|Page]]</p>') }
end
context "Link to wiki of non-existing project" do
subject { textilizable('[[unknowproject:Start]]') }
it { should eql('<p>[[unknowproject:Start]]</p>') }
it { is_expected.to eql('<p>[[unknowproject:Start]]</p>') }
end
context "Link to wiki page of non-existing project" do
subject { textilizable('[[unknowproject:Start|Page title]]') }
it { should eql('<p>[[unknowproject:Start|Page title]]</p>') }
it { is_expected.to eql('<p>[[unknowproject:Start|Page title]]</p>') }
end
end
@ -576,7 +576,7 @@ EXPECTED
subject { textilizable(raw).gsub(%r{[\r\n\t]}, '')}
it { should eql(expected.gsub(%r{[\r\n\t]}, ''))}
it { is_expected.to eql(expected.gsub(%r{[\r\n\t]}, ''))}
end
end

@ -61,7 +61,7 @@ describe 'search/index' do
let(:title) { 'This is a token.' }
let(:expected_title) { 'This is a <span class="highlight token-0">token</span>.' }
it { should eq expected_title }
it { is_expected.to eq expected_title }
end
context 'with multiple tokens' do
@ -69,7 +69,7 @@ describe 'search/index' do
let(:title) { 'This is a token and another token.' }
let(:expected_title) { 'This is a <span class="highlight token-0">token</span> and <span class="highlight token-1">another</span> <span class="highlight token-0">token</span>.' }
it { should eq expected_title }
it { is_expected.to eq expected_title }
end
context 'with huge content' do
@ -89,7 +89,7 @@ describe 'search/index' do
let(:title) { ('й' * 200) + ' token ' + ('й' * 200) }
let(:expected_title) { ('й' * 45) + ' ... ' + ('й' * 44) + ' <span class="highlight token-0">token</span> ' + ('й' * 44) + ' ... ' + ('й' * 45) }
it { should eq expected_title }
it { is_expected.to eq expected_title }
end
end
@ -104,7 +104,7 @@ describe 'search/index' do
let(:titles) { [first, second] }
let(:first_highlighted) { 'This is a <span class="highlight token-0">token</span>' }
it { should eq first_highlighted }
it { is_expected.to eq first_highlighted }
end
context 'when first is not matched' do
@ -113,7 +113,7 @@ describe 'search/index' do
let(:titles) { [first, second] }
let(:second_highlighted) { 'I have some <span class="highlight token-0">token</span> for you' }
it { should eq second_highlighted }
it { is_expected.to eq second_highlighted }
end
context 'when both first and second is not matched' do
@ -121,7 +121,7 @@ describe 'search/index' do
let(:second) { 'I have some book for you' }
let(:titles) { [first, second] }
it { should eq second }
it { is_expected.to eq second }
end
end
end

@ -128,7 +128,7 @@ describe "Journalized Objects" do
role.remove_permission! :edit_work_packages
end
it { should be_false }
it { is_expected.to be_falsey }
end
end
end

@ -43,7 +43,7 @@ describe OpenProject::Acts::Watchable::Routes do
let(:id) { "1" }
it "should be true" do
expect(OpenProject::Acts::Watchable::Routes.matches?(request)).to be_true
expect(OpenProject::Acts::Watchable::Routes.matches?(request)).to be_truthy
end
end
@ -51,7 +51,7 @@ describe OpenProject::Acts::Watchable::Routes do
let(:id) { "schmu" }
it "should be false" do
expect(OpenProject::Acts::Watchable::Routes.matches?(request)).to be_false
expect(OpenProject::Acts::Watchable::Routes.matches?(request)).to be_falsey
end
end
end
@ -70,7 +70,7 @@ describe OpenProject::Acts::Watchable::Routes do
let(:id) { "4" }
it "should be false" do
expect(OpenProject::Acts::Watchable::Routes.matches?(request)).to be_false
expect(OpenProject::Acts::Watchable::Routes.matches?(request)).to be_falsey
end
end
end

@ -101,7 +101,7 @@ module OpenProject
end
it 'is false' do
expect(theme.image_overridden?('theme_spec.rb')).to be_false
expect(theme.image_overridden?('theme_spec.rb')).to be_falsey
end
end
end

@ -202,11 +202,11 @@ module OpenProject
end
it 'is overritten if the theme redefines it' do
expect(theme.image_overridden?('theme_spec.rb')).to be_true
expect(theme.image_overridden?('theme_spec.rb')).to be_truthy
end
it "is not overritten if the theme doesn't redefine it" do
expect(theme.image_overridden?('missing.rb')).to be_false
expect(theme.image_overridden?('missing.rb')).to be_falsey
end
end

@ -57,7 +57,7 @@ describe UserMailer do
# the name method uses a format setting to determine how to concatenate first name
# and last name whereby an unescaped comma will lead to have two email addresses
# defined instead of one (['Bobbi', 'bob.bobbi@example.com'] vs. ['bob.bobbi@example.com'])
test_user.stub(:name).and_return('Bobbi, Bob')
allow(test_user).to receive(:name).and_return('Bobbi, Bob')
end
it 'escapes the name attribute properly' do
@ -152,7 +152,7 @@ describe UserMailer do
end
it 'displays changed done ratio' do
should match("% done changed from 40 to 100")
is_expected.to match("% done changed from 40 to 100")
end
end
@ -162,7 +162,7 @@ describe UserMailer do
end
it 'displays new done ratio' do
should match("% done changed from 0 to 100")
is_expected.to match("% done changed from 0 to 100")
end
end
@ -172,7 +172,7 @@ describe UserMailer do
end
it 'displays deleted done ratio' do
should match("% done changed from 50 to 0")
is_expected.to match("% done changed from 50 to 0")
end
end
end
@ -184,11 +184,11 @@ describe UserMailer do
end
it 'old date should be formatted' do
should match("01/01/2010")
is_expected.to match("01/01/2010")
end
it 'new date should be formatted' do
should match("01/31/2010")
is_expected.to match("01/31/2010")
end
end
end
@ -200,11 +200,11 @@ describe UserMailer do
end
it 'old date should be formatted' do
should match("01/01/2010")
is_expected.to match("01/01/2010")
end
it 'new date should be formatted' do
should match("01/31/2010")
is_expected.to match("01/31/2010")
end
end
end
@ -218,11 +218,11 @@ describe UserMailer do
end
it "shows the old project's name" do
should match(project_1.name)
is_expected.to match(project_1.name)
end
it "shows the new project's name" do
should match(project_2.name)
is_expected.to match(project_2.name)
end
end
@ -235,11 +235,11 @@ describe UserMailer do
end
it "shows the old status' name" do
should match(status_1.name)
is_expected.to match(status_1.name)
end
it "shows the new status' name" do
should match(status_2.name)
is_expected.to match(status_2.name)
end
end
@ -252,11 +252,11 @@ describe UserMailer do
end
it "shows the old type's name" do
should match(type_1.name)
is_expected.to match(type_1.name)
end
it "shows the new type's name" do
should match(type_2.name)
is_expected.to match(type_2.name)
end
end
@ -269,11 +269,11 @@ describe UserMailer do
end
it "shows the old assignee's name" do
should match(assignee_1.name)
is_expected.to match(assignee_1.name)
end
it "shows the new assignee's name" do
should match(assignee_2.name)
is_expected.to match(assignee_2.name)
end
end
@ -286,11 +286,11 @@ describe UserMailer do
end
it "shows the old priority's name" do
should match(priority_1.name)
is_expected.to match(priority_1.name)
end
it "shows the new priority's name" do
should match(priority_2.name)
is_expected.to match(priority_2.name)
end
end
@ -303,11 +303,11 @@ describe UserMailer do
end
it "shows the old category's name" do
should match(category_1.name)
is_expected.to match(category_1.name)
end
it "shows the new category's name" do
should match(category_2.name)
is_expected.to match(category_2.name)
end
end
@ -320,11 +320,11 @@ describe UserMailer do
end
it "shows the old version's name" do
should match(version_1.name)
is_expected.to match(version_1.name)
end
it "shows the new version's name" do
should match(version_2.name)
is_expected.to match(version_2.name)
end
end
@ -337,11 +337,11 @@ describe UserMailer do
end
it "shows the old estimated hours" do
should match('%.2f' % estimated_hours_1)
is_expected.to match('%.2f' % estimated_hours_1)
end
it "shows the new estimated hours" do
should match('%.2f' % estimated_hours_2)
is_expected.to match('%.2f' % estimated_hours_2)
end
end
@ -356,11 +356,11 @@ describe UserMailer do
end
it "shows the old custom field value" do
should match(expected_text_1)
is_expected.to match(expected_text_1)
end
it "shows the new custom field value" do
should match(expected_text_2)
is_expected.to match(expected_text_2)
end
end
@ -373,15 +373,15 @@ describe UserMailer do
end
it "shows the attachment's filename" do
should match(attachment.filename)
is_expected.to match(attachment.filename)
end
it "shows status 'added'" do
should match('added')
is_expected.to match('added')
end
it "shows no status 'deleted'" do
should_not match('deleted')
is_expected.not_to match('deleted')
end
end
@ -391,15 +391,15 @@ describe UserMailer do
end
it "shows the attachment's filename" do
should match(attachment.filename)
is_expected.to match(attachment.filename)
end
it "shows no status 'added'" do
should_not match('added')
is_expected.not_to match('added')
end
it "shows status 'deleted'" do
should match('deleted')
is_expected.to match('deleted')
end
end
end
@ -423,7 +423,7 @@ describe UserMailer do
end
it 'displays changed done ratio' do
should match(expected)
is_expected.to match(expected)
end
end
@ -435,7 +435,7 @@ describe UserMailer do
end
it 'displays new done ratio' do
should match(expected)
is_expected.to match(expected)
end
end
@ -447,7 +447,7 @@ describe UserMailer do
end
it 'displays deleted done ratio' do
should match(expected)
is_expected.to match(expected)
end
end
end

@ -50,7 +50,7 @@ describe Activity::WorkPackageActivityProvider do
context 'when a work package has been created' do
before { work_package.save! }
it { should == work_package_edit_event }
it { is_expected.to eq(work_package_edit_event) }
context 'and has been closed' do
before do
@ -60,7 +60,7 @@ describe Activity::WorkPackageActivityProvider do
work_package.save!
end
it { should == work_package_closed_event }
it { is_expected.to eq(work_package_closed_event) }
end
end
end

@ -36,7 +36,7 @@ describe DeletedUser do
let(:user) { DeletedUser.new }
describe :admin do
it { expect(user.admin).to be_false }
it { expect(user.admin).to be_falsey }
end
describe :logged? do
@ -60,7 +60,7 @@ describe DeletedUser do
end
describe :destroy do
it { expect(user.destroy).to be_false }
it { expect(user.destroy).to be_falsey }
end
describe :available_custom_fields do
@ -107,7 +107,7 @@ describe DeletedUser do
end
describe "WHEN no deleted user exists" do
it { expect(DeletedUser.first.is_a?(DeletedUser)).to be_true }
it { expect(DeletedUser.first.is_a?(DeletedUser)).to be_truthy }
it { expect(DeletedUser.first).not_to be_new_record }
end
end

@ -63,7 +63,7 @@ describe Group do
package.reload
expect(package.journals.all?{ |j| j.data.assigned_to_id == DeletedUser.first.id }).to be_true
expect(package.journals.all?{ |j| j.data.assigned_to_id == DeletedUser.first.id }).to be_truthy
end
end
end
@ -72,7 +72,7 @@ describe Group do
describe 'group with empty group name' do
let(:group) { FactoryGirl.build(:group, lastname: '') }
it { expect(group.valid?).to be_false }
it { expect(group.valid?).to be_falsey }
describe 'error message' do
before { group.valid? }

@ -43,7 +43,7 @@ describe JournalManager do
subject { JournalManager.changed? journable }
it { should be_false }
it { is_expected.to be_falsey }
end
context 'when old value is nil and changed value is an empty string' do
@ -52,7 +52,7 @@ describe JournalManager do
subject { JournalManager.changed? journable }
it { should be_false }
it { is_expected.to be_falsey }
end
context 'when changed value is nil and old value is an empty string' do
@ -61,7 +61,7 @@ describe JournalManager do
subject { JournalManager.changed? journable }
it { should be_false }
it { is_expected.to be_falsey }
end
context 'when changed value has a value and old value is an empty string' do
@ -70,7 +70,7 @@ describe JournalManager do
subject { JournalManager.changed? journable }
it { should be_true }
it { is_expected.to be_truthy }
end
context 'when changed value has a value and old value is nil' do
@ -79,7 +79,7 @@ describe JournalManager do
subject { JournalManager.changed? journable }
it { should be_true }
it { is_expected.to be_truthy }
end
context 'when changed value is nil and old value was some text' do
@ -88,7 +88,7 @@ describe JournalManager do
subject { JournalManager.changed? journable }
it { should be_true }
it { is_expected.to be_truthy }
end
context 'when changed value is an empty string and old value was some text' do
@ -97,7 +97,7 @@ describe JournalManager do
subject { JournalManager.changed? journable }
it { should be_true }
it { is_expected.to be_truthy }
end
end
end

@ -286,7 +286,7 @@ describe MailHandler do
expect do
work_package = submit_email('ticket_by_unknown_user.eml', {:issue => {:project => 'onlinestore'}, :unknown_user => 'create'})
work_package_created(work_package)
expect(work_package.author.active?).to be_true
expect(work_package.author.active?).to be_truthy
expect(work_package.author.mail).to eq('john.doe@somenet.foo')
expect(work_package.author.firstname).to eq('John')
expect(work_package.author.lastname).to eq('Doe')
@ -301,7 +301,7 @@ describe MailHandler do
# Can't log in here since randomly assigned password must be changed
found_user = User.find_by_login(login)
expect(work_package.author).to eq(found_user)
expect(found_user.check_password?(password)).to be_true
expect(found_user.check_password?(password)).to be_truthy
end.to change(User, :count).by(1)
end
@ -526,7 +526,7 @@ describe MailHandler do
end
def work_package_created(work_package)
expect(work_package.is_a?(WorkPackage)).to be_true
expect(work_package.is_a?(WorkPackage)).to be_truthy
expect(work_package).not_to be_new_record
work_package.reload
end

@ -66,7 +66,7 @@ describe MenuItem do
example 'all children when deleting the parent' do
menu_item.destroy
expect(MenuItem.exists?(child_item.id)).to be_false
expect(MenuItem.exists?(child_item.id)).to be_falsey
end
end
end

@ -65,7 +65,7 @@ describe Project::Copy do
describe :types do
subject { copy.types }
it { should == project.types }
it { is_expected.to eq(project.types) }
end
describe :work_package_custom_fields do
@ -79,7 +79,7 @@ describe Project::Copy do
subject { copy.work_package_custom_fields }
it { should == project.work_package_custom_fields }
it { is_expected.to eq(project.work_package_custom_fields) }
end
describe :is_public do
@ -239,7 +239,7 @@ describe Project::Copy do
subject { copy.timelines.count }
it { should == project.timelines.count }
it { is_expected.to eq(project.timelines.count) }
end
describe :copy_queries do
@ -252,7 +252,7 @@ describe Project::Copy do
subject { copy.queries.count }
it { should == project.queries.count }
it { is_expected.to eq(project.queries.count) }
end
describe :copy_members do
@ -267,7 +267,7 @@ describe Project::Copy do
subject { copy.members.count }
it { should == project.members.count }
it { is_expected.to eq(project.members.count) }
end
describe :with_group do
@ -280,7 +280,7 @@ describe Project::Copy do
subject { copy.principals.count }
it { should == project.principals.count }
it { is_expected.to eq(project.principals.count) }
end
end
@ -295,7 +295,7 @@ describe Project::Copy do
subject { copy.wiki }
it { should_not == nil && should.be_valid }
it { is_expected.not_to eq(nil) && is_expected.to.be_valid }
describe :copy_wiki_pages do
describe :dont_copy_wiki_page_without_content do
@ -308,7 +308,7 @@ describe Project::Copy do
subject { copy.wiki.pages.count }
it { should == 0 }
it { is_expected.to eq(0) }
end
describe :copy_wiki_page_with_content do
@ -321,7 +321,7 @@ describe Project::Copy do
subject { copy.wiki.pages.count }
it { should == project.wiki.pages.count }
it { is_expected.to eq(project.wiki.pages.count) }
end
end
describe :copy_wiki_menu_items do
@ -333,7 +333,7 @@ describe Project::Copy do
subject { copy.wiki.wiki_menu_items.count }
it { should == project.wiki.wiki_menu_items.count }
it { is_expected.to eq(project.wiki.wiki_menu_items.count) }
end
end
@ -347,7 +347,7 @@ describe Project::Copy do
subject { copy.boards.count }
it { should == project.boards.count }
it { is_expected.to eq(project.boards.count) }
end
describe :copy_versions do
@ -360,7 +360,7 @@ describe Project::Copy do
subject { copy.versions.count }
it { should == project.versions.count }
it { is_expected.to eq(project.versions.count) }
end
describe :copy_project_associations do
@ -376,7 +376,7 @@ describe Project::Copy do
subject { copy.send(:project_a_associations).count }
it { should == project.send(:project_a_associations).count }
it { is_expected.to eq(project.send(:project_a_associations).count) }
end
describe :project_b_associations do
@ -389,7 +389,7 @@ describe Project::Copy do
subject { copy.send(:project_b_associations).count }
it { should == project.send(:project_b_associations).count }
it { is_expected.to eq(project.send(:project_b_associations).count) }
end
end
@ -403,7 +403,7 @@ describe Project::Copy do
subject { copy.categories.count }
it { should == project.categories.count }
it { is_expected.to eq(project.categories.count) }
end
end
end

@ -48,19 +48,19 @@ describe Queries::WorkPackages::Filter do
let(:filter) { FactoryGirl.build :work_packages_filter, field: :done_ratio, operator: '>=', values: [] }
context 'and no value is given' do
it { should_not be_valid }
it { is_expected.not_to be_valid }
end
context 'and only an empty string is given as value' do
let(:filter) { FactoryGirl.build :work_packages_filter, field: :due_date, operator: 't-', values: [''] }
it { should_not be_valid }
it { is_expected.not_to be_valid }
end
context 'and values are given' do
before { filter.values = [5] }
it { should be_valid }
it { is_expected.to be_valid }
end
end
@ -72,18 +72,18 @@ describe Queries::WorkPackages::Filter do
context 'and the filter values is an integer' do
before { filter.values = [1, '12', 123] }
it { should be_valid }
it { is_expected.to be_valid }
end
context 'and the filter values is not an integer' do
before { filter.values == [1, 'asdf'] }
it { should_not be_valid }
it { is_expected.not_to be_valid }
context 'and the operator is *' do
before { filter.operator = '*' }
it { should be_valid }
it { is_expected.to be_valid }
end
end
end
@ -94,13 +94,13 @@ describe Queries::WorkPackages::Filter do
context "and the operator is 't' (today)" do
before { filter.operator = 't' }
it { should be_valid }
it { is_expected.to be_valid }
end
context "and the operator is 'w' (this week)" do
before { filter.operator = 'w' }
it { should be_valid }
it { is_expected.to be_valid }
end
context 'and the operator compares the current day' do
@ -109,13 +109,13 @@ describe Queries::WorkPackages::Filter do
context 'and the value is an integer' do
before { filter.values = ['4'] }
it { should be_valid }
it { is_expected.to be_valid }
end
context 'and the value is not an integer' do
before { filter.values = ['four'] }
it { should_not be_valid }
it { is_expected.not_to be_valid }
end
end
end
@ -126,19 +126,19 @@ describe Queries::WorkPackages::Filter do
context 'and the field is whitelisted' do
before { filter.field = :project_id }
it { should be_valid }
it { is_expected.to be_valid }
end
context 'and the field is not whitelisted and no custom field key' do
before { filter.field = :any_key }
it { should_not be_valid }
it { is_expected.not_to be_valid }
end
context 'and the field is a custom field starting with "cf"' do
before { filter.field = :cf_any_key }
it { should be_valid }
it { is_expected.to be_valid }
end
end
end

@ -34,7 +34,7 @@ describe Query do
describe 'available_columns' do
context 'with work_package_done_ratio NOT disabled' do
it 'should include the done_ratio column' do
expect(query.available_columns.find {|column| column.name == :done_ratio}).to be_true
expect(query.available_columns.find {|column| column.name == :done_ratio}).to be_truthy
end
end
@ -53,7 +53,7 @@ describe Query do
describe '#valid?' do
it "should not be valid without a name" do
query.name = ''
expect(query.save).to be_false
expect(query.save).to be_falsey
expect(query.errors[:name].first).to include(I18n.t('activerecord.errors.messages.blank'))
end
@ -63,7 +63,7 @@ describe Query do
end
it 'is not valid and creates an error' do
expect(query.valid?).to be_false
expect(query.valid?).to be_falsey
expect(query.errors[:base].first).to include(I18n.t('activerecord.errors.messages.blank'))
end
end
@ -73,7 +73,7 @@ describe Query do
let(:query) { FactoryGirl.build(:query).tap {|q| q.filters = []} }
it 'is not valid and creates an error' do
expect(query.valid?).to be_false
expect(query.valid?).to be_falsey
expect(query.errors[:filters]).to include(I18n.t('activerecord.errors.messages.blank'))
end
end
@ -87,7 +87,7 @@ describe Query do
end
it 'should have the name of the custom field in the error message' do
expect(query.valid?).to be_false
expect(query.valid?).to be_falsey
expect(query.errors.messages[:base].to_s).to include(custom_field.name)
end
end

@ -38,11 +38,11 @@ describe Setting do
end
it "allows users to register themselves" do
expect(Setting.self_registration?).to be_true
expect(Setting.self_registration?).to be_truthy
end
it "allows anonymous users to access public information" do
expect(Setting.login_required?).to be_false
expect(Setting.login_required?).to be_falsey
end
end
@ -108,7 +108,7 @@ describe Setting do
end
it "calls no callback on invalid setting" do
Setting.any_instance.stub(:valid?).and_return(false)
allow_any_instance_of(Setting).to receive(:valid?).and_return(false)
Setting.notified_events = 'invalid'
expect(collector).to be_empty
end

@ -33,13 +33,13 @@ describe SystemUser do
describe '#grant_privileges' do
before do
expect(system_user.admin).to be_false
expect(system_user.admin).to be_falsey
expect(system_user.status).to eq(User::STATUSES[:locked])
system_user.grant_privileges
end
it 'grant admin rights' do
expect(system_user.admin).to be_true
expect(system_user.admin).to be_truthy
end
it 'unlocks the user' do
@ -56,7 +56,7 @@ describe SystemUser do
end
it 'removes admin rights' do
expect(system_user.admin).to be_false
expect(system_user.admin).to be_falsey
end
it 'locks the user' do
@ -83,7 +83,7 @@ describe SystemUser do
end
it 'runs block with SystemUser' do
expect(@u.admin?).to be_false
expect(@u.admin?).to be_falsey
before_user = User.current
@u.run_given do
@ -93,7 +93,7 @@ describe SystemUser do
expect(issue.done_ratio).to eq(50)
expect(issue.journals.last.user).to eq(@u)
expect(@u.admin?).to be_false
expect(@u.admin?).to be_falsey
expect(User.current).to eq(before_user)
end
end

@ -35,19 +35,19 @@ describe UserPassword do
describe :expired? do
it 'should be true for an old password when password expiry is activated' do
with_settings :password_days_valid => 30 do
expect(old_password.expired?).to be_true
expect(old_password.expired?).to be_truthy
end
end
it 'should be false when password expiry is enabled and the password was changed recently' do
with_settings :password_days_valid => 30 do
expect(password.expired?).to be_false
expect(password.expired?).to be_falsey
end
end
it 'should be false for an old password when password expiry is disabled' do
with_settings :password_days_valid => 0 do
expect(old_password.expired?).to be_false
expect(old_password.expired?).to be_falsey
end
end
end

@ -51,7 +51,7 @@ describe User do
it 'may be stored in the database' do
user.login = 'a' * 256
expect(user.save).to be_true
expect(user.save).to be_truthy
end
it 'may be loaded from the database' do
@ -70,7 +70,7 @@ describe User do
it 'may not be stored in the database' do
user.login = 'a' * 257
expect(user.save).to be_false
expect(user.save).to be_falsey
end
end
@ -156,7 +156,7 @@ describe User do
end
it 'should allow password changes' do
expect(user.change_password_allowed?).to be_true
expect(user.change_password_allowed?).to be_truthy
end
end
@ -169,7 +169,7 @@ describe User do
end
it 'should not allow password changes' do
expect(user.change_password_allowed?).to be_false
expect(user.change_password_allowed?).to be_falsey
end
end
end
@ -181,7 +181,7 @@ describe User do
end
it 'should not allow a password change' do
expect(user.change_password_allowed?).to be_false
expect(user.change_password_allowed?).to be_falsey
end
end
end
@ -219,7 +219,7 @@ describe User do
let(:user) { FactoryGirl.build(:user, :identity_url => 'test_provider:veryuniqueid') }
it 'should return true' do
expect(user.uses_external_authentication?).to be_true
expect(user.uses_external_authentication?).to be_truthy
end
end
@ -227,7 +227,7 @@ describe User do
let(:user) { FactoryGirl.build(:user, :identity_url => nil) }
it 'should return false' do
expect(user.uses_external_authentication?).to be_false
expect(user.uses_external_authentication?).to be_falsey
end
end
end
@ -240,7 +240,7 @@ describe User do
@u.save
end
it { expect(@u.valid?).to be_false }
it { expect(@u.valid?).to be_falsey }
it { expect(@u.errors[:password]).to include I18n.t('activerecord.errors.messages.too_short', :count => Setting.password_min_length.to_i) }
end
@ -254,7 +254,7 @@ describe User do
it { expect(@u.password).not_to be_blank }
it { expect(@u.password_confirmation).not_to be_blank }
it { expect(@u.force_password_change).to be_true}
it { expect(@u.force_password_change).to be_truthy}
end
describe :try_authentication_for_existing_user do
@ -327,8 +327,8 @@ describe User do
it 'creates a SystemUser' do
expect do
system_user = User.system
expect(system_user.new_record?).to be_false
expect(system_user.is_a?(SystemUser)).to be_true
expect(system_user.new_record?).to be_falsey
expect(system_user.is_a?(SystemUser)).to be_truthy
end.to change(User, :count).by(1)
end
end
@ -359,7 +359,7 @@ describe User do
before do
default_admin.save
end
it { expect(User.default_admin_account_changed?).to be_false }
it { expect(User.default_admin_account_changed?).to be_falsey }
end
context "default admin account exists with changed password" do
@ -369,7 +369,7 @@ describe User do
default_admin.save
end
it { expect(User.default_admin_account_changed?).to be_true }
it { expect(User.default_admin_account_changed?).to be_truthy }
end
context "default admin account was deleted" do
@ -378,7 +378,7 @@ describe User do
default_admin.delete
end
it { expect(User.default_admin_account_changed?).to be_true }
it { expect(User.default_admin_account_changed?).to be_truthy }
end
context "default admin account was disabled" do
@ -387,7 +387,7 @@ describe User do
default_admin.save
end
it { expect(User.default_admin_account_changed?).to be_true }
it { expect(User.default_admin_account_changed?).to be_truthy }
end
end
@ -422,7 +422,7 @@ describe User do
allow(Setting).to receive(:accessibility_mode_for_anonymous?).and_return(false)
end
it { expect(anonymous.impaired?).to be_false }
it { expect(anonymous.impaired?).to be_falsey }
end
context 'anonymous user with accessibility mode enabled for anonymous users' do
@ -430,11 +430,11 @@ describe User do
allow(Setting).to receive(:accessibility_mode_for_anonymous?).and_return(true)
end
it { expect(anonymous.impaired?).to be_true }
it { expect(anonymous.impaired?).to be_truthy }
end
context 'not impaired user' do
it { expect(user.impaired?).to be_false }
it { expect(user.impaired?).to be_falsey }
end
context 'impaired user' do
@ -442,7 +442,7 @@ describe User do
user.pref[:impaired] = true
end
it { expect(user.impaired?).to be_true }
it { expect(user.impaired?).to be_truthy }
end
end
end

@ -32,7 +32,7 @@ describe Version do
subject(:version){ FactoryGirl.build(:version, name: "Test Version") }
it { should be_valid }
it { is_expected.to be_valid }
it "rejects a due date that is smaller than the start date" do
version.start_date = '2013-05-01'
@ -43,7 +43,7 @@ describe Version do
end
context 'deprecated methods' do
it { should respond_to :completed_pourcent }
it { should respond_to :closed_pourcent }
it { is_expected.to respond_to :completed_pourcent }
it { is_expected.to respond_to :closed_pourcent }
end
end

@ -60,7 +60,7 @@ describe WikiPage do
it 'ensures there is still a wiki menu item' do
expect(wiki.wiki_menu_items).to be_one
expect(wiki.wiki_menu_items.first.is_main_item?).to be_true
expect(wiki.wiki_menu_items.first.is_main_item?).to be_truthy
end
end

@ -60,7 +60,7 @@ describe WorkPackage do
end
it "should be true" do
expect(WorkPackage.cleanup_action_required_before_destructing?(work_package)).to be_true
expect(WorkPackage.cleanup_action_required_before_destructing?(work_package)).to be_truthy
end
end
@ -72,7 +72,7 @@ describe WorkPackage do
end
it "should be true" do
expect(WorkPackage.cleanup_action_required_before_destructing?([work_package, work_package2])).to be_true
expect(WorkPackage.cleanup_action_required_before_destructing?([work_package, work_package2])).to be_truthy
end
end
@ -82,7 +82,7 @@ describe WorkPackage do
end
it "should be false" do
expect(WorkPackage.cleanup_action_required_before_destructing?(work_package)).to be_false
expect(WorkPackage.cleanup_action_required_before_destructing?(work_package)).to be_falsey
end
end
end
@ -126,7 +126,7 @@ describe WorkPackage do
end
it 'should return true' do
expect(action).to be_true
expect(action).to be_truthy
end
end
@ -134,7 +134,7 @@ describe WorkPackage do
let(:action) { WorkPackage.cleanup_associated_before_destructing_if_required(work_package, user, :action => 'destroy') }
it 'should return true' do
expect(action).to be_true
expect(action).to be_truthy
end
it 'should not touch the time_entry' do
@ -149,7 +149,7 @@ describe WorkPackage do
let(:action) { WorkPackage.cleanup_associated_before_destructing_if_required(work_package, user) }
it 'should return true' do
expect(action).to be_true
expect(action).to be_truthy
end
it 'should not touch the time_entry' do
@ -164,7 +164,7 @@ describe WorkPackage do
let(:action) { WorkPackage.cleanup_associated_before_destructing_if_required(work_package, user, :action => 'nullify') }
it 'should return true' do
expect(action).to be_true
expect(action).to be_truthy
end
it 'should set the work_package_id of all time entries to nil' do
@ -187,7 +187,7 @@ describe WorkPackage do
end
it 'should return true' do
expect(action).to be_true
expect(action).to be_truthy
end
it 'should set the work_package_id of all time entries to the new work package' do
@ -214,7 +214,7 @@ describe WorkPackage do
end
it 'should return true' do
expect(action).to be_false
expect(action).to be_falsey
end
it 'should not alter the work_package_id of all time entries' do
@ -230,7 +230,7 @@ describe WorkPackage do
let(:action) { WorkPackage.cleanup_associated_before_destructing_if_required(work_package, user, :action => 'reassign', :reassign_to_id => 0) }
it 'should return true' do
expect(action).to be_false
expect(action).to be_falsey
end
it 'should not alter the work_package_id of all time entries' do
@ -252,7 +252,7 @@ describe WorkPackage do
let(:action) { WorkPackage.cleanup_associated_before_destructing_if_required(work_package, user, :action => 'reassign') }
it 'should return true' do
expect(action).to be_false
expect(action).to be_falsey
end
it 'should not alter the work_package_id of all time entries' do
@ -274,7 +274,7 @@ describe WorkPackage do
let(:action) { WorkPackage.cleanup_associated_before_destructing_if_required(work_package, user, :action => 'bogus') }
it 'should return false' do
expect(action).to be_false
expect(action).to be_falsey
end
end
@ -282,7 +282,7 @@ describe WorkPackage do
let(:action) { WorkPackage.cleanup_associated_before_destructing_if_required(work_package, user, nil) }
it 'should return false' do
expect(action).to be_false
expect(action).to be_falsey
end
end
end

@ -47,7 +47,7 @@ describe WorkPackage do
subject { ActionMailer::Base.deliveries.size }
it { should eq(2) }
it { is_expected.to eq(2) }
context "stale object" do
before do
@ -62,7 +62,7 @@ describe WorkPackage do
work_package.save! rescue nil
end
it { should eq(0) }
it { is_expected.to eq(0) }
end
context "no notification" do
@ -74,7 +74,7 @@ describe WorkPackage do
work_package.save!
end
it { should eq(0) }
it { is_expected.to eq(0) }
end
context :group_assigned_work_package do
@ -87,7 +87,7 @@ describe WorkPackage do
subject { work_package.recipients }
it { should include(user_1.mail) }
it { is_expected.to include(user_1.mail) }
end
end
end

@ -94,14 +94,14 @@ describe WorkPackage do
describe "does not track the changed newline characters" do
subject { work_package_1.journals.last.data.description }
it { should == description }
it { is_expected.to eq(description) }
end
describe 'tracks only the other change' do
subject { work_package_1.journals.last.details }
it { should have_key :subject }
it { should_not have_key :description }
it { is_expected.to have_key :subject }
it { is_expected.not_to have_key :description }
end
end
@ -119,7 +119,7 @@ describe WorkPackage do
subject { work_package_1.journals.last.details }
it { should_not have_key :description }
it { is_expected.not_to have_key :description }
end
end
@ -165,13 +165,13 @@ describe WorkPackage do
shared_examples_for "old value" do
subject { work_package.last_journal.old_value_for(property) }
it { should eq(expected_value) }
it { is_expected.to eq(expected_value) }
end
shared_examples_for "new value" do
subject { work_package.last_journal.new_value_for(property) }
it { should eq(expected_value) }
it { is_expected.to eq(expected_value) }
end
describe "journaled value for" do
@ -205,7 +205,7 @@ describe WorkPackage do
context "new attachment" do
subject { work_package.journals.last.changed_data }
it { should have_key attachment_id }
it { is_expected.to have_key attachment_id }
it { expect(subject[attachment_id]).to eq([nil, attachment.filename]) }
end
@ -219,7 +219,7 @@ describe WorkPackage do
subject { work_package.journals.count }
it { should eq(@original_journal_count) }
it { is_expected.to eq(@original_journal_count) }
end
context "attachment removed" do
@ -227,7 +227,7 @@ describe WorkPackage do
subject { work_package.journals.last.changed_data }
it { should have_key attachment_id }
it { is_expected.to have_key attachment_id }
it { expect(subject[attachment_id]).to eq([attachment.filename, nil]) }
end
@ -256,7 +256,7 @@ describe WorkPackage do
subject { work_package.journals.last.changed_data }
it { should have_key custom_field_id }
it { is_expected.to have_key custom_field_id }
it { expect(subject[custom_field_id]).to eq([nil, custom_value.value]) }
end
@ -274,7 +274,7 @@ describe WorkPackage do
subject { work_package.journals.last.changed_data }
it { should have_key custom_field_id }
it { is_expected.to have_key custom_field_id }
it { expect(subject[custom_field_id]).to eq([custom_value.value.to_s, modified_custom_value.value.to_s]) }
end
@ -294,7 +294,7 @@ describe WorkPackage do
subject { work_package.journals.count }
it { should eq(@original_journal_count) }
it { is_expected.to eq(@original_journal_count) }
end
context "custom value removed" do
@ -307,7 +307,7 @@ describe WorkPackage do
subject { work_package.journals.last.changed_data }
it { should have_key custom_field_id }
it { is_expected.to have_key custom_field_id }
it { expect(subject[custom_field_id]).to eq([custom_value.value, nil]) }
end
@ -327,7 +327,7 @@ describe WorkPackage do
it { expect(work_package.journals.last.customizable_journals).to be_empty }
it { expect(JournalManager.changed? work_package).to be_false }
it { expect(JournalManager.changed? work_package).to be_falsey }
end
describe "empty values handled as non existing" do

@ -64,19 +64,19 @@ describe WorkPackage do
expect(work_package.possible_watcher_users.sort).to eq(users_allowed_to_view_work_packages.sort)
end
it { should include(project_member) }
it { should_not include(admin) }
it { is_expected.to include(project_member) }
it { is_expected.not_to include(admin) }
context 'and the non member role has the permission to view work packages' do
include_context 'non member role has the permission to view work packages'
it { should_not include(non_member_user) }
it { is_expected.not_to include(non_member_user) }
end
context 'and the anonymous role has the permission to view work packages' do
include_context 'anonymous role has the permission to view work packages'
it { should_not include(anonymous_user) }
it { is_expected.not_to include(anonymous_user) }
end
end
@ -94,18 +94,18 @@ describe WorkPackage do
expect(work_package.possible_watcher_users.sort).to eq(users_allowed_to_view_work_packages.sort)
end
it { should include(project_member) }
it { is_expected.to include(project_member) }
it { should_not include(admin) }
it { should_not include(non_member_user) }
it { should_not include(anonymous_user) }
it { is_expected.not_to include(admin) }
it { is_expected.not_to include(non_member_user) }
it { is_expected.not_to include(anonymous_user) }
end
end
describe '#watcher_recipients' do
subject { work_package.watcher_recipients }
it { should include(watching_user.mail) }
it { is_expected.to include(watching_user.mail) }
context 'when the permission to view work packages has been removed' do
before do
@ -113,7 +113,7 @@ describe WorkPackage do
work_package.reload
end
it { should_not include(watching_user.mail) }
it { is_expected.not_to include(watching_user.mail) }
end
end
@ -127,7 +127,7 @@ describe WorkPackage do
work_package.reload
end
it { should be_true }
it { is_expected.to be_truthy }
end
end

@ -48,7 +48,7 @@ describe WorkPackage do
shared_examples_for "copied work package" do
subject { copy.id }
it { should_not eq(work_package.id) }
it { is_expected.not_to eq(work_package.id) }
end
describe "to the same project" do
@ -59,7 +59,7 @@ describe WorkPackage do
context :project do
subject { copy.project }
it { should eq(source_project) }
it { is_expected.to eq(source_project) }
end
end
@ -74,13 +74,13 @@ describe WorkPackage do
context :project do
subject { copy.project_id }
it { should eq(target_project.id) }
it { is_expected.to eq(target_project.id) }
end
context :type do
subject { copy.type_id }
it { should eq(target_type.id) }
it { is_expected.to eq(target_type.id) }
end
context :custom_fields do
@ -88,7 +88,7 @@ describe WorkPackage do
subject { copy.custom_value_for(custom_field.id) }
it { should be_nil }
it { is_expected.to be_nil }
end
describe :attributes do
@ -111,7 +111,7 @@ describe WorkPackage do
subject { copy.assigned_to_id }
it { should eq(target_user.id) }
it { is_expected.to eq(target_user.id) }
end
context :status do
@ -122,7 +122,7 @@ describe WorkPackage do
subject { copy.status_id }
it { should eq(target_status.id) }
it { is_expected.to eq(target_status.id) }
end
context :date do
@ -135,7 +135,7 @@ describe WorkPackage do
subject { copy.start_date }
it { should eq(target_date) }
it { is_expected.to eq(target_date) }
end
context :end do
@ -145,7 +145,7 @@ describe WorkPackage do
subject { copy.due_date }
it { should eq(target_date) }
it { is_expected.to eq(target_date) }
end
end
end
@ -171,12 +171,12 @@ describe WorkPackage do
context "pre-condition" do
subject { work_package.recipients }
it { should include(work_package.author.mail) }
it { is_expected.to include(work_package.author.mail) }
end
subject { copy.recipients }
it { should_not include(copy.author.mail) }
it { is_expected.not_to include(copy.author.mail) }
end
end
end
@ -220,32 +220,32 @@ describe WorkPackage do
context :subject do
subject { sink.subject }
it { should eq(source.subject) }
it { is_expected.to eq(source.subject) }
end
context :type do
subject { sink.type }
it { should eq(source.type) }
it { is_expected.to eq(source.type) }
end
context :status do
subject { sink.status }
it { should eq(source.status) }
it { is_expected.to eq(source.status) }
end
context :project do
subject { sink.project_id }
it { should eq(project_id) }
it { is_expected.to eq(project_id) }
end
context :watchers do
subject { sink.watchers.map(&:user_id) }
it do
should match_array(source.watchers.map(&:user_id))
is_expected.to match_array(source.watchers.map(&:user_id))
sink.watchers.each { |w| expect(w).to be_valid }
end
end
@ -257,7 +257,7 @@ describe WorkPackage do
context :custom_field do
subject { sink.custom_value_for(custom_field.id).value }
it { should eq('MySQL') }
it { is_expected.to eq('MySQL') }
end
end

@ -60,7 +60,7 @@ describe WorkPackage do
shared_examples_for "work package with required custom field" do
subject { work_package.available_custom_fields }
it { should include(custom_field) }
it { is_expected.to include(custom_field) }
end
context "required custom field exists" do
@ -84,13 +84,13 @@ describe WorkPackage do
subject { work_package.errors[:custom_values] }
it { should include(I18n.translate('activerecord.errors.messages.invalid')) }
it { is_expected.to include(I18n.translate('activerecord.errors.messages.invalid')) }
end
describe "work package attribute update" do
subject { work_package.save }
it { should be_false }
it { is_expected.to be_falsey }
end
end
@ -118,7 +118,7 @@ describe WorkPackage do
subject { work_package.errors.full_messages.first }
it { should eq("Database is not included in the list") }
it { is_expected.to eq("Database is not included in the list") }
end
end
@ -128,7 +128,7 @@ describe WorkPackage do
context :errors do
subject { work_package.errors[:custom_values] }
it { should be_empty }
it { is_expected.to be_empty }
end
context :save do
@ -139,7 +139,7 @@ describe WorkPackage do
subject { work_package.custom_value_for(custom_field.id).value }
it { should eq('PostgreSQL') }
it { is_expected.to eq('PostgreSQL') }
end
describe "value change" do
@ -153,7 +153,7 @@ describe WorkPackage do
subject { work_package.custom_value_for(custom_field).id }
it { should eq(@initial_custom_value) }
it { is_expected.to eq(@initial_custom_value) }
end
end
end
@ -185,7 +185,7 @@ describe WorkPackage do
subject { WorkPackage.find(work_package.id).custom_value_for(custom_field).value }
it { should eq('PostgreSQL') }
it { is_expected.to eq('PostgreSQL') }
end
end
@ -197,7 +197,7 @@ describe WorkPackage do
describe "pre-condition" do
subject { work_package_without_type.custom_field_values }
it { should be_empty }
it { is_expected.to be_empty }
end
context "with assigning type" do
@ -205,7 +205,7 @@ describe WorkPackage do
subject { work_package_without_type.custom_field_values }
it { should_not be_empty }
it { is_expected.not_to be_empty }
end
end
@ -226,7 +226,7 @@ describe WorkPackage do
wp.custom_value_for(custom_field_2.id).value
end
it { should eq('true') }
it { is_expected.to eq('true') }
end
end

@ -83,8 +83,8 @@ describe WorkPackage do
end
it "only duplicates are closed" do
expect(dup_1.closed?).to be_true
expect(dup_2.closed?).to be_true
expect(dup_1.closed?).to be_truthy
expect(dup_2.closed?).to be_truthy
end
end
@ -100,7 +100,7 @@ describe WorkPackage do
subject { original.closed? }
it { should be_false }
it { is_expected.to be_falsey }
end
end
@ -129,13 +129,13 @@ describe WorkPackage do
context "blocked work package" do
subject { blocked.blocked? }
it { should be_true }
it { is_expected.to be_truthy }
end
context "blocking work package" do
subject { blocks.blocked? }
it { should be_false }
it { is_expected.to be_falsey }
end
end
@ -156,7 +156,7 @@ describe WorkPackage do
shared_examples_for "work package with status transitions" do
subject { work_package.new_statuses_allowed_to(user) }
it { should_not be_empty }
it { is_expected.not_to be_empty }
end
shared_context "allowed status transitions" do
@ -178,7 +178,7 @@ describe WorkPackage do
describe "deny closed state" do
include_context "allowed status transitions"
it { should be_empty }
it { is_expected.to be_empty }
end
end
@ -190,7 +190,7 @@ describe WorkPackage do
describe "allow closed state" do
include_context "allowed status transitions"
it { should_not be_empty }
it { is_expected.not_to be_empty }
end
end
end
@ -214,7 +214,7 @@ describe WorkPackage do
shared_examples_for "following start date" do
subject { following.reload.start_date }
it { should eq(preceding.due_date + 1) }
it { is_expected.to eq(preceding.due_date + 1) }
end
before { relation_precedes }
@ -282,7 +282,7 @@ describe WorkPackage do
shared_examples_for "all dependant work packages visible" do
subject { work_package_1.all_dependent_packages.collect(&:id) }
it { should match_array(expected_ids) }
it { is_expected.to match_array(expected_ids) }
end
context "w/o circular dependency" do

@ -36,13 +36,13 @@ describe WorkPackage do
shared_examples_for "overdue" do
subject { work_package.overdue? }
it { should be_true }
it { is_expected.to be_truthy }
end
shared_examples_for "on time" do
subject { work_package.overdue? }
it { should be_false }
it { is_expected.to be_falsey }
end
context "one day ago" do
@ -89,13 +89,13 @@ describe WorkPackage do
shared_examples_for "behind schedule" do
subject { work_package.behind_schedule? }
it { should be_true }
it { is_expected.to be_truthy }
end
shared_examples_for "in schedule" do
subject { work_package.behind_schedule? }
it { should be_false }
it { is_expected.to be_falsey }
end
context "no start date" do

@ -76,7 +76,7 @@ describe WorkPackage do
work_package.status = status_2
end
it { expect(work_package.save).to be_true }
it { expect(work_package.save).to be_truthy }
end
describe 'invalid' do
@ -92,7 +92,7 @@ describe WorkPackage do
describe 'non-existing' do
before { work_package.status = status_2 }
it { expect(work_package.save).to be_false }
it { expect(work_package.save).to be_falsey }
end
end

@ -37,12 +37,12 @@ describe WorkPackage do
# validations
[:subject, :priority, :project, :type, :author, :status].each do |field|
it{ should validate_presence_of field}
it{ is_expected.to validate_presence_of field}
end
it { should ensure_length_of(:subject).is_at_most 255 }
it { should ensure_inclusion_of(:done_ratio).in_range 0..100 }
it { should validate_numericality_of :estimated_hours}
it { is_expected.to ensure_length_of(:subject).is_at_most 255 }
it { is_expected.to ensure_inclusion_of(:done_ratio).in_range 0..100 }
it { is_expected.to validate_numericality_of :estimated_hours}
it "validates, that start-date is before end-date" do
wp = FactoryGirl.build(:work_package, start_date: 1.day.from_now, due_date: 1.day.ago)
@ -179,7 +179,7 @@ describe WorkPackage do
active_priority.save!
wp.reload
expect(wp.priority.active).to be_false
expect(wp.priority.active).to be_falsey
expect(wp).to be_valid
end

@ -54,7 +54,7 @@ describe WorkPackage do
describe :save do
subject { work_package.save }
it { should be_true }
it { is_expected.to be_truthy }
end
describe :estimated_hours do
@ -65,7 +65,7 @@ describe WorkPackage do
subject { work_package.estimated_hours }
it { should eq(1.5) }
it { is_expected.to eq(1.5) }
end
describe "minimal" do
@ -81,7 +81,7 @@ describe WorkPackage do
context :save do
subject { work_package_minimal.save }
it { should be_true }
it { is_expected.to be_truthy }
end
context :description do
@ -92,7 +92,7 @@ describe WorkPackage do
subject { work_package_minimal.description }
it { should be_nil }
it { is_expected.to be_nil }
end
end
@ -107,7 +107,7 @@ describe WorkPackage do
subject { FactoryGirl.create(:work_package,
assigned_to: group).assigned_to }
it { should eq(group) }
it { is_expected.to eq(group) }
end
end
end
@ -126,7 +126,7 @@ describe WorkPackage do
subject { work_package.save }
it { should be_true }
it { is_expected.to be_truthy }
end
describe "must not be set on work package" do
@ -137,7 +137,7 @@ describe WorkPackage do
context :save do
subject { work_package.save }
it { should be_false }
it { is_expected.to be_falsey }
end
context :errors do
@ -145,7 +145,7 @@ describe WorkPackage do
subject { work_package.errors[:type_id] }
it { should_not be_empty }
it { is_expected.not_to be_empty }
end
end
end
@ -164,7 +164,7 @@ describe WorkPackage do
subject { work_package.assigned_to }
it { should eq(category.assigned_to) }
it { is_expected.to eq(category.assigned_to) }
end
describe :assignable_assignees do
@ -176,7 +176,7 @@ describe WorkPackage do
subject { stub_work_package.assignable_assignees }
it 'should return all users the project deems to be possible assignees' do
should include(user)
is_expected.to include(user)
end
end
@ -190,7 +190,7 @@ describe WorkPackage do
end
subject { work_package.assignable_assignees }
it { should include(group) }
it { is_expected.to include(group) }
end
context "without work_package_group_assignment" do
@ -203,7 +203,7 @@ describe WorkPackage do
end
subject { work_package.assignable_assignees }
it { should_not include(group) }
it { is_expected.not_to include(group) }
end
context "multiple users" do
@ -213,7 +213,7 @@ describe WorkPackage do
subject { stub_work_package.assignable_assignees.uniq }
it { should eq(stub_work_package.assignable_assignees) }
it { is_expected.to eq(stub_work_package.assignable_assignees) }
end
end
@ -228,8 +228,8 @@ describe WorkPackage do
subject { work_package.assignable_responsibles }
it { should_not include(group) }
it { should include(user) }
it { is_expected.not_to include(group) }
it { is_expected.to include(user) }
end
describe :assignable_versions do
@ -282,7 +282,7 @@ describe WorkPackage do
subject { work_package.assignable_versions.collect(&:status).uniq }
it { should include('open') }
it { is_expected.to include('open') }
end
shared_examples_for "invalid version" do
@ -290,7 +290,7 @@ describe WorkPackage do
subject { work_package.errors[:fixed_version_id] }
it { should_not be_empty }
it { is_expected.not_to be_empty }
end
context "closed version" do
@ -310,7 +310,7 @@ describe WorkPackage do
before { work_package.save }
it { should be_true }
it { is_expected.to be_truthy }
end
end
@ -346,7 +346,7 @@ describe WorkPackage do
subject { work_package.save }
it { should be_true }
it { is_expected.to be_truthy }
end
context "status changed" do
@ -377,7 +377,7 @@ describe WorkPackage do
subject { work_package.save }
it { should be_true }
it { is_expected.to be_truthy }
end
context "in closed version" do
@ -390,7 +390,7 @@ describe WorkPackage do
subject { work_package.errors[:base] }
it { should_not be_empty }
it { is_expected.not_to be_empty }
end
context "from closed version" do
@ -418,7 +418,7 @@ describe WorkPackage do
shared_examples_for "moved work package" do
subject { work_package.project }
it { should eq(target_project) }
it { is_expected.to eq(target_project) }
end
describe :time_entries do
@ -443,13 +443,13 @@ describe WorkPackage do
context "time entry 1" do
subject { work_package.time_entries }
it { should include(time_entry_1) }
it { is_expected.to include(time_entry_1) }
end
context "time entry 2" do
subject { work_package.time_entries }
it { should include(time_entry_2) }
it { is_expected.to include(time_entry_2) }
end
it_behaves_like "moved work package"
@ -480,7 +480,7 @@ describe WorkPackage do
describe "category moved" do
subject { work_package.category_id }
it { should eq(target_category.id) }
it { is_expected.to eq(target_category.id) }
end
it_behaves_like "moved work package"
@ -492,7 +492,7 @@ describe WorkPackage do
describe "category discarded" do
subject { work_package.category_id }
it { should be_nil }
it { is_expected.to be_nil }
end
it_behaves_like "moved work package"
@ -516,7 +516,7 @@ describe WorkPackage do
context "unshared version" do
subject { work_package.fixed_version }
it { should be_nil }
it { is_expected.to be_nil }
end
context "system wide shared version" do
@ -524,7 +524,7 @@ describe WorkPackage do
subject { work_package.fixed_version }
it { should eq(version) }
it { is_expected.to eq(version) }
end
context "move work package in project hierarchy" do
@ -534,7 +534,7 @@ describe WorkPackage do
context "unshared version" do
subject { work_package.fixed_version }
it { should be_nil }
it { is_expected.to be_nil }
end
context "shared version" do
@ -542,7 +542,7 @@ describe WorkPackage do
subject { work_package.fixed_version }
it { should eq(version) }
it { is_expected.to eq(version) }
end
end
end
@ -554,7 +554,7 @@ describe WorkPackage do
subject { work_package.move_to_project(target_project) }
it { should be_false }
it { is_expected.to be_falsey }
end
end
@ -576,13 +576,13 @@ describe WorkPackage do
context "work package" do
subject { WorkPackage.find_by_id(work_package.id) }
it { should be_nil }
it { is_expected.to be_nil }
end
context "time entries" do
subject { TimeEntry.find_by_work_package_id(work_package.id) }
it { should be_nil }
it { is_expected.to be_nil }
end
end
@ -613,13 +613,13 @@ describe WorkPackage do
context "work package 1" do
subject { work_package_1.done_ratio }
it { should eq(0) }
it { is_expected.to eq(0) }
end
context "work package 2" do
subject { work_package_2.done_ratio }
it { should eq(30) }
it { is_expected.to eq(30) }
end
end
@ -629,13 +629,13 @@ describe WorkPackage do
context "work package 1" do
subject { work_package_1.done_ratio }
it { should eq(50) }
it { is_expected.to eq(50) }
end
context "work package 2" do
subject { work_package_2.done_ratio }
it { should eq(0) }
it { is_expected.to eq(0) }
end
end
end
@ -713,13 +713,13 @@ describe WorkPackage do
context :size do
subject { groups.size }
it { should eq(2) }
it { is_expected.to eq(2) }
end
context :total do
subject { groups.inject(0) {|sum, group| sum + group['total'].to_i} }
it { should eq(2) }
it { is_expected.to eq(2) }
end
end
@ -796,7 +796,7 @@ describe WorkPackage do
context :limit do
subject { WorkPackage.recently_updated.limit(1).first }
it { should eq(work_package_2) }
it { is_expected.to eq(work_package_2) }
end
end
@ -812,12 +812,12 @@ describe WorkPackage do
subject { WorkPackage.on_active_project.length }
context "one work package in active projects" do
it { should eq(1) }
it { is_expected.to eq(1) }
context "and one work package in archived projects" do
before { work_package_in_archived_project }
it { should eq(1) }
it { is_expected.to eq(1) }
end
end
end
@ -849,13 +849,13 @@ describe WorkPackage do
shared_examples_for "includes expected users" do
subject { work_package.recipients }
it { should include(*expected_users) }
it { is_expected.to include(*expected_users) }
end
shared_examples_for "includes not expected users" do
subject { work_package.recipients }
it { should_not include(*expected_users) }
it { is_expected.not_to include(*expected_users) }
end
describe "includes project recipients" do
@ -864,7 +864,7 @@ describe WorkPackage do
context "pre-condition" do
subject { project.recipients }
it { should_not be_empty }
it { is_expected.not_to be_empty }
end
let(:expected_users) { project.recipients }
@ -878,7 +878,7 @@ describe WorkPackage do
context "pre-condition" do
subject { work_package.author }
it { should_not be_nil }
it { is_expected.not_to be_nil }
end
let(:expected_users) { work_package.author.mail }
@ -892,7 +892,7 @@ describe WorkPackage do
context "pre-condition" do
subject { work_package.assigned_to }
it { should_not be_nil }
it { is_expected.not_to be_nil }
end
let(:expected_users) { work_package.assigned_to.mail }
@ -1063,7 +1063,7 @@ describe WorkPackage do
let(:instance) { FactoryGirl.create(:work_package) }
it "should return true" do
expect(instance.update_by!(user, {})).to be_true
expect(instance.update_by!(user, {})).to be_truthy
end
it "should set the values" do
@ -1155,7 +1155,7 @@ describe WorkPackage do
subject { WorkPackage.allowed_target_projects_on_move.count }
it "sees all active projects" do
should eq Project.active.count
is_expected.to eq Project.active.count
end
end
@ -1171,7 +1171,7 @@ describe WorkPackage do
subject { WorkPackage.allowed_target_projects_on_move.count }
it "sees all active projects" do
should eq Project.active.count
is_expected.to eq Project.active.count
end
end
end

@ -82,7 +82,7 @@ RSpec.configure do |config|
# add helpers to parse json-responses
config.include JsonSpec::Helpers
config.after(:each) do
config.after(:each) do |example|
OpenProject::RSpecLazinessWarn.warn_if_user_current_set(example)
end
@ -91,6 +91,10 @@ RSpec.configure do |config|
raise "your specs leave a #{cls} in the DB\ndid you use before(:all) instead of before or forget to kill the instances in a after(:all)?" if cls.count > 0
end
end
config.mock_with :rspec do |c|
c.yield_receiver_to_any_instance_implementation_blocks = true
end
end
# load disable_specs.rbs from plugins

@ -43,13 +43,13 @@ module PermissionSpecs
it "should allow calling #{controller_action} when having the permission #{permission} permission" do
become_member_with_permissions(project, current_user, permission)
expect(controller.send(:authorize, controller_name, action_name)).to be_true
expect(controller.send(:authorize, controller_name, action_name)).to be_truthy
end
it "should prevent calling #{controller_action} when not having the permission #{permission} permission" do
become_member_with_permissions(project, current_user)
expect(controller.send(:authorize, controller_name, action_name)).to be_false
expect(controller.send(:authorize, controller_name, action_name)).to be_falsey
end
end

@ -53,13 +53,13 @@ describe 'api/v2/planning_element_type_colors/show.api.rabl' do
subject { response.body }
it 'renders a color document' do
should have_json_path('color')
is_expected.to have_json_path('color')
end
it 'renders the detail information about the color' do
expected_json = {name: "Awesometastic color", hexcode: '#FFFFFF', position: 10}.to_json
should be_json_eql(expected_json).at_path('color')
is_expected.to be_json_eql(expected_json).at_path('color')
end
end

@ -62,7 +62,7 @@ describe 'api/v2/planning_element_types/index.api.rabl' do
subject{response.body}
it 'renders 3 planning_element_types' do
should have_json_size(3).at_path('planning_element_types')
is_expected.to have_json_size(3).at_path('planning_element_types')
end
end
end

@ -58,7 +58,7 @@ describe 'api/v2/planning_element_types/show.api.rabl' do
subject { response.body }
it 'renders a planning_element_type document' do
should have_json_path('planning_element_type')
is_expected.to have_json_path('planning_element_type')
end
it 'should render all detail-information for the planning-element-type' do
@ -71,7 +71,7 @@ describe 'api/v2/planning_element_types/show.api.rabl' do
:position => 100,
}.to_json
should be_json_eql(expected_json).at_path('planning_element_type')
is_expected.to be_json_eql(expected_json).at_path('planning_element_type')
end

@ -64,7 +64,7 @@ describe 'api/v2/planning_elements/index.api.rabl' do
end
it "should render 3 planning-elements" do
should have_json_size(3).at_path("planning_elements")
is_expected.to have_json_size(3).at_path("planning_elements")
end
it 'should render the subject' do
@ -75,7 +75,7 @@ describe 'api/v2/planning_elements/index.api.rabl' do
type = project.types.first
expected_json = {name: type.name}.to_json
should be_json_eql(type.id.to_json).at_path("planning_elements/0/type_id")
is_expected.to be_json_eql(type.id.to_json).at_path("planning_elements/0/type_id")
end
@ -84,7 +84,7 @@ describe 'api/v2/planning_elements/index.api.rabl' do
end
it 'should render a project-id' do
should be_json_eql(project.id.to_json).at_path(("planning_elements/0/project_id"))
is_expected.to be_json_eql(project.id.to_json).at_path(("planning_elements/0/project_id"))
end

@ -41,8 +41,8 @@ describe 'api/v2/planning_elements/index.api.rabl' do
subject {response.body}
it 'renders an empty planning_elements document' do
should have_selector('planning_elements', :count => 1)
should have_selector('planning_elements[type=array]') do
is_expected.to have_selector('planning_elements', :count => 1)
is_expected.to have_selector('planning_elements[type=array]') do
without_tag 'planning_element'
end
end
@ -64,8 +64,8 @@ describe 'api/v2/planning_elements/index.api.rabl' do
subject {Nokogiri.XML(response.body)}
it 'renders a planning_elements document with the size 3 of array' do
should have_selector('planning_elements', :count => 1)
should have_selector('planning_elements planning_element', :count => 3)
is_expected.to have_selector('planning_elements', :count => 1)
is_expected.to have_selector('planning_elements planning_element', :count => 3)
end
it 'renders the subject' do

@ -78,47 +78,47 @@ describe 'api/v2/planning_elements/show.api.rabl' do
subject {response.body}
it 'renders a planning_element document' do
should have_json_path('planning_element')
is_expected.to have_json_path('planning_element')
end
it 'contains an id element containing the planning element id' do
should be_json_eql(1.to_json).at_path('planning_element/id')
is_expected.to be_json_eql(1.to_json).at_path('planning_element/id')
end
it 'contains a project element containing the planning element\'s project id, identifier and name' do
expected_json = {id: 4712, identifier: "test_project", name: "Test Project"}.to_json
should be_json_eql(expected_json).at_path('planning_element/project')
is_expected.to be_json_eql(expected_json).at_path('planning_element/project')
end
it 'contains an name element containing the planning subject' do
should be_json_eql("WorkPackage #1".to_json).at_path('planning_element/subject')
is_expected.to be_json_eql("WorkPackage #1".to_json).at_path('planning_element/subject')
end
it 'contains an description element containing the planning element description' do
should be_json_eql("Description of this planning element".to_json).at_path('planning_element/description')
is_expected.to be_json_eql("Description of this planning element".to_json).at_path('planning_element/description')
end
it 'contains an start_date element containing the planning element start_date in YYYY-MM-DD' do
should be_json_eql('2011-12-06'.to_json).at_path('planning_element/start_date')
is_expected.to be_json_eql('2011-12-06'.to_json).at_path('planning_element/start_date')
end
it 'contains an due_date element containing the planning element due_date in YYYY-MM-DD' do
should be_json_eql('2011-12-13'.to_json).at_path('planning_element/due_date')
is_expected.to be_json_eql('2011-12-13'.to_json).at_path('planning_element/due_date')
end
it 'contains a created_at element containing the planning element created_at in UTC in ISO 8601' do
should be_json_eql('2011-01-06T11:35:00Z'.to_json).at_path('planning_element/created_at')
is_expected.to be_json_eql('2011-01-06T11:35:00Z'.to_json).at_path('planning_element/created_at')
end
it 'contains an updated_at element containing the planning element updated_at in UTC in ISO 8601' do
should be_json_eql('2011-01-07T11:35:00Z'.to_json).at_path('planning_element/updated_at')
is_expected.to be_json_eql('2011-01-07T11:35:00Z'.to_json).at_path('planning_element/updated_at')
end
it 'renders the custom field values' do
should have_json_path('planning_element/custom_fields')
is_expected.to have_json_path('planning_element/custom_fields')
expected_json = {name: custom_field.name, value: "Wurst"}.to_json
should be_json_eql(expected_json).at_path('planning_element/custom_fields/0')
is_expected.to be_json_eql(expected_json).at_path('planning_element/custom_fields/0')
end
end
@ -170,12 +170,12 @@ describe 'api/v2/planning_elements/show.api.rabl' do
end
it 'renders a children node containing child nodes for each child planning element' do
should have_json_size(2).at_path('planning_element/children')
is_expected.to have_json_size(2).at_path('planning_element/children')
end
it 'each child node has an id and subject attribute' do
should be_json_eql({id: 1339, subject: "Child #1"}.to_json).at_path('planning_element/children/0')
should be_json_eql({id: 1340, subject: "Child #2"}.to_json).at_path('planning_element/children/1')
is_expected.to be_json_eql({id: 1339, subject: "Child #1"}.to_json).at_path('planning_element/children/0')
is_expected.to be_json_eql({id: 1340, subject: "Child #2"}.to_json).at_path('planning_element/children/1')
end
end
@ -264,15 +264,15 @@ describe 'api/v2/planning_elements/show.api.rabl' do
subject {response.body}
it 'contains an array of journals' do
should have_json_size(2).at_path('planning_element/journals')
is_expected.to have_json_size(2).at_path('planning_element/journals')
end
it 'reports the changes' do
expected_json = {name: "subject", old: "old_subject", new: "new_subject"}.to_json
should be_json_eql(expected_json).at_path('planning_element/journals/0/changes/0/technical')
is_expected.to be_json_eql(expected_json).at_path('planning_element/journals/0/changes/0/technical')
expected_json = {name: "project_id", old: 1, new: 2}.to_json
should be_json_eql(expected_json).at_path('planning_element/journals/1/changes/0/technical')
is_expected.to be_json_eql(expected_json).at_path('planning_element/journals/1/changes/0/technical')
end
end

@ -68,11 +68,11 @@ describe 'api/v2/project_associations/available_projects.api.rabl' do
created_on: '2011-01-06T11:35:00Z',
updated_on: '2011-01-07T11:35:00Z'
}.to_json
should be_json_eql(expected_json).at_path('projects/0')
is_expected.to be_json_eql(expected_json).at_path('projects/0')
end
it ' should check for disabled projects' do
pending
skip
end

@ -61,7 +61,7 @@ describe 'api/v2/project_associations/show.api.rabl' do
subject {response.body}
it 'renders a project_association document' do
should have_json_path('project_association')
is_expected.to have_json_path('project_association')
end
it 'renders the details of the association' do
@ -70,7 +70,7 @@ describe 'api/v2/project_associations/show.api.rabl' do
{ name: 'Test Project B',identifier: 'test_project_b'}]
}.to_json
should be_json_eql(expected_json).at_path('project_association')
is_expected.to be_json_eql(expected_json).at_path('project_association')
end

@ -41,7 +41,7 @@ describe '/api/v2/projects/index.api.rabl' do
render
should have_json_size(0).at_path('projects')
is_expected.to have_json_size(0).at_path('projects')
end
end
@ -65,14 +65,14 @@ describe '/api/v2/projects/index.api.rabl' do
subject { response.body }
it 'renders a projects document with the size of 3 of type array' do
should have_json_size(3).at_path('projects')
is_expected.to have_json_size(3).at_path('projects')
end
it 'renders all three projects' do
should be_json_eql('P1'.to_json).at_path("projects/0/name")
should be_json_eql('P2'.to_json).at_path("projects/1/name")
should be_json_eql('P3'.to_json).at_path("projects/2/name")
is_expected.to be_json_eql('P1'.to_json).at_path("projects/0/name")
is_expected.to be_json_eql('P2'.to_json).at_path("projects/1/name")
is_expected.to be_json_eql('P3'.to_json).at_path("projects/2/name")
end

@ -41,7 +41,7 @@ describe '/api/v2/projects/level_list.api.rabl' do
render
should have_json_size(0).at_path('projects')
is_expected.to have_json_size(0).at_path('projects')
end
end
@ -67,22 +67,22 @@ describe '/api/v2/projects/level_list.api.rabl' do
subject { response.body }
it 'renders a projects document with the size of 3 of type array' do
should have_json_size(3).at_path('projects')
is_expected.to have_json_size(3).at_path('projects')
end
it 'renders all three projects' do
should be_json_eql('P1'.to_json).at_path('projects/0/name')
should be_json_eql('P2'.to_json).at_path('projects/1/name')
should be_json_eql('P3'.to_json).at_path('projects/2/name')
is_expected.to be_json_eql('P1'.to_json).at_path('projects/0/name')
is_expected.to be_json_eql('P2'.to_json).at_path('projects/1/name')
is_expected.to be_json_eql('P3'.to_json).at_path('projects/2/name')
end
it 'renders the project levels' do
should be_json_eql(0.to_json).at_path('projects/0/level')
should be_json_eql(1.to_json).at_path('projects/1/level')
should be_json_eql(0.to_json).at_path('projects/2/level')
is_expected.to be_json_eql(0.to_json).at_path('projects/0/level')
is_expected.to be_json_eql(1.to_json).at_path('projects/1/level')
is_expected.to be_json_eql(0.to_json).at_path('projects/2/level')
end

@ -61,7 +61,7 @@ describe 'api/v2/projects/show.api.rabl' do
subject { response.body }
it 'renders a project document' do
should have_json_path('project')
is_expected.to have_json_path('project')
end
it 'renders the project-infos for an admin' do
@ -80,7 +80,7 @@ describe 'api/v2/projects/show.api.rabl' do
created_on: "2011-01-06T11:35:00Z",
updated_on: "2011-01-07T11:35:00Z" }.to_json
should be_json_eql(expected_json).at_path('project')
is_expected.to be_json_eql(expected_json).at_path('project')
end
end
@ -167,7 +167,7 @@ describe 'api/v2/projects/show.api.rabl' do
it 'contains a responsible node containing the responsible\'s id and name' do
expected_json = {id: responsible.id, name: "Project Manager"}.to_json
should be_json_eql(expected_json).at_path('project/responsible')
is_expected.to be_json_eql(expected_json).at_path('project/responsible')
end
end
@ -186,7 +186,7 @@ describe 'api/v2/projects/show.api.rabl' do
it 'contains a project_type element with name and id attributes' do
expected_json = {id: 100, name: 'Sample ProjectType'}.to_json
should be_json_eql(expected_json).at_path('project/project_type')
is_expected.to be_json_eql(expected_json).at_path('project/project_type')
end
end
@ -212,14 +212,14 @@ describe 'api/v2/projects/show.api.rabl' do
it 'contains 3 planning_element_types' do
should have_json_size(3).at_path("project/types")
is_expected.to have_json_size(3).at_path("project/types")
end
it 'renders the current name, color, is_milestone for a planning_element_type' do
expected_json = {name: "SampleType", is_milestone: true, color: {hexcode: "#FF0000", name: "red"}}.to_json
should be_json_eql(expected_json).at_path("project/types/0")
is_expected.to be_json_eql(expected_json).at_path("project/types/0")
end
end
@ -251,14 +251,14 @@ describe 'api/v2/projects/show.api.rabl' do
it 'render 2 project_associations' do
should have_json_size(2).at_path('project/project_associations')
is_expected.to have_json_size(2).at_path('project/project_associations')
end
it 'render a project_association with the from- and -to-project' do
expected_json = {project: {name: "Associated Project #1", identifier: "assoc_1"}}.to_json
should be_json_eql(expected_json).at_path('project/project_associations/0')
is_expected.to be_json_eql(expected_json).at_path('project/project_associations/0')
end
end
@ -286,10 +286,10 @@ describe 'api/v2/projects/show.api.rabl' do
subject {response.body}
it 'renders custom field values' do
should have_json_path('project/custom_fields')
is_expected.to have_json_path('project/custom_fields')
expected_json = {name: custom_field.name, value: "Wurst"}.to_json
should be_json_eql(expected_json).at_path('project/custom_fields/0')
is_expected.to be_json_eql(expected_json).at_path('project/custom_fields/0')
end
end

@ -50,13 +50,13 @@ describe 'api/v2/reported_project_statuses/show.api.rabl' do
subject {response.body}
it 'renders a reported_project_status document' do
should have_json_path('reported_project_status')
is_expected.to have_json_path('reported_project_status')
end
it 'should render the details of the reported project-status' do
expected_json = {name: "Awesometastic reported_project_status", is_default: true, position: 10}.to_json
should be_json_eql(expected_json).at_path('reported_project_status')
is_expected.to be_json_eql(expected_json).at_path('reported_project_status')
end

@ -70,7 +70,7 @@ describe 'api/v2/reportings/show.api.rabl' do
reported_project_status_comment: "Sample Comment"
}.to_json
should be_json_eql(expected_json).at_path('reporting')
is_expected.to be_json_eql(expected_json).at_path('reporting')
end
@ -93,7 +93,7 @@ describe 'api/v2/reportings/show.api.rabl' do
it 'renders the reported project-status' do
expected_json = { name: "beste" }.to_json
should be_json_eql(expected_json).at_path('reporting/reported_project_status')
is_expected.to be_json_eql(expected_json).at_path('reporting/reported_project_status')
end
end

@ -42,7 +42,7 @@ describe '/api/v2/users/index.api.rabl' do
render
should have_json_size(0).at_path('users')
is_expected.to have_json_size(0).at_path('users')
end
end
@ -64,13 +64,13 @@ describe '/api/v2/users/index.api.rabl' do
subject { response.body }
it 'renders a projects document with the size of 3 of type array' do
should have_json_size(2).at_path('users')
is_expected.to have_json_size(2).at_path('users')
end
it 'renders both users' do
should be_json_eql({firstname:'Peter', lastname:'Test', name: "Peter Test"}.to_json).at_path("users/0")
should be_json_eql({firstname:'Mary', lastname:'Test', name: "Mary Test"}.to_json).at_path("users/1")
is_expected.to be_json_eql({firstname:'Peter', lastname:'Test', name: "Peter Test"}.to_json).at_path("users/0")
is_expected.to be_json_eql({firstname:'Mary', lastname:'Test', name: "Mary Test"}.to_json).at_path("users/1")
end

@ -43,8 +43,8 @@ describe 'api/v2/workflows/index.api.rabl' do
subject { response.body }
it 'renders an empty workflows document' do
should have_selector('workflows', count: 1)
should have_selector('workflows[type=array]') do
is_expected.to have_selector('workflows', count: 1)
is_expected.to have_selector('workflows[type=array]') do
without_tag 'workflow'
end
end

@ -39,7 +39,7 @@ describe 'users/edit' do
assign(:user, user)
assign(:auth_sources, [])
view.stub(:current_user).and_return(current_user)
allow(view).to receive(:current_user).and_return(current_user)
render
end

Loading…
Cancel
Save