This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Contract | |
@@disable_override = false | |
@@contracts = [] | |
def self.method_added name | |
unless @@disable_override | |
@@contracts.each do |method| | |
if name == method.to_sym | |
method_alias = "#{method}_alias".to_sym |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require_relative '../../contracts/tweet_gateway_contract' | |
class TG < TweetGatewayContract | |
def save input | |
return input | |
end | |
end | |
class TGoutput < TweetGatewayContract | |
def save input |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="alert error" data-bind="css: { hidden: !errorMessage() }"> | |
<span data-bind="text: errorMessage"></span> | |
<button class="close" data-bind="click: function(data, event){ errorMessage(null); } ">×</button> | |
</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Action: ExampleAction | |
Description: should do something awesome | |
Code: | |
- c: validate input | |
- c: set default id and values for new Thing entity | |
- c: create/populate Thing object | |
requires: Thing.populate | |
- c: save thing to jack | |
requires: ThingJack.save, Thing.to_hash | |
- c: return the result |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require_relative '../entities/user' | |
require_relative '../entities/user_session' | |
class SignInUser | |
def initialize user_jack, user_session_jack | |
@user_jack = user_jack | |
@user_session_jack = user_session_jack | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CreateRequest | |
def initialize request_jack, notification_jack, payment_jack | |
@request_jack = request_jack | |
@notification_jack = notification_jack | |
@payment_jack = payment_jack | |
end | |
def execute input | |
unless input.has_shape? user_id: Fixnum, text: String, amount: Float, who_to_notify: Fixnum |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Obvious | |
module EntityMixin | |
class << self | |
def included(base) | |
base.extend ClassMethods | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ObjectiveRuby | |
class << self | |
def included(base) | |
base.extend ClassMethods | |
end | |
end | |
module ClassMethods | |
def obj method, input = {}, &block |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class User < Obvious::Entity | |
value :email, String | |
value :password, String | |
value :id, Fixnum | |
validation :check_email, Proc.new { | |
raise StandardError.new 'invalid email address' unless email =~ /\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b/i | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is an alias method to give better language to the assert_contain matcher | |
module Webrat::Matchers | |
def page_should_contain content | |
assert_contain content | |
end | |
end |
OlderNewer