Sha256: d6511bdad80919e1a18336e85b684d988277befbbd4981dce20b86f7433e22d6

Contents?: true

Size: 1.05 KB

Versions: 3

Compression:

Stored size: 1.05 KB

Contents

require 'rails_helper'

module RailsWorkflow
  RSpec.describe OperationTemplate, :type => :model do

    let(:template) { create :process_template }

    it 'should create operation template of a given type' do
      expect{OperationTemplate.
          create! (
                      {
                          title: 'First Test project',
                          process_template_id: template.id,
                          type: "RailsWorkflow::CustomOperationTemplate"
                      }
                  )}.to change(RailsWorkflow::CustomOperationTemplate, :count).by(1)
    end

    it 'should return only independent operations' do
      operation = create :operation_template, process_template: template

      dependencies = [
          {
              "id" => operation.id,
              "statuses" => [RailsWorkflow::Operation::DONE]
          }
      ]

      create :operation_template, process_template: template, dependencies: dependencies
      expect(RailsWorkflow::OperationTemplate.independent_only.to_a).to match_array([operation])
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rails_workflow-0.3.7 spec/models/rails_workflow/operation_template_spec.rb
rails_workflow-0.3.6 spec/models/rails_workflow/operation_template_spec.rb
rails_workflow-0.3.5 spec/models/rails_workflow/operation_template_spec.rb