<commit_before>define(function() {
    describe('Minionette.Region', function() {
        var RegionView = Minionette.View.extend({
            template: _.template('<p>test</p><%= view("region") %><p>test</p>')
        });
        function addInnerView(name, parentView) {
            var v = new Minionette.View({tagName: 'p'});
            v.template = _.template("test");
            v.render();
            parentView.addRegion(name, v);
            parentView.render();
            return v;
        }
        beforeEach(function() {
            this.view = new RegionView();
            this.region = new Minionette.Region({view: this.view});
        });

        describe("#_configure()", function() {
            it("picks view out of initialization options", function() {
                expect(this.region.view).to.equal(this.view);
            });
        });

        describe("#_ensureView()", function() {
            it("sets #view to a #_view if one is not passed in", function() {
                var region = new Minionette.Region();

                expect(region.view).to.equal(region._view);
            });

            it("sets #view to #_view if passed in view isn't an instanceof Backbone.View", function() {
                var region = new Minionette.Region({view: 'view?'});

                expect(region.view).to.equal(region._view);
            });
        });

        describe("#render()", function() {
            it("calls #view#render()", function() {
                var spy = this.sinon.spy(this.view, 'render');

                this.region.render();

                expect(this.spy).to.have.been.called;
            });

            it("returns #view#render()", function() {
                var expected = _.uniqueId();
                this.view.render = function() {
                    return expected;
                };

                var ret = this.region.render();

                expect(ret).to.equal(expected);
            });
        });

        describe("#attach()", function() {
            beforeEach(function() {
                this.newView = new Minionette.View();
            });

            it("replaces current view#el with newView#el (the same index in parent)", function() {
                var v = addInnerView('region', this.view),
                    expectedIndex = v.$el.index();

                this.view.region.attach(this.newView);<commit_msg>Fix incorrect test<commit_after>define(function() {
    describe('Minionette.Region', function() {
        var RegionView = Minionette.View.extend({
            template: _.template('<p>test</p><%= view("region") %><p>test</p>')
        });
        function addInnerView(name, parentView) {
            var v = new Minionette.View({tagName: 'p'});
            v.template = _.template("test");
            v.render();
            parentView.addRegion(name, v);
            parentView.render();
            return v;
        }
        beforeEach(function() {
            this.view = new RegionView();
            this.region = new Minionette.Region({view: this.view});
        });

        describe("#_configure()", function() {
            it("picks view out of initialization options", function() {
                expect(this.region.view).to.equal(this.view);
            });
        });

        describe("#_ensureView()", function() {
            it("sets #view to a #_view if one is not passed in", function() {
                var region = new Minionette.Region();

                expect(region.view).to.equal(region._view);
            });

            it("sets #view to #_view if passed in view isn't an instanceof Backbone.View", function() {
                var region = new Minionette.Region({view: 'view?'});

                expect(region.view).to.equal(region._view);
            });
        });

        describe("#render()", function() {
            it("calls #view#render()", function() {
                var spy = this.sinon.spy(this.view, 'render');

                this.region.render();

                expect(spy).to.have.been.called;
            });

            it("returns #view#render()", function() {
                var expected = _.uniqueId();
                this.view.render = function() {
                    return expected;
                };

                var ret = this.region.render();

                expect(ret).to.equal(expected);
            });
        });

        describe("#attach()", function() {
            beforeEach(function() {
                this.newView = new Minionette.View();
            });

            it("replaces current view#el with newView#el (the same index in parent)", function() {
                var v = addInnerView('region', this.view),
                    expectedIndex = v.$el.index();

                this.view.region.attach(this.newView);
{'fraction_non_alphanumeric': 0.1486151302190988, 'fraction_numerical': 0.0, 'mean_word_length': 1.6471553610503282, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7446497', 'n_tokens_mistral': 1297, 'n_tokens_neox': 1226, 'n_words': 263}