Skip to content
Specs driven social meta-programming
Ruby
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github
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 README.md Mar 4, 2015
README.md Update README.md 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

README.md

Spectro

Specs driven social meta-programming

Gem Version Gitter Build Status Code Climate Test Coverage YARD Docs

Prototype

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]

end

__END__
spec_for hello String -> String
  "Minion"  -> "Say Hello to Minion"
  "Roberto" -> "Say Hello to Roberto"
  "Roland"  -> "Say Hello to Roland"
sample = Sample.new

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

Working with Mocks

Scenarios

  • 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]

end

__END__
spec_for valid? String -> TrueClass|FalseClass
  "valid@email.com"  -> true
  "invalidATemail.com" -> false
require 'email_validator' #=> Spectro::Exception::UndefinedMethodDefinition
Spectro.configure do |config|
  config.enable_mocks!
end

require 'email_validator'

email_validator = EmailValidator.new

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