From 0924835bcd7de6eb697df1d3afcaeffc852f2d8d Mon Sep 17 00:00:00 2001 From: Jan Sandbrink Date: Tue, 21 Apr 2015 16:23:06 +0200 Subject: [PATCH] fix expectations - when the value is '' we should expect '' and not nil (IMO the old implementation was flawed) - do not care whether find_by_id is called with string or int --- .../api/experimental/work_package_decorator_spec.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/spec/decorators/api/experimental/work_package_decorator_spec.rb b/spec/decorators/api/experimental/work_package_decorator_spec.rb index fa3b1af7d3..e234a52e4a 100644 --- a/spec/decorators/api/experimental/work_package_decorator_spec.rb +++ b/spec/decorators/api/experimental/work_package_decorator_spec.rb @@ -54,7 +54,7 @@ describe API::Experimental::WorkPackageDecorator, type: :model do end describe '#custom_values_display_data' do - it 'returns a hash with a subset of information about the custom value' do + it 'returns a hash with a subset of information about a custom value' do allow(dwp1).to receive(:custom_values).and_return [custom_value] returned = dwp1.custom_values_display_data(custom_field.id) @@ -62,18 +62,19 @@ describe API::Experimental::WorkPackageDecorator, type: :model do expected = [{ custom_field_id: custom_field.id, field_format: custom_field.field_format, - value: nil + value: '' }] expect(returned).to eql (expected) end - it 'returns a hash with a subset of information about the custom value' do + it 'returns a hash with a subset of information about a user custom value' do field = FactoryGirl.build_stubbed(:user_issue_custom_field) custom_value.custom_field = field user = FactoryGirl.build_stubbed(:user) custom_value.value = user.id.to_s allow(User).to receive(:find_by_id).with(user.id).and_return(user) + allow(User).to receive(:find_by_id).with(user.id.to_s).and_return(user) allow(dwp1).to receive(:custom_values).and_return [custom_value]