mspec 1.5.13 → 1.5.14
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/lib/mspec/helpers/fs.rb +2 -2
- data/lib/mspec/runner/mspec.rb +5 -5
- data/lib/mspec/version.rb +1 -1
- data/spec/helpers/fs_spec.rb +5 -0
- metadata +2 -2
data/Rakefile
CHANGED
@@ -18,7 +18,7 @@ spec = Gem::Specification.new do |s|
|
|
18
18
|
|
19
19
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
20
20
|
s.authors = ["Brian Ford"]
|
21
|
-
s.date = %q{
|
21
|
+
s.date = %q{2010-01-05}
|
22
22
|
s.email = %q{bford@engineyard.com}
|
23
23
|
s.has_rdoc = true
|
24
24
|
s.extra_rdoc_files = %w[ README LICENSE ]
|
data/lib/mspec/helpers/fs.rb
CHANGED
@@ -48,10 +48,10 @@ class Object
|
|
48
48
|
|
49
49
|
# Creates a file +name+. Creates the directory for +name+
|
50
50
|
# if it does not exist.
|
51
|
-
def touch(name)
|
51
|
+
def touch(name, mode="w")
|
52
52
|
mkdir_p File.dirname(name)
|
53
53
|
|
54
|
-
File.open(name,
|
54
|
+
File.open(name, mode) do |f|
|
55
55
|
yield f if block_given?
|
56
56
|
end
|
57
57
|
end
|
data/lib/mspec/runner/mspec.rb
CHANGED
@@ -265,7 +265,7 @@ module MSpec
|
|
265
265
|
tags = []
|
266
266
|
file = tags_file
|
267
267
|
if File.exist? file
|
268
|
-
File.open(file, "
|
268
|
+
File.open(file, "rb") do |f|
|
269
269
|
f.each_line do |line|
|
270
270
|
line.chomp!
|
271
271
|
next if line.empty?
|
@@ -283,7 +283,7 @@ module MSpec
|
|
283
283
|
file = tags_file
|
284
284
|
path = File.dirname file
|
285
285
|
FileUtils.mkdir_p path unless File.exist? path
|
286
|
-
File.open(file, "
|
286
|
+
File.open(file, "wb") do |f|
|
287
287
|
tags.each { |t| f.puts t }
|
288
288
|
end
|
289
289
|
end
|
@@ -296,11 +296,11 @@ module MSpec
|
|
296
296
|
path = File.dirname file
|
297
297
|
FileUtils.mkdir_p path unless File.exist? path
|
298
298
|
if File.exist? file
|
299
|
-
File.open(file, "
|
299
|
+
File.open(file, "rb") do |f|
|
300
300
|
f.each_line { |line| return false if line.chomp == string }
|
301
301
|
end
|
302
302
|
end
|
303
|
-
File.open(file, "
|
303
|
+
File.open(file, "ab") { |f| f.puts string }
|
304
304
|
return true
|
305
305
|
end
|
306
306
|
|
@@ -313,7 +313,7 @@ module MSpec
|
|
313
313
|
file = tags_file
|
314
314
|
if File.exist? file
|
315
315
|
lines = IO.readlines(file)
|
316
|
-
File.open(file, "
|
316
|
+
File.open(file, "wb") do |f|
|
317
317
|
lines.each do |line|
|
318
318
|
unless pattern =~ line.chomp
|
319
319
|
f.puts line unless line.empty?
|
data/lib/mspec/version.rb
CHANGED
data/spec/helpers/fs_spec.rb
CHANGED
@@ -38,6 +38,11 @@ describe Object, "#touch" do
|
|
38
38
|
File.exists?(@name).should be_true
|
39
39
|
end
|
40
40
|
|
41
|
+
it "accepts an optional mode argument" do
|
42
|
+
touch @name, "wb"
|
43
|
+
File.exists?(@name).should be_true
|
44
|
+
end
|
45
|
+
|
41
46
|
it "overwrites an existing file" do
|
42
47
|
File.open(@name, "w") { |f| f.puts "used" }
|
43
48
|
File.size(@name).should > 0
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mspec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Ford
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date:
|
12
|
+
date: 2010-01-05 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|