File: integration_test.rb

package info (click to toggle)
ruby-state-machines-activerecord 0.9.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 340 kB
  • sloc: ruby: 1,922; makefile: 5
file content (25 lines) | stat: -rw-r--r-- 905 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
require_relative 'test_helper'

class IntegrationTest < BaseTestCase
  def test_should_have_an_integration_name
    assert_equal :active_record, StateMachines::Integrations::ActiveRecord.integration_name
  end

  def test_should_be_before_activemodel
    integrations = StateMachines::Integrations.list.to_a
    assert StateMachines::Integrations::ActiveRecord, integrations.first
    assert StateMachines::Integrations::ActiveModel, integrations.last
  end

  def test_should_match_if_class_inherits_from_active_record
    assert StateMachines::Integrations::ActiveRecord.matches?(new_model)
  end

  def test_should_not_match_if_class_does_not_inherit_from_active_record
    refute StateMachines::Integrations::ActiveRecord.matches?(Class.new)
  end

  def test_should_have_defaults
    assert_equal({action: :save, use_transactions: true}, StateMachines::Integrations::ActiveRecord.defaults)
  end
end