Sha256: 17bb6ec6726b5285ebe1a035eb7bbf1c53918d4f48508580f0356237eb7837eb

Contents?: true

Size: 1.47 KB

Versions: 16

Compression:

Stored size: 1.47 KB

Contents

describe('Notice', function() {
  var server, noticeUtility, callback;
  var actionType, description, participantId;

  beforeEach(function() {
    actionType = "SocialNetworking::Goal";
    description = "Completed a goal."
    participantId = 1;

    server = sinon.fakeServer.create();
    callback = sinon.spy();
    noticeUtility = window.Notice
  });

  afterEach(function() {
    server.restore();
  });

  describe('#behaviorPostNotice', function() {
    it('should trigger #behaviorRealTimeToast upon success', function() {
      expect(noticeUtility.behaviorPostNotice).toBeTruthy();
      noticeUtility.behaviorRealTimeToast = callback;
      noticeUtility.behaviorPostNotice(actionType, description, participantId);

      expect(server.requests.length).toBe(1);
      expect(server.requests[0].url).toBe("/participant_behaviors/complete");
    });
  });

  describe('#incentivePostNotice', function() {
    it('should trigger #incentivRealTimeToast upon success', function() {
      expect(noticeUtility.incentivePostNotice).toBeTruthy();
      noticeUtility.incentivRealTimeToast = callback;
      noticeUtility.incentivePostNotice(actionType, description, participantId);

      expect(server.requests.length).toBe(1);
      expect(server.requests[0].url).toBe("/participant_incentives/complete");
    });
  });

  it('should offer a public incentive specific notification function (behaviorPostNotice)', function() {
    expect(noticeUtility.behaviorPostNotice).toBeTruthy();
  });
});

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
social_networking-0.13.3 spec/javascripts/social_networking/notices_spec.js
social_networking-0.13.2 spec/javascripts/social_networking/notices_spec.js
social_networking-0.13.1 spec/javascripts/social_networking/notices_spec.js
social_networking-0.13.0 spec/javascripts/social_networking/notices_spec.js
social_networking-0.12.0 spec/javascripts/social_networking/notices_spec.js
social_networking-0.11.8 spec/javascripts/social_networking/notices_spec.js
social_networking-0.11.7 spec/javascripts/social_networking/notices_spec.js
social_networking-0.11.6 spec/javascripts/social_networking/notices_spec.js
social_networking-0.11.5 spec/javascripts/social_networking/notices_spec.js
social_networking-0.11.4 spec/javascripts/social_networking/notices_spec.js
social_networking-0.11.3 spec/javascripts/social_networking/notices_spec.js
social_networking-0.11.2 spec/javascripts/social_networking/notices_spec.js
social_networking-0.11.1 spec/javascripts/social_networking/notices_spec.js
social_networking-0.11.0 spec/javascripts/social_networking/notices_spec.js
social_networking-0.10.0 spec/javascripts/social_networking/notices_spec.js
social_networking-0.9.3 spec/javascripts/social_networking/notices_spec.js