sugar-high 0.2.4 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.4
1
+ 0.2.5
@@ -36,7 +36,8 @@ class File
36
36
  end
37
37
  end
38
38
 
39
- def self.remove_from file_name, content, &block
39
+ def self.remove_from file_name, content=nil, &block
40
+ content ||= yield
40
41
  replace_content_from file_name, :content => content, :with => '', &block
41
42
  end
42
43
 
@@ -1,5 +1,4 @@
1
1
  require 'rspec'
2
- require 'rspec/autorun'
3
2
  require 'sugar-high'
4
3
 
5
4
  RSpec.configure do |config|
@@ -58,6 +58,20 @@ describe "SugarHigh::File" do
58
58
  end
59
59
  end
60
60
 
61
+ describe '#remove_from with block argument that is content to remove' do
62
+ let(:replace_file) { fixture_file 'file.txt' }
63
+
64
+ it "should remove content from existing file" do
65
+ File.overwrite(replace_file) do
66
+ 'Hello You'
67
+ end
68
+ File.remove_from replace_file do
69
+ 'You'
70
+ end
71
+ File.read(replace_file).should_not match /You/
72
+ end
73
+ end
74
+
61
75
 
62
76
  describe '#insert_into' do
63
77
  let(:insertion_file) { fixture_file 'insertion.txt' }
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{sugar-high}
8
- s.version = "0.2.4"
8
+ s.version = "0.2.5"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Kristian Mandrup"]
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 2
8
- - 4
9
- version: 0.2.4
8
+ - 5
9
+ version: 0.2.5
10
10
  platform: ruby
11
11
  authors:
12
12
  - Kristian Mandrup