Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7308831
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T23:37:28+00:00 2026-05-28T23:37:28+00:00

I have the following piece of code that checks if the returned video object

  • 0

I have the following piece of code that checks if the returned video object is the same as the one I put in.

The video object is a Panda Stream object, and referring to their homepage, the Panda::Video.find should return exactly the object I put in with the Panda::Video.create method.

# screencast_spec.rb
before(:each) do
  @screencast = Factory.build(:screencast)
  @video = Panda::Video.create(:source_url => "http://panda-test-harness-videos.s3.amazonaws.com/panda.mp4")
end
it "should fetch the video with the #video method" do
  @screencast.video = @video
  @screencast.video.should == @video
end

# screencast.rb
# Returns the panda::video object
def video
  Panda::Video.find(self.video_id)
end
# Sets the +video_id+ reference
def video= video_object_or_id
  video_object_or_id = video_object_or_id.id unless video_object_or_id.is_a?(Integer)
  self.video_id = video_object_or_id
end

The error that RSpec returns is this:

1) Screencast#video should fetch the video with the #video method
Failure/Error: @screencast.video.should == @video
   expected: #<Panda::Video id: "dac9bf057c9b667f57096054a64625a1", created_at: "2012/01/29 18:04:07 +0000", updated_at: "2012/01/29 18:04:07 +0000", original_filename: "panda.mp4", source_url: "http://panda-test-harness-videos.s3.amazonaws.com/panda.mp4", duration: nil, height: nil, width: nil, extname: ".mp4", file_size: nil, video_bitrate: nil, audio_bitrate: nil, audio_codec: nil, video_codec: nil, fps: nil, audio_channels: nil, audio_sample_rate: nil, status: "processing", path: "dac9bf057c9b667f57096054a64625a1", cloud_id: "55372b1612963b045f27bb093fed0abb">
        got: #<Panda::Video id: "dac9bf057c9b667f57096054a64625a1", created_at: "2012/01/29 18:04:07 +0000", updated_at: "2012/01/29 18:04:07 +0000", original_filename: "panda.mp4", source_url: "http://panda-test-harness-videos.s3.amazonaws.com/panda.mp4", duration: nil, height: nil, width: nil, extname: ".mp4", file_size: nil, video_bitrate: nil, audio_bitrate: nil, audio_codec: nil, video_codec: nil, fps: nil, audio_channels: nil, audio_sample_rate: nil, status: "processing", path: "dac9bf057c9b667f57096054a64625a1", cloud_id: "55372b1612963b045f27bb093fed0abb"> (using ==)
   Diff:
 # ./spec/models/screencast_spec.rb:26:in `block (3 levels) in <top (required)>'

Note the diff saying that there is no difference between the two objects, so why is the comparison failing?

If any of you have any pointers, or have tried testing the panda stream before I would appreciate all the guidance I can get

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T23:37:29+00:00Added an answer on May 28, 2026 at 11:37 pm

    ruby provides 3 methods for testing for equality == eql? equals?. when using == you are comparing by object identity. ruby uses the object-id for this. the important thing is that classes can redefine == like it’s done for string-comparison.

    if you wan’t to learn more on this topic i can advise you this blog post: http://www.skorks.com/2009/09/ruby-equality-and-object-comparison/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following piece of code that checks whether port 443 is open
I have the following piece of code that takes in some words, stores them
I have the following piece of code that generate a jquerymobile-style button <a href=#
I have the following piece of code that finds all elements in the document
I have the following piece of Java code that reads strings from CSV file.
I have the following piece of code from a function that takes the host
I have the following piece of code in my MainViewController. Is that the best
I have the following piece of code (that may be invoked multiple times or
I have the following piece of code that I'm expecting to run on a
Well my problem is the following. I have a piece of code that runs

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.