Skip to content

Commit

Permalink
updated the uploader to respect the configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
jejacks0n committed Jun 22, 2011
1 parent 19a3802 commit ce87285
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/assets/javascripts/mercury/uploader.js.coffee
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@Mercury.uploader = (file, options) ->
Mercury.uploader.show(file, options)
Mercury.uploader.show(file, options) if Mercury.config.uploading.enabled
return Mercury.uploader

jQuery.extend Mercury.uploader, {
Expand Down
8 changes: 7 additions & 1 deletion spec/javascripts/mercury/uploader_spec.js.coffee
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
require '/assets/mercury/mercury.js'
require '/assets/mercury.js'

describe "Mercury.uploader", ->

template 'mercury/uploader.html'

beforeEach ->
Mercury.config.uploading.enabled = true
$.fx.off = true
@mockFile = {
size: 1024
Expand All @@ -28,6 +29,11 @@ describe "Mercury.uploader", ->
ret = Mercury.uploader(@mockFile)
expect(ret).toEqual(Mercury.uploader)

it "doesn't call show if disabled in configuration", ->
Mercury.config.uploading.enabled = false
Mercury.uploader(@mockFile)
expect(@showSpy.callCount).toEqual(0)


describe "#show", ->

Expand Down

0 comments on commit ce87285

Please sign in to comment.