Sha256: 23c42e21cfccba55d692d2d724b79d1104de9337de11f4f62256368c1d9a8e09

Contents?: true

Size: 823 Bytes

Versions: 7

Compression:

Stored size: 823 Bytes

Contents

require 'spec_helper'

describe PolicyManager::Term do
    
    before :each do
      @config = PolicyManager::Config.setup do |c|
        c.add_rule({name: "age", validates_on: [:create, :update] })
      end
    end

    it "will require a rule" do
      t = PolicyManager::Term.create(description: "aaa")
      assert t.persisted? == false
      assert t.errors.any? == true
      assert t.errors[:rule].any? == true
    end

    it "create ok" do
      t = PolicyManager::Term.create(description: "aaa", rule: config.rules.first.name)
      assert t.persisted? == true
    end

    it "get rule as an instance of Rule" do
      t = PolicyManager::Term.create(description: "aaa", rule: config.rules.first.name)
      assert t.persisted? == true
      assert t.rule.instance_of?(PolicyManager::Rule) == true
    end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
gdpr_rails-0.5.1 spec/models/policy_manager/term_spec.rb
gdpr_rails-0.5.0 spec/models/policy_manager/term_spec.rb
gdpr_rails-0.4.0 spec/models/policy_manager/term_spec.rb
gdpr_rails-0.3.4 spec/models/policy_manager/term_spec.rb
gdpr_rails-0.3.3 spec/models/policy_manager/term_spec.rb
gdpr_rails-0.3.2 spec/models/policy_manager/term_spec.rb
gdpr_rails-0.3.1 spec/models/policy_manager/term_spec.rb