Sha256: a2eb928b4a9e879a780b112e213f1bf5104feb52986d15807d1bcd4c13fbd9c4

Contents?: true

Size: 796 Bytes

Versions: 7

Compression:

Stored size: 796 Bytes

Contents

require 'spec_helper'

describe "many to many associations" do

  it "it is time to count some comments" do
    React::IsomorphicHelpers.load_context
    ReactiveRecord.load do
      TodoItem.find_by_title("a todo for mitch").comments.count
    end.then do |count|
      expect(count).to be(1)
    end
  end

  it "is time to see who made the comment" do
    ReactiveRecord.load do
      TodoItem.find_by_title("a todo for mitch").comments.first.user.email
    end.then do |email|
      expect(email).to eq("adamg@catprint.com")
    end
  end

  it "is time to get it directly through the relationship" do
    ReactiveRecord.load do
      TodoItem.find_by_title("a todo for mitch").commenters.first.email
    end.then do |email|
      expect(email).to eq("adamg@catprint.com")
    end
  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
hyper-mesh-0.6.0 reactive_record_test_app/spec_dont_run/moved_to_main_spec_dir/zzzmany_to_many_spec_moved_to_main_suite.rb
hyper-mesh-0.5.4 reactive_record_test_app/spec_dont_run/moved_to_main_spec_dir/zzzmany_to_many_spec_moved_to_main_suite.rb
hyper-mesh-0.5.3 reactive_record_test_app/spec_dont_run/moved_to_main_spec_dir/zzzmany_to_many_spec_moved_to_main_suite.rb
hyper-mesh-0.5.2 reactive_record_test_app/spec_dont_run/moved_to_main_spec_dir/zzzmany_to_many_spec_moved_to_main_suite.rb
hyper-mesh-0.5.1 reactive_record_test_app/spec_dont_run/moved_to_main_spec_dir/zzzmany_to_many_spec_moved_to_main_suite.rb
hyper-mesh-0.5.0 reactive_record_test_app/spec_dont_run/moved_to_main_spec_dir/zzzmany_to_many_spec_moved_to_main_suite.rb
hyper-mesh-0.4.0 reactive_record_test_app/spec_dont_run/moved_to_main_spec_dir/zzzmany_to_many_spec_moved_to_main_suite.rb