77 def default_required_params ( overrides = { } )
88 {
99 'author' => 'author' ,
10- 'defaultLocale' => 'default ocale ' ,
10+ 'defaultLocale' => 'en ' ,
1111 'frameworkVersion' => '2.0' ,
1212 'location' => {
1313 'support' => {
14- 'ticket_sidebar' => 'url '
14+ 'ticket_sidebar' => 'https://example.com/app '
1515 }
1616 }
1717 } . merge! ( overrides )
@@ -65,6 +65,8 @@ def create_package(parameter_hash)
6565 allow ( @package ) . to receive ( :requirements_only ) { false }
6666 allow ( @package ) . to receive ( :requirements_only= ) { nil }
6767 allow ( @package ) . to receive ( :manifest ) { manifest }
68+ translation_files = double ( 'AppFile' , relative_path : 'translations/en.json' )
69+ allow ( @package ) . to receive_messages ( translation_files : [ translation_files ] )
6870 end
6971
7072 after do
@@ -123,16 +125,12 @@ def create_package(parameter_hash)
123125
124126 it 'should have an error when the translation file is missing for the defaultLocale' do
125127 @manifest_hash = { 'defaultLocale' => 'pt' }
126- translation_files = double ( 'AppFile' , relative_path : 'translations/en.json' )
127- allow ( @package ) . to receive_messages ( translation_files : [ translation_files ] )
128128
129129 expect ( @package ) . to have_error ( /Missing translation file/ )
130130 end
131131
132132 it 'should not error when using {{setting.}}' do
133133 package = create_package ( 'defaultLocale' => 'en' )
134- translation_files = double ( 'AppFile' , relative_path : 'translations/en.json' )
135- allow ( @package ) . to receive_messages ( translation_files : [ translation_files ] )
136134 allow ( package . manifest . location_options . first ) . to receive ( :url ) { 'https://zen.{{setting.test}}.com/apps' }
137135
138136 expect ( package ) . not_to have_error
@@ -562,11 +560,6 @@ def create_package(parameter_hash)
562560 end
563561
564562 context 'with invalid parameters' do
565- before do
566- allow ( ZendeskAppsSupport ::Validations ::Manifest ) . to receive ( :default_locale_error )
567- allow ( ZendeskAppsSupport ::Validations ::Manifest ) . to receive ( :invalid_location_error )
568- allow ( ZendeskAppsSupport ::Validations ::Manifest ) . to receive ( :invalid_version_error )
569- end
570563
571564 it 'has an error when the app parameters are not an array' do
572565 parameter_hash = {
@@ -904,12 +897,6 @@ def create_package(parameter_hash)
904897 context 'when a parameter has scopes and is secure' do
905898 it 'should not have an error for valid scope values' do
906899 @manifest_hash = {
907- 'defaultLocale' => 'en' ,
908- 'location' => {
909- 'support' => {
910- 'ticket_sidebar' => 'https://example.com/app'
911- }
912- } ,
913900 'parameters' => [
914901 {
915902 'name' => 'api_token' ,
@@ -920,8 +907,6 @@ def create_package(parameter_hash)
920907 ]
921908 }
922909 package = create_package ( @manifest_hash )
923- translation_files = double ( 'AppFile' , relative_path : 'translations/en.json' )
924- allow ( package ) . to receive_messages ( translation_files : [ translation_files ] )
925910 expect ( package ) . not_to have_error
926911 end
927912
@@ -971,12 +956,6 @@ def create_package(parameter_hash)
971956 context 'when a parameter has no scopes' do
972957 it 'should not have any scope-related errors' do
973958 @manifest_hash = {
974- 'defaultLocale' => 'en' ,
975- 'location' => {
976- 'support' => {
977- 'ticket_sidebar' => 'https://example.com/app'
978- }
979- } ,
980959 'parameters' => [
981960 {
982961 'name' => 'api_token' ,
@@ -986,8 +965,6 @@ def create_package(parameter_hash)
986965 ]
987966 }
988967 package = create_package ( @manifest_hash )
989- translation_files = double ( 'AppFile' , relative_path : 'translations/en.json' )
990- allow ( package ) . to receive_messages ( translation_files : [ translation_files ] )
991968 expect ( package ) . not_to have_error
992969 end
993970 end
0 commit comments