filetesthelper 0.9.1 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.txt CHANGED
@@ -2,10 +2,7 @@
2
2
 
3
3
  A simple helper aimed at reducing the setup effort needed to create directories, files and file content in the scope of an integration test case.
4
4
 
5
- == Installation
6
- gem install filetesthelper
7
-
8
- == Usage
5
+ == Example
9
6
 
10
7
  require 'rubygems'
11
8
  require 'filetesthelper'
@@ -26,5 +23,5 @@ A simple helper aimed at reducing the setup effort needed to create directories,
26
23
  #When we finish we are back at directory X and the Y directory is deleted with all its contents
27
24
  end
28
25
 
29
- See the {specs}[link:specs.html], the {Rubyforge project homepage}[http://rubyforge.org/projects/filetesthelper] and my {blog}[http://dcadenas.blogspot.com/2008/03/file-system-integration-tests-helper.html] for more details.
26
+ See the specs for more details.
30
27
 
data/Rakefile.rb CHANGED
@@ -7,7 +7,7 @@ require 'rake/gempackagetask'
7
7
  require 'spec/rake/spectask'
8
8
 
9
9
  NAME = 'filetesthelper'
10
- PKGVERSION = '0.9.1'
10
+ PKGVERSION = '1.0.0'
11
11
  is_windows = (PLATFORM =~ /win32|cygwin/)
12
12
  SUDO = is_windows ? '' : 'sudo'
13
13
  README = "README.txt"
@@ -22,7 +22,7 @@ CLEAN.include ["pkg", "coverage", "doc"]
22
22
  spec = Gem::Specification.new do |s|
23
23
  s.name = NAME
24
24
  s.version = PKGVERSION
25
- s.author = "Daniel Cadenas Nión"
25
+ s.author = "Daniel Cadenas Ni�n"
26
26
  s.email = "filetesthelper-devel@rubyforge.org"
27
27
  s.homepage = "http://rubyforge.org/projects/filetesthelper/"
28
28
  s.platform = Gem::Platform::RUBY
@@ -34,8 +34,6 @@ module FileTestHelper
34
34
 
35
35
  def create_files_in_working_directory(working_directory, files_with_contents)
36
36
  cd working_directory
37
-
38
- return unless files_with_contents
39
37
  files_with_contents.each do |path, file_contents|
40
38
  fail 'A path is not allowed to start with /' if path =~ /^\//
41
39
  fail 'A path is not allowed to contain ..' if path =~ /\.\./
@@ -4,46 +4,30 @@ require 'spec'
4
4
  require 'filetesthelper'
5
5
  include FileTestHelper
6
6
 
7
- parameters = {
8
- 'nil' => nil,
9
- 'an empty hash' => {},
10
- 'a hash with only one file' => {'file.txt' => 'file content'}
11
- }
12
-
13
- parameters.each do |parameter_name, parameter|
14
- describe FileTestHelper, "when the hash paramater is #{parameter_name}" do
15
- it 'should execute the block parameter' do
16
- block_runned = false
17
- with_files(parameter) {block_runned = true}
18
- block_runned.should be_true
19
- end
20
-
21
- it 'should not use the current directory' do
22
- initial_directory = Dir.pwd
23
- with_files(parameter) do
24
- Dir.pwd.should_not == initial_directory
25
- end
26
- Dir.pwd.should == initial_directory
7
+ describe FileTestHelper do
8
+ it 'should start in an empty working directory' do
9
+ with_files() do
10
+ Dir.glob('**/*').size == 0
27
11
  end
12
+ end
28
13
 
29
- it 'should start in an empty working directory' do
30
- with_files(parameter) do
31
- Dir.glob('**/*').size == 0
32
- end
14
+ it 'should not use the current directory as default' do
15
+ initial_directory = Dir.pwd
16
+ with_files() do
17
+ Dir.pwd.should_not == initial_directory
33
18
  end
19
+ Dir.pwd.should == initial_directory
20
+ end
34
21
 
35
- it 'should delete the working directory and its contents after running the block' do
36
- working_directory_path = ''
37
- with_files(parameter) do
38
- working_directory_path = Dir.pwd
39
- end
40
- working_directory_path.should_not be_empty
41
- File.exist?(working_directory_path).should be_false
22
+ it 'should delete the working directory and its contents after use' do
23
+ working_directory_path = ''
24
+ with_files() do
25
+ working_directory_path = Dir.pwd
42
26
  end
27
+ working_directory_path.should_not be_empty
28
+ File.exist?(working_directory_path).should be_false
43
29
  end
44
- end
45
-
46
- describe FileTestHelper do
30
+
47
31
  it 'should create the files and directories that were specified in a hash' do
48
32
  files_to_create = {'a directory/a file.txt' => '', 'a directory/another file.rb' => '', 'an_empty_directory/' => '', 'a_file' => ''}
49
33
  with_files(files_to_create) do
@@ -75,8 +59,4 @@ describe FileTestHelper do
75
59
  it 'should throw an error if a path uses ".."' do
76
60
  lambda { with_files('../../dir/filea' => 'content of filea') {}}.should raise_error
77
61
  end
78
-
79
- it 'should not throw an exception when the hash parameter is nil' do
80
- lambda { with_files(nil) {}}.should_not raise_error
81
- end
82
- end
62
+ end
data/spec/spec.opts CHANGED
@@ -1,7 +1,6 @@
1
- --format
2
- specdoc
3
- --format
4
- html:specs.html
1
+ --colour
2
+ --format
3
+ profile
5
4
  --timeout
6
5
  20
7
6
  --diff
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: filetesthelper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
- - "Daniel Cadenas Ni\xC3\xB3n"
7
+ - "Daniel Cadenas Ni\xF3n"
8
8
  autorequire: filetesthelper
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-03-09 01:00:00 -02:00
12
+ date: 2008-03-08 00:00:00 -02:00
13
13
  default_executable:
14
14
  dependencies: []
15
15