should_clean 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --colour
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in should_clean.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 TODO: Write your name
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # ShouldClean
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'should_clean'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install should_clean
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
data/bin/should_clean ADDED
@@ -0,0 +1,26 @@
1
+ #!/usr/bin/env ruby
2
+ here = File.expand_path(File.dirname(__FILE__))
3
+ $:<< "#{here}/../lib"
4
+
5
+ require 'optparse'
6
+ require 'should_clean'
7
+
8
+ options = {}
9
+
10
+ OptionParser.new do |opts|
11
+ opts.banner = "Usage: should_clean -d DIRECTORY"
12
+
13
+ opts.on('-d DIRECTORY', 'directory to run should_clean') do |directory|
14
+ options[:directory] = directory
15
+ end
16
+
17
+ opts.on('-s', 'simulate the cleaner') do |simulate|
18
+ options[:simulate] = simulate
19
+ end
20
+ end.parse!
21
+
22
+ if options[:directory].nil?
23
+ system("#{__FILE__} --help")
24
+ else
25
+ ShouldClean.clean(options[:directory], options[:simulate])
26
+ end
@@ -0,0 +1,22 @@
1
+ module ShouldClean
2
+ module Adverbs
3
+ extend self
4
+
5
+ def all
6
+ @adverbs ||= load_adverbs
7
+ end
8
+
9
+ private
10
+ def load_adverbs
11
+ data = File.read( __FILE__ ).split( /^__END__$/ ).last.strip
12
+ verbs = data.split("\n").map { |line| line.strip }
13
+ end
14
+ end
15
+ end
16
+
17
+ __END__
18
+ by default
19
+ only
20
+ automatically
21
+ auto
22
+ correctly
@@ -0,0 +1,19 @@
1
+ module ShouldClean
2
+ module Cleaner
3
+ def self.clean(text)
4
+
5
+ # order of convertors matter
6
+ convertors = [
7
+ Converters::NegativeConverter,
8
+ Converters::AdverbConverter,
9
+ Converters::RegularVerbConverter
10
+ ]
11
+
12
+ convertor = convertors.detect { |converter| text.match(converter.matcher) }
13
+
14
+ if convertor
15
+ convertor.new(text, Regexp.last_match).convert
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,62 @@
1
+ module ShouldClean
2
+ module Conjugator
3
+ extend self
4
+
5
+ # Hash of irregular verb, read from the DATA section of the file
6
+ IRREGULAR_VERBS = {}
7
+
8
+ def third_person_present(verb)
9
+ @irregular_verbs ||= load_irregular_verbs
10
+ verb = verb.to_s.downcase
11
+
12
+ if result = get_irregular(verb)
13
+ result
14
+ else
15
+ get_regular(verb)
16
+ end
17
+ end
18
+ alias :tpp :third_person_present
19
+
20
+ private
21
+ def get_irregular(verb)
22
+ @irregular_verbs[verb] or return nil
23
+ end
24
+
25
+ ### Conjugate the specified +verb+ in the present tense third person.
26
+ def get_regular(verb)
27
+ case verb
28
+ when /(ch|s|sh|x|z)$/
29
+ return verb + 'es'
30
+ when /(ay|ey|oy|uy)$/
31
+ return verb + 's'
32
+ when /[^aeiou]y$/
33
+ return verb[ 0..-2 ] + 'ies'
34
+ else
35
+ return verb + 's'
36
+ end
37
+ end
38
+
39
+ def load_irregular_verbs
40
+ data = File.read( __FILE__ ).split( /^__END__$/ ).last.strip
41
+
42
+ verbs = data.split("\n").map do |line|
43
+ line.split(/\|/).map { |verb| verb.strip }
44
+ end
45
+
46
+ Hash[*verbs.flatten]
47
+ end
48
+ end
49
+ end
50
+
51
+ __END__
52
+ be | is
53
+ do | does
54
+ go | goes
55
+ have | has
56
+ outdo | outdoes
57
+ predo | predoes
58
+ redo | redoes
59
+ undergo | undergoes
60
+ undo | undoes
61
+ rollback | rolls back
62
+ setup | sets up
@@ -0,0 +1,23 @@
1
+ module ShouldClean
2
+ module Converters
3
+ class AdverbConverter < Converter
4
+
5
+ def self.matcher
6
+ /should (#{ShouldClean::Adverbs.all.join('|')})/
7
+ end
8
+
9
+ def convert
10
+ prefix, postfix = text.split(splitter, 2)
11
+ verb, remainder = postfix.lstrip.split(/\W/, 2) # split limit gives the regexp match $&
12
+ active_verb = Conjugator.tpp(verb)
13
+ "#{prefix}#{adverb} #{active_verb}#{$&}#{remainder}"
14
+ end
15
+
16
+ private
17
+ def adverb
18
+ match_data[1]
19
+ end
20
+
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,18 @@
1
+ module ShouldClean
2
+ module Converters
3
+ class Converter
4
+ attr_accessor :text, :match_data
5
+
6
+ def initialize(text, match_data)
7
+ @text = text
8
+ @match_data = match_data
9
+ end
10
+
11
+ private
12
+ def splitter
13
+ match_data[0]
14
+ end
15
+
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,15 @@
1
+ module ShouldClean
2
+ module Converters
3
+ class NegativeConverter < Converter
4
+
5
+ def self.matcher
6
+ /should( not|n't)/
7
+ end
8
+
9
+ def convert
10
+ text.gsub(splitter, 'does not')
11
+ end
12
+
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,18 @@
1
+ module ShouldClean
2
+ module Converters
3
+ class RegularVerbConverter < Converter
4
+
5
+ def self.matcher
6
+ /should (be able to)?/
7
+ end
8
+
9
+ def convert
10
+ method_name, description = text.split(splitter, 2)
11
+ verb, rest = description.lstrip.split(/\W/, 2) # split limit gives the regexp match $&
12
+ active_verb = Conjugator.tpp(verb)
13
+ "#{method_name}#{active_verb}#{$&}#{rest}"
14
+ end
15
+
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,8 @@
1
+ module ShouldClean
2
+ module Converters
3
+ autoload :Converter, 'should_clean/converters/converter'
4
+ autoload :NegativeConverter, 'should_clean/converters/negative_converter'
5
+ autoload :RegularVerbConverter, 'should_clean/converters/regular_verb_converter'
6
+ autoload :AdverbConverter, 'should_clean/converters/adverb_converter'
7
+ end
8
+ end
@@ -0,0 +1,34 @@
1
+ require 'fileutils'
2
+ require 'tempfile'
3
+
4
+ module ShouldClean
5
+ class Replacer
6
+ MATCHER = /^it\s*('|"|%{)/
7
+
8
+ attr_accessor :file_path, :content
9
+
10
+ def initialize(file_path)
11
+ @file_path = file_path
12
+ @content = File.read(file_path)
13
+ end
14
+
15
+ def run
16
+ return unless content.valid_encoding?
17
+
18
+ tmp_file = Tempfile.new('tmp.txt')
19
+
20
+ content.each_line.each do |line|
21
+ if line.strip.match(MATCHER)
22
+ cleaned = Cleaner.clean(line)
23
+ tmp_file.puts cleaned || line
24
+ else
25
+ tmp_file.puts line
26
+ end
27
+ end
28
+
29
+ tmp_file.close
30
+
31
+ FileUtils.mv(tmp_file, file_path)
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,29 @@
1
+ require 'fileutils'
2
+ require 'tempfile'
3
+
4
+ module ShouldClean
5
+ class Simulator
6
+ MATCHER = /^it\s*('|"|%{)/
7
+
8
+ attr_accessor :content, :buffer
9
+
10
+ def initialize(file_path, buffer = $stdout)
11
+ @content = File.read(file_path)
12
+ @buffer = buffer
13
+ end
14
+
15
+ def run
16
+ return unless content.valid_encoding?
17
+
18
+ content.each_line.each do |line|
19
+ if line.strip.match(MATCHER)
20
+ cleaned = Cleaner.clean(line)
21
+ if cleaned
22
+ buffer.puts("- #{line.strip}")
23
+ buffer.puts("+ #{cleaned.strip}")
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,3 @@
1
+ module ShouldClean
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,22 @@
1
+ require "should_clean/version"
2
+ require 'find'
3
+
4
+ module ShouldClean
5
+ autoload :Replacer, 'should_clean/replacer'
6
+ autoload :Cleaner, 'should_clean/cleaner'
7
+ autoload :Simulator, 'should_clean/simulator'
8
+ autoload :Adverbs, 'should_clean/adverbs'
9
+ autoload :Conjugator, 'should_clean/conjugator'
10
+ autoload :Converters, 'should_clean/converters'
11
+
12
+ def self.clean(dir, dry_run = true)
13
+ runner_klass = dry_run ? Simulator : Replacer
14
+
15
+ Find.find(dir) do |path|
16
+ if path.match /_spec\.rb$/
17
+ runner = runner_klass.new(path)
18
+ runner.run
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,19 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/should_clean/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["Sachin Ranchod", "Dalibor Nasevic"]
6
+ gem.email = ["sachin.ranchod@gmail.com", "dalibor.nasevic@gmail.com"]
7
+ gem.description = %q{Clean should from test libraries}
8
+ gem.summary = %q{It changes "it should do" to "it does"}
9
+ gem.homepage = ""
10
+
11
+ gem.files = `git ls-files`.split($\)
12
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
13
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
14
+ gem.name = "should_clean"
15
+ gem.require_paths = ["lib"]
16
+ gem.version = ShouldClean::VERSION
17
+
18
+ gem.add_development_dependency "rspec"
19
+ end
@@ -0,0 +1,12 @@
1
+ require File.dirname(__FILE__) + '/../../../spec_helper'
2
+
3
+ describe Notification do
4
+
5
+ it "should instantiate a notification for a given transaction ����" do
6
+ notification = BankStatement::Notification.for(:transaction => @transaction)
7
+ notification.is_a?(BankStatement::Notification).should be_true
8
+ notification.transaction.should == @transaction
9
+ end
10
+ end
11
+
12
+ hפ���g�<� ��x?name(__FILE__) + '/../../../spec_helper'
@@ -0,0 +1,28 @@
1
+ require 'spec_helper'
2
+
3
+ describe "Example" do
4
+ describe "namespace" do
5
+ it { should == "namespace" }
6
+
7
+ it do
8
+ should == "namespace"
9
+ end
10
+
11
+ it "creates some (should another)" do
12
+ 1.should == 1
13
+ end
14
+
15
+ it "does something" do
16
+ 1.should == 1
17
+ end
18
+
19
+ it 'does something' do
20
+ italian = "hi"
21
+ italian.should == "hi"
22
+ end
23
+
24
+ it %{does something} do
25
+ "it".should == "it"
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,28 @@
1
+ require 'spec_helper'
2
+
3
+ describe "Example" do
4
+ describe "namespace" do
5
+ it { should == "namespace" }
6
+
7
+ it do
8
+ should == "namespace"
9
+ end
10
+
11
+ it "should create some (should another)" do
12
+ 1.should == 1
13
+ end
14
+
15
+ it "should do something" do
16
+ 1.should == 1
17
+ end
18
+
19
+ it 'should do something' do
20
+ italian = "hi"
21
+ italian.should == "hi"
22
+ end
23
+
24
+ it %{should do something} do
25
+ "it".should == "it"
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,2 @@
1
+ class Example
2
+ end
@@ -0,0 +1,28 @@
1
+ require 'spec_helper'
2
+
3
+ describe "Example" do
4
+ describe "namespace" do
5
+ it { should == "namespace" }
6
+
7
+ it do
8
+ should == "namespace"
9
+ end
10
+
11
+ it "should create some (should another)" do
12
+ 1.should == 1
13
+ end
14
+
15
+ it "should do something" do
16
+ 1.should == 1
17
+ end
18
+
19
+ it 'should do something' do
20
+ italian = "hi"
21
+ italian.should == "hi"
22
+ end
23
+
24
+ it %{should do something} do
25
+ "it".should == "it"
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,70 @@
1
+ require 'spec_helper'
2
+
3
+ describe ShouldClean::Cleaner do
4
+
5
+ describe "normal conversion from future to present tense" do
6
+ it "converts spec defined with double quotes" do
7
+ ShouldClean::Cleaner.clean('it "should action something"').
8
+ should == 'it "actions something"'
9
+ end
10
+
11
+ it %{converts spec defined with percentage} do
12
+ ShouldClean::Cleaner.clean('it %{should action something}').
13
+ should == 'it %{actions something}'
14
+ end
15
+
16
+ it 'converts spec defined with single quotes' do
17
+ ShouldClean::Cleaner.clean("it 'should action something'").
18
+ should == "it 'actions something'"
19
+ end
20
+
21
+ it "converts spec with auxilliary verb 'do' to 'does'" do
22
+ ShouldClean::Cleaner.clean('it "should do something"').
23
+ should == 'it "does something"'
24
+ end
25
+ end
26
+
27
+ describe "conversion of should variations" do
28
+ it "converts 'should not action' to 'does not action'" do
29
+ ShouldClean::Cleaner.clean('it "should not action"').
30
+ should == 'it "does not action"'
31
+ end
32
+
33
+ it "converts 'shouldn't action' to 'does not action'" do
34
+ ShouldClean::Cleaner.clean('it "shouldn\'t action"').
35
+ should == 'it "does not action"'
36
+ end
37
+
38
+ it "converts 'should be able to action' to 'actions'" do
39
+ ShouldClean::Cleaner.clean('it "should be able to action"').
40
+ should == 'it "actions"'
41
+ end
42
+ end
43
+
44
+ describe "conversion of adverbs" do
45
+ it "converts 'should correctly calculate' to 'correctly calculates'" do
46
+ ShouldClean::Cleaner.clean('it "should correctly calculate"').
47
+ should == 'it "correctly calculates"'
48
+ end
49
+
50
+ it "converts 'should auto generate' to 'auto generate'" do
51
+ ShouldClean::Cleaner.clean('it "should auto generate"').
52
+ should == 'it "auto generates"'
53
+ end
54
+
55
+ it "converts 'should automatically generate' to 'automatically generates'" do
56
+ ShouldClean::Cleaner.clean('it "should automatically generate"').
57
+ should == 'it "automatically generates"'
58
+ end
59
+
60
+ it "converts 'should only list' to 'only lists'" do
61
+ ShouldClean::Cleaner.clean('it "should only list"').
62
+ should == 'it "only lists"'
63
+ end
64
+
65
+ it "converts 'should by default have' to 'by default has'" do
66
+ ShouldClean::Cleaner.clean('it "should by default have"').
67
+ should == 'it "by default has"'
68
+ end
69
+ end
70
+ end
@@ -0,0 +1,79 @@
1
+ require 'spec_helper'
2
+
3
+ describe ShouldClean::Conjugator do
4
+ describe "third person present" do
5
+ it "converts verbs" do
6
+ ShouldClean::Conjugator.third_person_present('action').should == 'actions'
7
+ end
8
+ end
9
+
10
+ describe "regular third person present conversions" do
11
+ it "converts verb ending with 'ch'" do
12
+ ShouldClean::Conjugator.tpp('teach').should == 'teaches'
13
+ end
14
+
15
+ it "converts verb ending with 's'" do
16
+ ShouldClean::Conjugator.tpp('progress').should == 'progresses'
17
+ end
18
+
19
+ it "converts verb ending with 'sh'" do
20
+ ShouldClean::Conjugator.tpp('push').should == 'pushes'
21
+ end
22
+
23
+ it "converts verb ending with 'x'" do
24
+ ShouldClean::Conjugator.tpp('mix').should == 'mixes'
25
+ end
26
+
27
+ it "converts verb ending with 'z'" do
28
+ ShouldClean::Conjugator.tpp('buzz').should == 'buzzes'
29
+ end
30
+
31
+ it "converts verb ending with 'ay'" do
32
+ ShouldClean::Conjugator.tpp('slay').should == 'slays'
33
+ end
34
+
35
+ it "converts verb ending with 'ey'" do
36
+ ShouldClean::Conjugator.tpp('prey').should == 'preys'
37
+ end
38
+
39
+ it "converts verb ending with 'oy'" do
40
+ ShouldClean::Conjugator.tpp('enjoy').should == 'enjoys'
41
+ end
42
+
43
+ it "converts verb ending with 'uy'" do
44
+ ShouldClean::Conjugator.tpp('buy').should == 'buys'
45
+ end
46
+
47
+ it "converts verb ending with consonant" do
48
+ ShouldClean::Conjugator.tpp('action').should == 'actions'
49
+ end
50
+
51
+ it "converts verb ending with consonant + 'y'" do
52
+ ShouldClean::Conjugator.tpp('modify').should == 'modifies'
53
+ end
54
+ end
55
+
56
+ describe "irregular third person present conversions" do
57
+ it "converts verb 'be'" do
58
+ ShouldClean::Conjugator.tpp('be').should == 'is'
59
+ end
60
+
61
+ it "converts verb 'do'" do
62
+ ShouldClean::Conjugator.tpp('do').should == 'does'
63
+ end
64
+
65
+ it "converts verb 'have'" do
66
+ ShouldClean::Conjugator.tpp('have').should == 'has'
67
+ end
68
+ end
69
+
70
+ describe "special third person present conversions" do
71
+ it "converts verb 'rollback'" do
72
+ ShouldClean::Conjugator.tpp('rollback').should == 'rolls back'
73
+ end
74
+
75
+ it "converts verb 'setup'" do
76
+ ShouldClean::Conjugator.tpp('setup').should == 'sets up'
77
+ end
78
+ end
79
+ end
@@ -0,0 +1,31 @@
1
+ require 'spec_helper'
2
+
3
+ describe ShouldClean::Replacer do
4
+
5
+ let(:spec_file) { File.join(File.dirname(__FILE__), '..', 'fixtures', 'example_spec.txt') }
6
+ let(:correct_spec_file) { File.join(File.dirname(__FILE__), '..', 'fixtures', 'example_correct_spec.txt') }
7
+
8
+ before :each do
9
+ @file = File.open(spec_file, 'r+')
10
+ @original_content = @file.read
11
+ @file.rewind
12
+ end
13
+
14
+ after :each do
15
+ File.open(spec_file, 'w') do |file|
16
+ file.puts @original_content
17
+ end
18
+ end
19
+
20
+ it "writes changes to the file" do
21
+ replacer = ShouldClean::Replacer.new(spec_file)
22
+ replacer.run
23
+ FileUtils.compare_file(spec_file, correct_spec_file).should be_true
24
+ end
25
+
26
+ it "does not raise exception when file has invalid encoding" do
27
+ spec_file = File.join(File.dirname(__FILE__), '..', 'fixtures', 'broken_spec.txt')
28
+ replacer = ShouldClean::Replacer.new(spec_file)
29
+ lambda { replacer.run }.should_not raise_exception(ArgumentError)
30
+ end
31
+ end
@@ -0,0 +1,29 @@
1
+ require 'spec_helper'
2
+
3
+ describe ShouldClean::Simulator do
4
+
5
+ let(:spec_file) { File.join(File.dirname(__FILE__), '..', 'fixtures', 'example_spec.txt') }
6
+ let(:buffer) { StringIO.new }
7
+
8
+ it "displays a diff of changes" do
9
+ simulator = ShouldClean::Simulator.new(spec_file, buffer)
10
+ simulator.run
11
+ buffer.string.should == <<eos
12
+ - it "should create some (should another)" do
13
+ + it "creates some (should another)" do
14
+ - it "should do something" do
15
+ + it "does something" do
16
+ - it 'should do something' do
17
+ + it 'does something' do
18
+ - it %{should do something} do
19
+ + it %{does something} do
20
+ eos
21
+ end
22
+
23
+ it "does not raise exception when file has invalid encoding" do
24
+ spec_file = File.join(File.dirname(__FILE__), '..', 'fixtures', 'broken_spec.txt')
25
+ buffer = StringIO.new
26
+ simulator = ShouldClean::Simulator.new(spec_file, buffer)
27
+ lambda { simulator.run }.should_not raise_exception(ArgumentError)
28
+ end
29
+ end
@@ -0,0 +1,24 @@
1
+ require 'spec_helper'
2
+
3
+ describe ShouldClean do
4
+ let(:spec_file) { File.join(File.dirname(__FILE__), 'fixtures', 'project', 'spec', 'models', 'example_spec.rb') }
5
+ let(:example_file) { File.join(File.dirname(__FILE__), 'fixtures', 'example_spec.txt') }
6
+ let(:correct_spec_file) { File.join(File.dirname(__FILE__), 'fixtures', 'example_correct_spec.txt') }
7
+
8
+ before :each do
9
+ FileUtils.cp(example_file, spec_file)
10
+ @original_content = File.read(spec_file)
11
+ end
12
+
13
+ after :each do
14
+ File.open(spec_file, 'w') do |file|
15
+ file.puts @original_content
16
+ end
17
+ end
18
+
19
+ it "can clean multiple files" do
20
+ app_directory = File.join(File.dirname(__FILE__), 'fixtures', 'project')
21
+ ShouldClean.clean(app_directory, false)
22
+ FileUtils.compare_file(spec_file, correct_spec_file).should be_true
23
+ end
24
+ end
@@ -0,0 +1 @@
1
+ require 'should_clean'
metadata ADDED
@@ -0,0 +1,106 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: should_clean
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Sachin Ranchod
9
+ - Dalibor Nasevic
10
+ autorequire:
11
+ bindir: bin
12
+ cert_chain: []
13
+ date: 2012-09-04 00:00:00.000000000 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: rspec
17
+ requirement: !ruby/object:Gem::Requirement
18
+ none: false
19
+ requirements:
20
+ - - ! '>='
21
+ - !ruby/object:Gem::Version
22
+ version: '0'
23
+ type: :development
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ! '>='
29
+ - !ruby/object:Gem::Version
30
+ version: '0'
31
+ description: Clean should from test libraries
32
+ email:
33
+ - sachin.ranchod@gmail.com
34
+ - dalibor.nasevic@gmail.com
35
+ executables:
36
+ - should_clean
37
+ extensions: []
38
+ extra_rdoc_files: []
39
+ files:
40
+ - .gitignore
41
+ - .rspec
42
+ - Gemfile
43
+ - LICENSE
44
+ - README.md
45
+ - Rakefile
46
+ - bin/should_clean
47
+ - lib/should_clean.rb
48
+ - lib/should_clean/adverbs.rb
49
+ - lib/should_clean/cleaner.rb
50
+ - lib/should_clean/conjugator.rb
51
+ - lib/should_clean/converters.rb
52
+ - lib/should_clean/converters/adverb_converter.rb
53
+ - lib/should_clean/converters/converter.rb
54
+ - lib/should_clean/converters/negative_converter.rb
55
+ - lib/should_clean/converters/regular_verb_converter.rb
56
+ - lib/should_clean/replacer.rb
57
+ - lib/should_clean/simulator.rb
58
+ - lib/should_clean/version.rb
59
+ - should_clean.gemspec
60
+ - spec/fixtures/broken_spec.txt
61
+ - spec/fixtures/example_correct_spec.txt
62
+ - spec/fixtures/example_spec.txt
63
+ - spec/fixtures/project/app/models/example.rb
64
+ - spec/fixtures/project/spec/models/example_spec.rb
65
+ - spec/should_clean/cleaner_spec.rb
66
+ - spec/should_clean/conjugator_spec.rb
67
+ - spec/should_clean/replacer_spec.rb
68
+ - spec/should_clean/simulator_spec.rb
69
+ - spec/should_clean_spec.rb
70
+ - spec/spec_helper.rb
71
+ homepage: ''
72
+ licenses: []
73
+ post_install_message:
74
+ rdoc_options: []
75
+ require_paths:
76
+ - lib
77
+ required_ruby_version: !ruby/object:Gem::Requirement
78
+ none: false
79
+ requirements:
80
+ - - ! '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ required_rubygems_version: !ruby/object:Gem::Requirement
84
+ none: false
85
+ requirements:
86
+ - - ! '>='
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ requirements: []
90
+ rubyforge_project:
91
+ rubygems_version: 1.8.23
92
+ signing_key:
93
+ specification_version: 3
94
+ summary: It changes "it should do" to "it does"
95
+ test_files:
96
+ - spec/fixtures/broken_spec.txt
97
+ - spec/fixtures/example_correct_spec.txt
98
+ - spec/fixtures/example_spec.txt
99
+ - spec/fixtures/project/app/models/example.rb
100
+ - spec/fixtures/project/spec/models/example_spec.rb
101
+ - spec/should_clean/cleaner_spec.rb
102
+ - spec/should_clean/conjugator_spec.rb
103
+ - spec/should_clean/replacer_spec.rb
104
+ - spec/should_clean/simulator_spec.rb
105
+ - spec/should_clean_spec.rb
106
+ - spec/spec_helper.rb