Specs driven social meta-programming
Ruby
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.github
bin
lib
sample
test
.codeclimate.yml
.gitignore
.travis.yml
Gemfile
Guardfile
LICENSE
README.md
rakefile
spectro.gemspec
spectro.png

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