Skip to content

Instantly share code, notes, and snippets.

class Broker < ActiveRecord::Base
devise :database_authenticatable, :registerable, :recoverable, :rememberable,
:trackable, :validatable, :confirmable, :lockable, :async
mount_uploader :photo, PhotoUploader
has_many :offers, dependent: :destroy
has_many :reviews, dependent: :destroy
has_many :robot_offers, dependent: :destroy
has_many :notes, dependent: :destroy
➜ wildcard-service git:(wildcard-test) ✗ git diff
➜ wildcard-service git:(wildcard-test) ✗ make prove
TEST_NGINX_ERROR_LOG=/dev/stderr TEST_NGINX_BINARY=openresty prove
t/001-wildcard-router.t .. 1/?
# Failed test 'ERROR: client socket timed out - TEST 2: request though the wildcard router using the API
# '
# at /Library/Perl/5.18/Test/Nginx/Socket.pm line 1815.
# Failed test 'TEST 2: request though the wildcard router using the API - status code ok'
# at /Library/Perl/5.18/Test/Nginx/Socket.pm line 922.
make prove
TEST_NGINX_ERROR_LOG=/dev/stderr TEST_NGINX_BINARY=openresty prove
t/001-wildcard-router.t .. # I found ONLY: maybe you're debugging?
t/001-wildcard-router.t .. 1/?
# Failed test 'TEST 2: request though the wildcard router using the API - status code ok'
# at /Library/Perl/5.18/Test/Nginx/Socket.pm line 922.
# got: '200'
# expected: '401'
# Failed test 'TEST 2: request though the wildcard router using the API - response_body - response is expected (repeated req 0, req 0)'
2017/07/13 10:35:56 [debug] 20051#448778: *1 [lua] resolver.lua:80: parse_nameservers(): search nil
2017/07/13 10:35:56 [info] 20051#448778: *1 [lua] resolver.lua:108: init_nameservers(): adding 127.0.0.1:1953 as default nameserver, client: 127.0.0.1, server: localhost, request: "GET /?host=foo-apicast-staging.example.com HTTP/1.1", host: "foo-apicast-staging.example.com"
2017/07/13 10:35:56 [info] 20051#448778: *1 [lua] resolver.lua:108: init_nameservers(): adding 8.8.8.8:53 as default nameserver, client: 127.0.0.1, server: localhost, request: "GET /?host=foo-apicast-staging.example.com HTTP/1.1", host: "foo-apicast-staging.example.com"
2017/07/13 10:35:56 [info] 20051#448778: *1 [lua] resolver.lua:108: init_nameservers(): adding 192.168.1.1:53 as default nameserver, client: 127.0.0.1, server: localhost, request: "GET /?host=foo-apicast-staging.example.com HTTP/1.1", host: "foo-apicast-staging.example.com"
2017/07/13 10:35:56 [info] 20051#448778: *1 [lua] resolver.lua:113: init_nameservers(): adding as sear
bundle exec ruby -Itest -e '%w[test/integration/user-management-api/base_controller_test.rb test/integration/user-management-api/nginx_test.rb].each { |f| require %{./#{f}} }'
diff --git a/app/events/applications/application_created_event.rb b/app/events/applications/application_created_event.rb
index 29afbca..8f62278 100644
--- a/app/events/applications/application_created_event.rb
+++ b/app/events/applications/application_created_event.rb
@@ -1,4 +1,15 @@
class Applications::ApplicationCreatedEvent < RailsEventStore::Event
+
+ def self.belongs_to(association)
+ define_method "find_#{association}" do
+ association.to_s.camelize.constantize.find(__send__("#{association}_id"))