Skip to content

Commit

Permalink
Merge pull request #51 from zendesk/pochen/quick_fix_logic
Browse files Browse the repository at this point in the history
Quick logic fix logic and re-bump
  • Loading branch information
princemaple committed Feb 21, 2014
2 parents cbc012e + 00c32e6 commit bbd3531
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
zendesk_apps_support (1.14.0)
zendesk_apps_support (1.14.1)
erubis
i18n
jshintrb (= 0.2.4)
Expand Down
5 changes: 4 additions & 1 deletion lib/zendesk_apps_support/validations/source.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ class <<self
def call(package)
source = package.files.find { |f| f.relative_path == 'app.js' }

return [ ValidationError.new(:no_app_js_required) ] if package.requirements_only && source
if package.requirements_only
return source ? [ ValidationError.new(:no_app_js_required) ] : []
end

return [ ValidationError.new(:missing_source) ] unless source

jshint_errors = linter.lint(source.read)
Expand Down
8 changes: 8 additions & 0 deletions spec/validations/source_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@

errors.first.key.should eql :no_app_js_required
end

it 'should not have an error when app.js is not present' do
files = [mock('AppFile', :relative_path => nil)]
package = mock('Package', :files => files, :requirements_only => true)
errors = ZendeskAppsSupport::Validations::Source.call(package)

errors.should be_empty
end
end

context 'when not requirements only' do
Expand Down
2 changes: 1 addition & 1 deletion zendesk_apps_support.gemspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Gem::Specification.new do |s|
s.name = "zendesk_apps_support"
s.version = "1.14.0"
s.version = "1.14.1"
s.license = "Apache License Version 2.0"
s.authors = ["James A. Rosen", "Likun Liu", "Sean Caffery", "Daniel Ribeiro"]
s.email = ["[email protected]"]
Expand Down

0 comments on commit bbd3531

Please sign in to comment.