Skip to content

Commit

Permalink
Removes replacements copy-paste
Browse files Browse the repository at this point in the history
  • Loading branch information
Gromych committed Mar 3, 2016
1 parent a96a72e commit 6330b4c
Showing 1 changed file with 11 additions and 24 deletions.
35 changes: 11 additions & 24 deletions test/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,17 @@ var File = require('vinyl');

describe('gulp-replace', function() {
describe('replacePlugin()', function() {
var replacements;

beforeEach(function () {
replacements = [
'cow',
'chicken',
'duck',
'person'
];
});

describe('buffered input', function () {
var file;

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


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


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

it('should call function once for each replacement when replacing a string on a stream', function(done) {
var replacements = [
'cow',
'chicken',
'duck',
'person'
];
var stream = replacePlugin('world', function() { return replacements.shift(); });
stream.on('data', function(newFile) {
newFile.contents.pipe(concatStream({encoding: 'string'}, function(data) {
Expand All @@ -196,12 +189,6 @@ describe('gulp-replace', function() {
});

it('should call function once for each replacement when replacing a regex on a stream', function(done) {
var replacements = [
'cow',
'chicken',
'duck',
'person'
];
var stream = replacePlugin(/world/g, function() { return replacements.shift(); });
stream.on('data', function(newFile) {
newFile.contents.pipe(concatStream({encoding: 'string'}, function(data) {
Expand Down

0 comments on commit 6330b4c

Please # to comment.