Skip to content
Specs driven social meta-programming
Branch: master
Clone or download
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin SC to Spectro! Mar 17, 2015
lib Adding tags support Apr 22, 2016
sample lambda usages to Pirate Procs ->() Mar 19, 2015
test Adding tags support Apr 22, 2016
.codeclimate.yml excluding tests from codeclimate analysis Mar 29, 2016
.gitignore Removing `rack` usage from gemspec Mar 29, 2016
.travis.yml Travis - Allow errors on ruby-head Mar 30, 2016
Gemfile triggering irc hook Apr 6, 2016
Guardfile require usage consistency Mar 17, 2015
LICENSE Update Mar 4, 2015 Update Mar 22, 2016
rakefile SC::Compiler - Detect and dump missing specs into .sc/undefined.yml Mar 11, 2015
spectro.gemspec bump version 0.3 Apr 5, 2016
spectro.png Adding logo Mar 17, 2015


Specs driven social meta-programming

Gem Version Gitter Build Status Code Climate Test Coverage YARD Docs


Spectro will fetch an algorithm to cover the given spec form its DB and will then define the #hello method using it.

require 'spectro'

class Sample

  include Spectro

  implements \
    hello: [:name]


spec_for hello String -> String
  "Minion"  -> "Say Hello to Minion"
  "Roberto" -> "Say Hello to Roberto"
  "Roland"  -> "Say Hello to Roland"
sample =

sample.hello 'Eddie' #=> 'Say Hello to Eddie'

Working with Mocks


  • Keep coding while waiting for an algorithm that covers your specs
  • Using Spectro just to mock stuff
require 'spectro'

class EmailValidator

  include Spectro

  implements \
    valid?: [:email]


spec_for valid? String -> TrueClass|FalseClass
  ""  -> true
  "" -> false
require 'email_validator' #=> Spectro::Exception::UndefinedMethodDefinition
Spectro.configure do |config|

require 'email_validator'

email_validator =

email_validator.valid?("") #=> true 
email_validator.valid?("") #=> false 
email_validator.valid?("") #=> raise Spectro::Exception::UnkwnonMockResponse
You can’t perform that action at this time.