Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Acceptance testing DSL for Test::Unit

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 test
Octocat-spinner-32 .gitignore
Octocat-spinner-32 .travis.yml
Octocat-spinner-32 Gemfile
Octocat-spinner-32 LICENSE
Octocat-spinner-32 Rakefile
Octocat-spinner-32 Readme.md
Octocat-spinner-32 filet.gemspec
Readme.md

Filet

Filet is a dsl for acceptance testing on top of Test::Unit.

Why filet?

Filet is framework agnostic, it can be used with plain Ruby or it can integrate with Rails or any framework of your choice, you can use it with Capybara, Webrat or any other tools you like. Filet has no dependencies. Filet is Test:Unit but pretty!

Installation

gem install filet

Usage

To use filet just include in your test_helper

require 'filet'
include Filet

Example

feature 'Creating a post', %{
  As a user
  I want to create a post
  In order to show it to people
} do

  background do
    # setup data
  end

  scenario 'Everything goes fine after a submit' do
    # test code
  end

  context 'Something goes wrong', :js => true do

    background do
      # setup more data
    end

    scenario 'my keyboard stopped working' do
      # test code
    end

    scenario 'I forgot to fill up the form' do
      # test code
    end

    teardown do
      # clean up
    end
  end
end

Hooks

We provide several hooks for options processing.

  1. Filet.feature_hook

    This allows to process the options you pass for the feature

    Filet.feature_hook do |base, options|
      base.send(:include, Capybara::DSL)
    end
    
  2. Filet.context_hook

    This allows to process the options you pass for the context

    Filet.context_hook do |base, options|
      base.send(:include, SomeModule) if options[:js]
    end
    
  3. Filet.base_klass

    This allows you to define the base_klass of your tests. It tries to make a guess based on your environment and integrates with Rails 3 and Rails 2. The default is Test::Unit::TestCase.

    Filet.base_klass = ActiveSupport::TestCase
    

    NOTE: This hook must be initialized before you include the Filet module

Compatibility

Filet supports and is tested against ruby 1.8.7, 1.9.2, jruby-1.6.2 and rubinius-1.2.4

Build Status

Rails Integration

It tries to make a guess based on your environment and integrates with Rails 3 and Rails 2. We recommend that you place your tests inside the test/integration folder.

Acknowledgements

We'd like to thank our employer XING AG for letting us work on this project as part of our innovation time and releasing it as open source. We also want to thank Luismi Cavallé for steak which was our inspiration to do this and all the great people that have made Testing so easy.

Something went wrong with that request. Please try again.