{:uriI"�file:///Users/marten/rgoc/quby/spec/javascripts/flags_collection_spec.coffee?type=application/javascript&pipeline=self&id=1e38f1fa95cb7fe288b832cb7e4e1e1d216e8a12c6d60f83571924179128d7f0:ET:load_pathI"-/Users/marten/rgoc/quby/spec/javascripts;T:
filenameI"J/Users/marten/rgoc/quby/spec/javascripts/flags_collection_spec.coffee;T:	nameI"flags_collection_spec;T:logical_pathI""flags_collection_spec.self.js;T:content_typeI"application/javascript;T:sourceI"�(function() {
  describe("Quby.Collections.Flags", function() {
    describe("#initShowsHides", function() {
      beforeEach(function() {
        this.flagsC = new Quby.Collections.Flags;
        this.flag1 = new Quby.Models.Flag({
          key: 'test1',
          hidesQuestionsKeys: ["v_1"],
          showsQuestionsKeys: ["v_2"]
        });
        this.flag2 = new Quby.Models.Flag({
          key: 'test2',
          hidesQuestionsKeys: ["v_2"],
          showsQuestionsKeys: ["v_1"]
        });
        this.v_1 = new Quby.Models.Question({
          key: "v_1"
        });
        this.v_2 = new Quby.Models.Question({
          key: "v_2"
        });
        this.questions = new Quby.Collections.Questions([this.v_1, this.v_2]);
        return this.flagsC.add([this.flag1, this.flag2]);
      });
      return it("calls initshowshides on each flag", function() {
        var spy1, spy2;
        spy1 = sinon.spy(this.flagsC.first(), 'initShowsHides');
        spy2 = sinon.spy(this.flagsC.last(), 'initShowsHides');
        this.flagsC.initShowsHides(this.questions);
        expect(spy1).toHaveBeenCalledWith(this.questions);
        return expect(spy2).toHaveBeenCalledWith(this.questions);
      });
    });
    return describe('#addFlags', function() {
      beforeEach(function() {
        return this.flagsC = new Quby.Collections.Flags;
      });
      return it('combines the values from the flag_values object with the definitions from the flag_definitions object', function() {
        var flag_definitions, flag_values;
        flag_values = {
          smokes: true
        };
        flag_definitions = {
          smokes: {
            key: "smokes",
            description_true: "De invuller rookt",
            description_false: "De invuller rookt niet",
            internal: false,
            shows_questions: ['v_33'],
            hides_questions: ['v_2']
          },
          last_measurement_of_day: {
            key: "last_measurement_of_day",
            description_true: "Laatste meting van de dag",
            description_false: "Niet de laatste meting van de dag",
            internal: true,
            shows_questions: [],
            hides_questions: []
          }
        };
        this.flagsC.addFlags(flag_definitions, flag_values);
        expect(this.flagsC.toArray()[0].get('key')).toEqual('smokes');
        expect(this.flagsC.toArray()[0].get('value')).toEqual(true);
        expect(this.flagsC.toArray()[0].get('showsQuestionsKeys')).toEqual(['v_33']);
        expect(this.flagsC.toArray()[0].get('hidesQuestionsKeys')).toEqual(['v_2']);
        expect(this.flagsC.toArray()[1].get('key')).toEqual('last_measurement_of_day');
        expect(this.flagsC.toArray()[1].get('value')).toEqual(null);
        expect(this.flagsC.toArray()[1].get('showsQuestionsKeys')).toEqual([]);
        return expect(this.flagsC.toArray()[1].get('hidesQuestionsKeys')).toEqual([]);
      });
    });
  });

}).call(this);
;T:
metadata{:dependencieso:Set:
@hash}	I"environment-version;TTI"environment-paths;TTI"jprocessors:type=application/javascript&file_type=application/javascript&engines=.coffee&pipeline=self;TTI"Xfile-digest:///Users/marten/rgoc/quby/spec/javascripts/flags_collection_spec.coffee;TTF:
requiredo;;}�F:stubbedo;;}�F:
linkso;;}�F:charsetI"
utf-8;F:digest"%�`���?7*�>I��(�F�⓹�V��JX�:lengthi�:dependencies_digest"%){aq�|2�
I���������r?l;P��9:idI"E1e38f1fa95cb7fe288b832cb7e4e1e1d216e8a12c6d60f83571924179128d7f0;F:
mtimel+�g,]