Sha256: 10b7e0b3d583ea3669fd90321840b1e48c311053f237c898f16d257224f05311

Contents?: true

Size: 1.32 KB

Versions: 41

Compression:

Stored size: 1.32 KB

Contents

require File.join(File.dirname(__FILE__), "helpers", "spec_helper")

describe Videojuicer::Resource::Relationships::BelongsTo do
  
  after(:all) do
    Videojuicer.exit_scope
  end
  
  before(:all) do
    configure_test_settings
    Videojuicer.enter_scope :seed_name => fixtures.seed.name, 
                            :consumer_key=>fixtures["write-master"].consumer.consumer_key,
                            :consumer_secret=>fixtures["write-master"].consumer.consumer_secret,
                            :token=>fixtures["write-master"].authorized_token.oauth_token,
                            :token_secret=>fixtures["write-master"].authorized_token.oauth_token_secret
    
    @user = Videojuicer::User.first
    @user.should be_kind_of(Videojuicer::User)
    
    class ::BelongsToExample
      include Videojuicer::Resource
      
      property :user_id, Integer
      belongs_to :user, :class=>Videojuicer::User
    end
    
    @example = ::BelongsToExample.new
    @example.user_id = @user.id
  end
  
  it "retrieves the user" do
    @example.user.id.should == @user.id
  end
  
  it "returns nil when the user_id is nonsense" do
    bad_example = ::BelongsToExample.new(:user_id=>9900000000)
    bad_example.user.should be_nil
  end
  
  it "sets the user" do
    @example.user = @user
    @example.user_id.should == @user.id
  end
  
end

Version data entries

41 entries across 41 versions & 2 rubygems

Version Path
videojuicer-vj-sdk-0.1.0 spec/belongs_to_spec.rb
videojuicer-vj-sdk-0.1.1 spec/belongs_to_spec.rb
videojuicer-vj-sdk-0.1.12 spec/belongs_to_spec.rb
videojuicer-vj-sdk-0.1.3 spec/belongs_to_spec.rb
videojuicer-vj-sdk-0.1.4 spec/belongs_to_spec.rb
videojuicer-vj-sdk-0.1.5 spec/belongs_to_spec.rb
vj-sdk-0.8.0.1 spec/belongs_to_spec.rb
vj-sdk-0.7.14 spec/belongs_to_spec.rb
vj-sdk-0.7.13 spec/belongs_to_spec.rb
vj-sdk-0.7.11 spec/belongs_to_spec.rb
vj-sdk-0.7.10 spec/belongs_to_spec.rb
vj-sdk-0.7.9 spec/belongs_to_spec.rb
vj-sdk-0.7.8 spec/belongs_to_spec.rb
vj-sdk-0.7.7 spec/belongs_to_spec.rb
vj-sdk-0.7.6 spec/belongs_to_spec.rb
vj-sdk-0.7.5 spec/belongs_to_spec.rb
vj-sdk-0.7.4 spec/belongs_to_spec.rb
vj-sdk-0.7.3 spec/belongs_to_spec.rb
vj-sdk-0.7.2 spec/belongs_to_spec.rb
vj-sdk-0.7.1 spec/belongs_to_spec.rb