Sha256: 1a027fe74918fa1209fbe4040543654dd0c1646f2c47711bf4f6e7d7a83a29e3

Contents?: true

Size: 1.08 KB

Versions: 5

Compression:

Stored size: 1.08 KB

Contents

require 'assert'

require 'inbox-sync/sync'
require 'inbox-sync/runner'

module InboxSync

  class RunnerTests < Assert::Context
    desc "a sync runner"
    before do
      @syncs = [InboxSync::Sync.new, InboxSync::Sync.new]
      @runner = InboxSync::Runner.new(@syncs, :interval => 20)
    end
    subject { @runner }

    should have_readers :syncs, :interval, :logger
    should have_instance_methods :start, :stop, :shutdown?

    should "know its syncs" do
      assert_equal @syncs, subject.syncs
    end

    should "know its interval seconds" do
      assert_equal 20, subject.interval
    end

    should "default its interval to -1" do
      assert_equal -1, InboxSync::Runner.new.interval
    end

    should "build from zero or many syncs" do
      assert_equal @syncs, InboxSync::Runner.new(@syncs).syncs
      assert_equal @syncs, InboxSync::Runner.new(*@syncs).syncs
      assert_equal [@syncs.first], InboxSync::Runner.new(@syncs.first).syncs
      assert_equal [], InboxSync::Runner.new(:interval => 5).syncs
      assert_equal [], InboxSync::Runner.new().syncs
    end

  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
inbox-sync-0.4.1 test/runner_test.rb
inbox-sync-0.4.0 test/runner_test.rb
inbox-sync-0.3.0 test/runner_test.rb
inbox-sync-0.2.1 test/runner_test.rb
inbox-sync-0.2.0 test/runner_test.rb