profile
viewpoint
Swift theycallmeswift Major League Hacking (MLH) New York, New York http://www.twitter.com/swiftalphaone

push eventMLH/mlh-policies

Swift

commit sha 656098e91973857c058703f02ed04d5ea0be0244

Update Code of Conduct for APAC

view details

push time in 20 hours

MemberEvent

pull request commentMLH/mlh-policies

APAC exceptions for membership guidelines

We need a physical address to register the number in India. For now we'll use the email and plan to add the phone number once we have that nailed down.

joenash

comment created time in 24 days

pull request commentMLH/mlh-policies

APAC exceptions for membership guidelines

@joenash these changes LGTM. Needs to be ported to S3 and HelloSign. Can you work with @nquinlan on that?

joenash

comment created time in 24 days

pull request commentMLH/mlh-policies

APAC exceptions for membership guidelines

LGTM

joenash

comment created time in 24 days

issue commenttschaub/gh-pages

The "file" argument must be of type string. Received type undefined

I'm also receiving this error.

node: 10.16.1
OSX 10.13.6
konsumer

comment created time in 3 months

issue commentthoughtbot/shoulda-matchers

Don't call `object_class` on serializers in validate_presence_of

@mcmire yep, seems to have done the trick!

theycallmeswift

comment created time in 3 months

issue openedthoughtbot/shoulda-matchers

Don't call `object_class` on serializers in validate_presence_of

Hey folks --

I'm using a custom module for serialization and have a validator on presence. There's no guarantee that a module responds to the object_class method we're calling on it in the matcher. The fix for this is to use something like reponds_to?(:object_class) before calling the method. I believe this has been addressed in the serializer matcher.

Model:

class Review < ApplicationRecord
  serialize :status, StatusSerializer
  validates :status, presence: true
end

Serializer:

module StatusSerializer
  module_function

  def dump(content)
    #...
  end

  def load(content)
    #...
  end
end

Test:

require 'rails_helper'

RSpec.describe Review, type: :model do
  it { should validate_presence_of(:status) }
end

Error:

 1) Review should validate that :status cannot be empty/falsy
     Failure/Error: it { should validate_presence_of(:status) }

     NoMethodError:
       undefined method `object_class' for StatusSerializer:Module
     # ./spec/models/review_spec.rb:8:in `block (2 levels) in <top (required)>'

Cause: https://github.com/thoughtbot/shoulda-matchers/blob/fb6ea7afd4bf625edd33603c11ef4af90e914006/lib/shoulda/matchers/active_model/validate_presence_of_matcher.rb#L318

created time in 3 months

fork theycallmeswift/upcase

Sharpen your programming skills.

https://thoughtbot.com/upcase

fork in 3 months

more