Skip to content

.find not accepting string containing UUID #83

@caldwecr

Description

@caldwecr

@pyromaniac - trying to following the example in the documentation that indicates

let(:guid) { "1dd74dd0-d116-11e0-99c7-5ac5d975667e" }
it "should be able to find an email by the uuid" do
  Email.find(guid).id.to_s.should == guid
end

This doesn't appear to work. When I try this myself I get ...

All examples were filtered out; ignoring {:focus=>true}

Models::Cognito::User

[6, 15] in /home/vagrant/dwapi/spec/models/cognito/user_spec.rb
    6:     user.id = "b465e6ed-34c5-4535-b26e-07de241b0d30"
    7: 
    8:     user.save!
    9: 
   10:     byebug
=> 11:     found_user = described_class.find "b465e6ed-34c5-4535-b26e-07de241b0d30"
   12: 
   13:     expect(found_user).to eq user
   14:   end
   15: end
(byebug) user
#<Models::Cognito::User id: #<UUID:0x53a6588 UUID:b465e6ed-34c5-4535-b26e-07de241b0d30>, account_id: nil, created_at: "2016-08-02 16:54:36", updated_at: "2016-08-02 16:54:36">
(byebug) user.id
#<UUID:0x53a6588 UUID:b465e6ed-34c5-4535-b26e-07de241b0d30>
(byebug) user.id.to_s
"b465e6ed-34c5-4535-b26e-07de241b0d30"
(byebug) Models::Cognito::User.find "b465e6ed-34c5-4535-b26e-07de241b0d30"
ActiveRecord::RecordNotFound Exception: Couldn't find Models::Cognito::User with 'id'=b465e6ed-34c5-4535-b26e-07de241b0d30
nil
(byebug) Models::Cognito::User.all
#<ActiveRecord::Relation [#<Models::Cognito::User id: #<UUID:0x55e8580 UUID:b465e6ed-34c5-4535-b26e-07de241b0d30>, account_id: nil, created_at: "2016-08-02 16:54:36", updated_at: "2016-08-02 16:54:36">]>

Advice?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions