Sha256: e595084d96d5da3e68cd606e478362f7d5d06a77486916063d9f411efab02167

Contents?: true

Size: 640 Bytes

Versions: 7

Compression:

Stored size: 640 Bytes

Contents

# frozen_string_literal: true

RSpec.describe PageMagic::Watcher do
  describe '#initialize' do
    context 'when `check` has not been called yet' do
      it 'sets `observed_value` to nil' do
        instance = described_class.new(:custom_watcher, context: self)
        expect(instance.observed_value).to be_nil
      end
    end
  end

  describe '#check' do
    it 'assigns last to be the result of calling the block passed to the constructor' do
      instance = described_class.new(:object_id, context: self) do
        object_id
      end
      instance.check
      expect(instance.observed_value).to eq(object_id)
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
page_magic-2.0.6 spec/page_magic/watcher_spec.rb
page_magic-2.0.5 spec/page_magic/watcher_spec.rb
page_magic-2.0.4 spec/page_magic/watcher_spec.rb
page_magic-2.0.3 spec/page_magic/watcher_spec.rb
page_magic-2.0.2 spec/page_magic/watcher_spec.rb
page_magic-2.0.1 spec/page_magic/watcher_spec.rb
page_magic-2.0.0 spec/page_magic/watcher_spec.rb