Sha256: a409b15a860707cf5f3d304f54d82bf4a87c3983aabe931897758018e648b89e

Contents?: true

Size: 1.27 KB

Versions: 7

Compression:

Stored size: 1.27 KB

Contents

require 'spec_helper'

describe "updating scopes" do

  # this spec needs some massive cleanup... the rendering tests continue to run... that needs to be fixed

  # the tests depend on each other.

  # there are no test for nested scopes like User.todos.active for example which will certainly fail

  rendering("saving a new record will update .all and cause a rerender") do
    unless @starting_count
      TodoItem.all.last.title
      unless TodoItem.all.count == 1
        @starting_count = TodoItem.all.count

        after(0.1) do
          TodoItem.new(title: "play it again sam").save
        end
      end
    end
    (TodoItem.all.count - (@starting_count || 100)).to_s
  end.should_generate do
    html == "1"
  end

  rendering("destroying records will cause a re-render") do
    unless @starting_count
      TodoItem.all.last.title
      unless TodoItem.all.count == 1
        @starting_count = TodoItem.all.count
        after(0.1) do
          TodoItem.all.last.destroy do
            TodoItem.all.last.destroy do
              TodoItem.all.last.destroy do
                TodoItem.all.last.destroy
              end
            end
          end
        end
      end
    end
    (TodoItem.all.count - (@starting_count || 100)).to_s
  end.should_generate do
    html == "-3"
  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/zzzupdate_scopes_movedspec.rb
hyper-mesh-0.5.4 reactive_record_test_app/spec_dont_run/moved_to_main_spec_dir/zzzupdate_scopes_movedspec.rb
hyper-mesh-0.5.3 reactive_record_test_app/spec_dont_run/moved_to_main_spec_dir/zzzupdate_scopes_movedspec.rb
hyper-mesh-0.5.2 reactive_record_test_app/spec_dont_run/moved_to_main_spec_dir/zzzupdate_scopes_movedspec.rb
hyper-mesh-0.5.1 reactive_record_test_app/spec_dont_run/moved_to_main_spec_dir/zzzupdate_scopes_movedspec.rb
hyper-mesh-0.5.0 reactive_record_test_app/spec_dont_run/moved_to_main_spec_dir/zzzupdate_scopes_movedspec.rb
hyper-mesh-0.4.0 reactive_record_test_app/spec_dont_run/moved_to_main_spec_dir/zzzupdate_scopes_movedspec.rb