Sha256: 637fcf56e449be945dafe7b08f892fd5db8ee52400522f75444b9bf282c7ef2d

Contents?: true

Size: 1.55 KB

Versions: 10

Compression:

Stored size: 1.55 KB

Contents

describe("UserContext", function() {
  it("Behaves just like an plain object", function() {
    var context = new jasmineUnderTest.UserContext(),
        properties = [];

    for (var prop in context) {
      if (obj.hasOwnProperty(prop)) {
        properties.push(prop);
      }
    }

    expect(properties).toEqual([]);
  });

  describe('.fromExisting', function() {
    describe('when using an already built context as model', function() {
      beforeEach(function() {
        this.context = new jasmineUnderTest.UserContext();
        this.context.key = 'value';
        this.cloned = jasmineUnderTest.UserContext.fromExisting(this.context);
      });

      it('returns a cloned object', function() {
        expect(this.cloned).toEqual(this.context);
      });

      it('does not return the same object', function() {
        expect(this.cloned).not.toBe(this.context);
      });
    });

    describe('when using a regular object as parameter', function() {
      beforeEach(function() {
        this.context = {};
        this.value = 'value'
        this.context.key = this.value;
        this.cloned = jasmineUnderTest.UserContext.fromExisting(this.context);
      });

      it('returns an object with the same attributes', function() {
        expect(this.cloned.key).toEqual(this.value);
      });

      it('does not return the same object', function() {
        expect(this.cloned).not.toBe(this.context);
      });

      it('returns an UserContext', function() {
        expect(this.cloned.constructor).toBe(jasmineUnderTest.UserContext);
      });
    });
  });
});

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
tdiary-5.0.8 vendor/bundle/gems/tdiary-5.0.7/vendor/bundle/gems/jasmine-core-2.8.0/lib/jasmine-core/spec/core/UserContextSpec.js
jasmine-core-2.99.1 ./lib/jasmine-core/spec/core/UserContextSpec.js
jasmine-core-3.0.0 ./lib/jasmine-core/spec/core/UserContextSpec.js
jasmine-core-2.99.0 ./lib/jasmine-core/spec/core/UserContextSpec.js
jasmine-core-2.9.1 ./lib/jasmine-core/spec/core/UserContextSpec.js
jasmine-core-2.9.0 ./lib/jasmine-core/spec/core/UserContextSpec.js
tdiary-5.0.7 vendor/bundle/gems/jasmine-core-2.8.0/lib/jasmine-core/spec/core/UserContextSpec.js
tdiary-5.0.6 vendor/bundle/gems/jasmine-core-2.8.0/lib/jasmine-core/spec/core/UserContextSpec.js
jasmine-core-2.8.0 ./lib/jasmine-core/spec/core/UserContextSpec.js
jasmine-core-2.7.0 ./lib/jasmine-core/spec/core/UserContextSpec.js