github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

gmalamid / synthesis

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 31
    • 1
  • Source
  • Commits
  • Network (1)
  • Issues (0)
  • Downloads (25)
  • Wiki (1)
  • Graphs
  • Branch: master

click here to add a description

click here to add a homepage

  • Branches (2)
    • experimental
    • master ✓
  • Tags (25)
    • 0.2.8
    • 0.2.7
    • 0.2.6
    • 0.2.5
    • 0.2.4
    • 0.2.3
    • 0.2.2
    • 0.2.1
    • 0.2.0
    • 0.1.7
    • 0.1.6
    • 0.1.5
    • 0.1.4
    • 0.1.3
    • 0.1.2
    • 0.1.1
    • 0.1.0
    • 0.0.15
    • 0.0.14
    • 0.0.13
    • 0.0.12
    • 0.0.11
    • 0.0.10
    • 0.0.9
    • 0.0.8
Sending Request…
Enable Donations

Pledgie Donations

Once activated, we'll place the following badge in your repository's detail box:
Pledgie_example
This service is courtesy of Pledgie.

Ruby code analysis tool for verifying mock object assumptions in tests — Read more

  cancel

http://synthesis.rubyforge.org

  cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

bumped version 
gmalamid (author)
Mon Jul 06 15:52:20 -0700 2009
commit  98bb354559757e116ca99992661327e22cdc0b51
tree    d59a55b1abf9f5694126e154ebadc0f89c580214
parent  73e7b24c9fc2f189025b5cda81fe8af127e6c8fb
synthesis /
name age
history
message
file .gitignore Loading commit data...
file COPYING
file README.rdoc
file Rakefile
directory etc/
directory lib/
file synthesis.gemspec
directory test/
directory test_project/
README.rdoc

Synthesis

A tool for verifying mock object assumptions in tests

Installation

 sudo gem i synthesis

Download

Synthesis RubyForge page ( rubyforge.org/projects/synthesis )

Dependencies

Synthesis’s core doesn’t have any dependencies.

When used with the Mocha adapter, it will depend on the Mocha library.

When used with the RSpec adapter, it will depend on the RSpec library.

Usage

Synthesis can be used through its Rake task. It has two adapters: Mocha (with Test::Unit, etc) and RSpec. If adapter is not specified, the Mocha adapter will be used by default.

By default, Synthesis outputs to STDOUT, but output can be redirected to alternative IO streams.

Synthesis can be setup to ignore certain classes or modules when collecting expectations for verification.

If pattern is not specified, it will default to test/**/*_test.rb

As of version 0.2.0, Synthesis has a DOT formatter which, when used, will output text in the DOT graph description language, producing system visualizations as specified by the simulated interactions in the system’s tests. The output of the DOT formatter can be used with tools like Graphviz( www.graphviz.org/ ). The DOT formatter depends on the parse_tree and sexp_processor libraries.

Usage examples

To use with Test::Unit and Mocha, ignoring Array and Hash:

  require "synthesis/task"

  Synthesis::Task.new do |t|
    t.pattern = 'test/unit/**/*_test.rb'
    t.ignored = [Array, Hash]
  end

To use with RSpec, running all specs in the spec directory:

  require "synthesis/task"

  Synthesis::Task.new do |t|
    t.adapter = :rspec
    t.pattern = 'spec/**/*_spec.rb'
  end

To to a file:

  require "synthesis/task"

  Synthesis::Task.new do |t|
    t.out = File.new "synthesis.test.txt", "a"
  end

To output a DOT graph, first make sure you have sexp_processor installed:

  sudo gem install sexp_processor

Then, to output a file called "synthesis.dot", do (if formatter_out is not specified, the default ouput is STDOUT):

  require "synthesis/task"

  Synthesis::Task.new do |t|
    t.formatter = :dot
    t.formatter_out = "synthesis.dot"
  end

To use Synthesis with Rails:

  require "synthesis/task"

  Synthesis::Task.new do |t|
    RAILS_ENV = "test"
    Rake::Task['environment'].invoke # This loads the Rails environment, which may make your build slower. Use only if needed
    t.pattern = 'test/**/*_test.rb'
  end

Utilities

mock_instance

  require "synthesis/util/mock_instance"
  foo_mock = Foo.mock_instance(arg_one, arg_2)

This is equivalent, but without calling the real initialize method, to:

  foo_mock = Foo.new
  Foo.expects(:new).with(arg_one, arg_two).returns(foo_mock)

Or, in the case of RSpec, it is equivalent to:

  foo_mock = Foo.new
  Foo.should_receive(:new).with(arg_one, arg_two).and_return(foo_mock)

Either "mocha_standalone" or "spec/mocks" need to be required before using mock_instance.

Git

Public clone URL: git://github.com/gmalamid/synthesis.git

Contributors

Danilo Sato, Paul Nasrat, Jerome Riga

Discuss

groups.google.com/group/synthesized-testing

Related reading

nutrun.com/weblog/using-synthesis-with-testunit-and-mocha

Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server