Skip to content

Commit 6330b4c

Browse files
author
Gromych
committed
Removes replacements copy-paste
1 parent a96a72e commit 6330b4c

File tree

1 file changed

+11
-24
lines changed

1 file changed

+11
-24
lines changed

test/main.js

+11-24
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,17 @@ var File = require('vinyl');
88

99
describe('gulp-replace', function() {
1010
describe('replacePlugin()', function() {
11+
var replacements;
12+
13+
beforeEach(function () {
14+
replacements = [
15+
'cow',
16+
'chicken',
17+
'duck',
18+
'person'
19+
];
20+
});
21+
1122
describe('buffered input', function () {
1223
var file;
1324

@@ -66,12 +77,6 @@ describe('gulp-replace', function() {
6677

6778

6879
it('should call function once for each replacement when replacing a string on a buffer', function(done) {
69-
var replacements = [
70-
'cow',
71-
'chicken',
72-
'duck',
73-
'person'
74-
];
7580
var stream = replacePlugin('world', function() { return replacements.shift(); });
7681
stream.on('data', function(newFile) {
7782
String(newFile.contents).should.equal(fs.readFileSync('test/expected/hellofarm.txt', 'utf8'));
@@ -84,12 +89,6 @@ describe('gulp-replace', function() {
8489

8590

8691
it('should call function once for each replacement when replacing a regex on a buffer', function(done) {
87-
var replacements = [
88-
'cow',
89-
'chicken',
90-
'duck',
91-
'person'
92-
];
9392
var stream = replacePlugin(/world/g, function() { return replacements.shift(); });
9493
stream.on('data', function(newFile) {
9594
String(newFile.contents).should.equal(fs.readFileSync('test/expected/hellofarm.txt', 'utf8'));
@@ -177,12 +176,6 @@ describe('gulp-replace', function() {
177176
});
178177

179178
it('should call function once for each replacement when replacing a string on a stream', function(done) {
180-
var replacements = [
181-
'cow',
182-
'chicken',
183-
'duck',
184-
'person'
185-
];
186179
var stream = replacePlugin('world', function() { return replacements.shift(); });
187180
stream.on('data', function(newFile) {
188181
newFile.contents.pipe(concatStream({encoding: 'string'}, function(data) {
@@ -196,12 +189,6 @@ describe('gulp-replace', function() {
196189
});
197190

198191
it('should call function once for each replacement when replacing a regex on a stream', function(done) {
199-
var replacements = [
200-
'cow',
201-
'chicken',
202-
'duck',
203-
'person'
204-
];
205192
var stream = replacePlugin(/world/g, function() { return replacements.shift(); });
206193
stream.on('data', function(newFile) {
207194
newFile.contents.pipe(concatStream({encoding: 'string'}, function(data) {

0 commit comments

Comments
 (0)