Sha256: 8352562cc1063b557329efdef77ceeac9ec8f300684108582172591450b0ae7d

Contents?: true

Size: 937 Bytes

Versions: 2

Compression:

Stored size: 937 Bytes

Contents

require 'spec_helper'
require 'synchromesh/integration/test_components'

describe "reactive-record edge cases", js: true do

  before(:each) do
    # spec_helper resets the policy system after each test so we have to setup
    # before each test
    stub_const 'TestApplication', Class.new
    stub_const 'TestApplicationPolicy', Class.new
    TestApplicationPolicy.class_eval do
      always_allow_connection
      regulate_all_broadcasts { |policy| policy.send_all }
    end
    size_window(:small, :portrait)
  end

  it "trims the association tree" do
    5.times do |i|
      user = FactoryGirl.create(:user, first_name: i) unless i == 3
      FactoryGirl.create(:todo, title: "User #{i}'s todo", owner: user)
    end
    expect_promise do
      HyperMesh.load do
        Todo.all.collect do |todo|
          todo.owner && todo.owner.first_name
        end.compact
      end
    end.to contain_exactly('0', '1', '2', '4')
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
hyper-mesh-0.5.3 spec/reactive_record/edge_cases_spec.rb
hyper-mesh-0.5.2 spec/reactive_record/edge_cases_spec.rb