Skip to content
This repository has been archived by the owner on Mar 10, 2018. It is now read-only.

FileTransferMatchers are able to verify file movement, copying and deletion in RSpec based automated tests.

Notifications You must be signed in to change notification settings

aef/rspec-file-transfer-matchers

Repository files navigation

FileTransferMatchers

DESCRIPTION:

FileTransferMatchers are able to verify file movement, copying and deletion in RSpec based automated tests.

FEATURES/PROBLEMS:

  • Tested and fully working on:

    • Ubuntu Linux 8.10 i386_64 (Ruby 1.8.7 and 1.9.1p0)

    • Debian GNU/Linux 4.0 i386 (Ruby 1.8.6)

    • On Windows XP i386 (Ruby 1.8.6)

SYNOPSIS:

Load the gem:

require 'file_transfer_matchers'

Include the matcher methods into the test case:

descripe Example do
  include Aef::FileTransferMatchers
  ...
end

Test file movement:

it "should move a file" do
  source = 'abc'
  target = 'def'

  lamda {
    FileUtils.mv(source, target)
  }.should move(source, :to => target)
end

Test file copying:

it "should copy file" do
  source = 'abc'
  target = 'def'

  lamda {
    FileUtils.cp(source, target)
  }.should copy(source, :to => target)
end

Test file deletion:

it "should delete file" do
  file = 'abc'

  lamda {
    FileUtils.rm(file)
  }.should delete(file)
end

If you want to ignore an already existing target for move or copy:

it "should move a file" do
  source = 'abc'
  target = 'def'

  lamda {
    FileUtils.mv(source, target)
  }.should move(source, :to => target, :overwrite => true)
end

REQUIREMENTS:

  • rspec

Additional for automated testing

  • hoe

INSTALL:

Normal

gem install rspec-file-transfer-matchers

High security (recommended)

There is a high security installation option available through rubygems. It is highly recommended over the normal installation, although it may be a bit less comfortable. To use the installation method, you will need my public key, which I use for cryptographic signatures on all my gems. You can find the public key and more detailed verification information in the aef-certificates section of my rubyforge project

Add the key to your rubygems’ trusted certificates by the following command:

gem cert --add aef.pem

Now you can install the gem while automatically verifying it’s signature by the following command:

gem install rspec-file-transfer-matchers --ignore-dependencies -P HighSecurity

Please notice that you will need other keys for dependent libraries, so you may have to install dependencies manually.

Automated testing

You can test this package through rspec on your system. First find the path where the gem was installed to:

gem which rspec-file-transfer-matchers

Go into the root directory of the installed gem and run the following command to start the test runner:

rake spec

On Windows systems you have to run the following instead:

spec spec/**/*_spec.rb

If something goes wrong you should be noticed through failing examples.

DEVELOPMENT:

This software is developed in the source code management system git hosted at github.com. You can download the most recent sourcecode through the following command:

git clone git://github.com/aef/rspec-file-transfer-matchers.git

Help on making this software better is always very appreciated. If you want your changes to be included in the official release, please send me a patch through the project’s tracker at rubyforge.org. You can generate a patch-file by the following command:

git diff > patch.diff

Please make sure to write tests for your changes and notice that I can’t promise to include your changes before reviewing them.

LICENSE:

Copyright 2009 Alexander E. Fischer <[email protected]>

This file is part of FileTransferMatchers.

FileTransferMatchers is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <www.gnu.org/licenses/>.

About

FileTransferMatchers are able to verify file movement, copying and deletion in RSpec based automated tests.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages