Sha256: fe0a111963f307bbbd0ccff3176264b1730ebf194408e6cbf95db20b196e59a6
Contents?: true
Size: 805 Bytes
Versions: 11
Compression:
Stored size: 805 Bytes
Contents
require 'spec_helper' describe CassandraObject::Associations do context "belongs_to" do it "should fetch the user record from the belongs_to relationship from a cassandra object" do user = User.create! :position => 1 issue = Issue.create! :description => 'web site not working', :worth => 1.5, :user_id => user.id expect(issue.user.id).to eq user.id end it "should fetch the cassandra object from the belongs_to relationship from an active record object" do issue = Issue.create! :description => 'web site not working', :worth => 1.5 user = User.create! :position => 1, :issue_id => issue.id role = Role.create! :name => 'admin', :user_id => user.id expect(role.user.id).to eq user.id expect(user.issue.id).to eq issue.id end end end
Version data entries
11 entries across 11 versions & 1 rubygems