require 'rails_helper'

describe OwnerInitialization::Scenario1 do
  describe ".sorted_state_count" do
    it "returns the counts sorted in the required way" do
      create(:workflow_instance_scenario1).owner_initialization.reject!
      create(:workflow_instance_scenario1, :unplanned)
      create(:workflow_instance_scenario1).owner_initialization.process!
      create(:workflow_instance_scenario1, :unplanned)

      create(:workflow_instance_scenario2, :unplanned)

      result = WorkflowInstance::Scenario1.sorted_state_count
      result.to_a.should eq [
        ["unplanned", 2],
        ["active", 1],
        ["any_rejected", 1],
      ]
    end
  end
end
