Project

spectro

0.0
No commit activity in last 3 years
No release in over 3 years
Specs driven social meta-programming
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

>= 0
 Project Readme

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