Sha256: 230eaf685d065e97735bfe9c25222a4612f38569007a9b97be201b66e61caa60

Contents?: true

Size: 879 Bytes

Versions: 1

Compression:

Stored size: 879 Bytes

Contents

SimpleSubmitter = require "hoarder/submitter/submitters/simple_submitter"

describe "SimpleSubmitter", ->
  submitter = null

  beforeEach ->
    submitter = new SimpleSubmitter()

  it "can submit a form, and respond to a successful submit", ->
    spyOn(submitter.submittedWithSuccess, "dispatch")
    spyOn($,"ajax").andCallFake( (params)-> params.success(mocks.submitSimpleFormResponse))
    submitter.submitForm(mocks.simpleForm)
    expect(submitter.submittedWithSuccess.dispatch).toHaveBeenCalledWith(mocks.simpleForm, mocks.submitSimpleFormResponse)

  it "can respond to an error-ridden submission", ->
    spyOn($, "ajax").andCallFake( (params)-> params.error({}, "Error!"))
    spyOn(submitter.submittedWithError, "dispatch")
    submitter.submitForm(mocks.simpleForm)
    expect(submitter.submittedWithError.dispatch).toHaveBeenCalledWith(mocks.simpleForm, "Error!" )

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hoarder-js-0.0.1 spec/tests/submitter/submitters/simple_submitter_spec.coffee