New Upstream Snapshot - ruby-state-machines-activemodel

Ready changes

Summary

Merged new upstream version: 0.8.0+git20220807.1.33e2a5f (was: 0.8.0).

Resulting package

Built on 2023-01-16T22:19 (took 3m28s)

The resulting binary packages can be installed (if you have the apt repository enabled) by running one of:

apt install -t fresh-snapshots ruby-state-machines-activemodel

Lintian Result

Diff

diff --git a/.gitignore b/.gitignore
deleted file mode 100644
index a838739..0000000
--- a/.gitignore
+++ /dev/null
@@ -1,22 +0,0 @@
-*.gem
-*.rbc
-.bundle
-.config
-.yardoc
-Gemfile.lock
-InstalledFiles
-_yardoc
-coverage
-doc/
-lib/bundler/man
-pkg
-rdoc
-spec/reports
-tmp
-*.bundle
-*.so
-*.o
-*.a
-mkmf.log
-.idea/
-*.lock
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index c0e4a07..0000000
--- a/.travis.yml
+++ /dev/null
@@ -1,21 +0,0 @@
-language: ruby
-cache: bundler
-
-rvm:
-  - 2.5.8
-  - 2.6.6
-  - 2.7.2
-  - jruby
-  - rbx-2
-
-gemfile:
-  - gemfiles/active_model_5.1.gemfile
-  - gemfiles/active_model_5.2.gemfile
-  - gemfiles/active_model_6.0.gemfile
-  - gemfiles/active_model_6.1.gemfile
-  - gemfiles/active_model_edge.gemfile
-
-matrix:
-  allow_failures:
-    - rvm: jruby
-    - rvm: rbx-2
diff --git a/Appraisals b/Appraisals
index 867f688..2cb6d03 100644
--- a/Appraisals
+++ b/Appraisals
@@ -1,20 +1,24 @@
 # ActiveModel integrations
 appraise 'active_model_5.1' do
-  gem 'activemodel', github: 'rails/rails', branch: '5-1-stable'
+  gem 'activemodel', '~> 5.1.1'
 end
 
 appraise 'active_model_5.2' do
-  gem 'activemodel', github: 'rails/rails', branch: '5-2-stable'
+  gem 'activemodel', '~> 5.2.4'
 end
 
 appraise 'active_model_6.0' do
-  gem 'activemodel', github: 'rails/rails', branch: '6-0-stable'
+  gem 'activemodel', '~> 6.0.3'
 end
 
 appraise 'active_model_6.1' do
-  gem 'activemodel', github: 'rails/rails', branch: '6-1-stable'
+  gem 'activemodel', '~> 6.1.3'
+end
+
+appraise 'active_model_7.0' do
+  gem 'activemodel', '~> 7.0.0'
 end
 
 appraise 'active_model_edge' do
-  gem 'activemodel', github: 'rails/rails', branch: 'master'
+  gem 'activemodel', github: 'rails/rails', branch: 'main'
 end
diff --git a/Gemfile b/Gemfile
index 327630b..ff6e62f 100644
--- a/Gemfile
+++ b/Gemfile
@@ -3,6 +3,6 @@ source 'https://rubygems.org'
 # Specify your gem's dependencies in state_machine2_activemodel.gemspec
 gemspec
 
-platforms :mri_20, :mri_21 do
+platforms :mri do
   gem 'pry-byebug'
 end
diff --git a/README.md b/README.md
index b4e2550..b178257 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-[![Build Status](https://travis-ci.com/state-machines/state_machines-activemodel.svg?branch=master)](https://travis-ci.org/state-machines/state_machines-activemodel)
+![Build Status](https://github.com/state-machines/state_machines-activemodel/actions/workflows/ruby.yml/badge.svg)
 [![Code Climate](https://codeclimate.com/github/state-machines/state_machines-activemodel.svg)](https://codeclimate.com/github/state-machines/state_machines-activemodel)
 
 # StateMachines ActiveModel Integration
diff --git a/debian/changelog b/debian/changelog
index cae94cb..c718ee4 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+ruby-state-machines-activemodel (0.8.0+git20220807.1.33e2a5f-1) UNRELEASED; urgency=low
+
+  * New upstream snapshot.
+
+ -- Debian Janitor <janitor@jelmer.uk>  Mon, 16 Jan 2023 22:18:07 -0000
+
 ruby-state-machines-activemodel (0.8.0-3) unstable; urgency=medium
 
   * Reupload to unstable
diff --git a/gemfiles/active_model_5.1.gemfile b/gemfiles/active_model_5.1.gemfile
index b27840b..5ba061f 100644
--- a/gemfiles/active_model_5.1.gemfile
+++ b/gemfiles/active_model_5.1.gemfile
@@ -2,7 +2,7 @@
 
 source "https://rubygems.org"
 
-gem "activemodel", github: "rails/rails", branch: "5-1-stable"
+gem "activemodel", "~> 5.1.1"
 
 platforms :mri_20, :mri_21 do
   gem "pry-byebug"
diff --git a/gemfiles/active_model_5.2.gemfile b/gemfiles/active_model_5.2.gemfile
index 8bd04c6..0de4715 100644
--- a/gemfiles/active_model_5.2.gemfile
+++ b/gemfiles/active_model_5.2.gemfile
@@ -2,7 +2,7 @@
 
 source "https://rubygems.org"
 
-gem "activemodel", github: "rails/rails", branch: "5-2-stable"
+gem "activemodel", "~> 5.2.4"
 
 platforms :mri_20, :mri_21 do
   gem "pry-byebug"
diff --git a/gemfiles/active_model_6.0.gemfile b/gemfiles/active_model_6.0.gemfile
index 2d7a572..a15b040 100644
--- a/gemfiles/active_model_6.0.gemfile
+++ b/gemfiles/active_model_6.0.gemfile
@@ -2,7 +2,7 @@
 
 source "https://rubygems.org"
 
-gem "activemodel", github: "rails/rails", branch: "6-0-stable"
+gem "activemodel", "~> 6.0.3"
 
 platforms :mri_20, :mri_21 do
   gem "pry-byebug"
diff --git a/gemfiles/active_model_6.1.gemfile b/gemfiles/active_model_6.1.gemfile
index eb7e13c..eb8f88d 100644
--- a/gemfiles/active_model_6.1.gemfile
+++ b/gemfiles/active_model_6.1.gemfile
@@ -2,7 +2,7 @@
 
 source "https://rubygems.org"
 
-gem "activemodel", github: "rails/rails", branch: "6-1-stable"
+gem "activemodel", "~> 6.1.3"
 
 platforms :mri_20, :mri_21 do
   gem "pry-byebug"
diff --git a/gemfiles/active_model_7.0.gemfile b/gemfiles/active_model_7.0.gemfile
new file mode 100644
index 0000000..3f60815
--- /dev/null
+++ b/gemfiles/active_model_7.0.gemfile
@@ -0,0 +1,11 @@
+# This file was generated by Appraisal
+
+source "https://rubygems.org"
+
+gem "activemodel", "~> 7.0.0"
+
+platforms :mri_20, :mri_21 do
+  gem "pry-byebug"
+end
+
+gemspec path: "../"
diff --git a/gemfiles/active_model_edge.gemfile b/gemfiles/active_model_edge.gemfile
index 9759c96..a11310a 100644
--- a/gemfiles/active_model_edge.gemfile
+++ b/gemfiles/active_model_edge.gemfile
@@ -2,7 +2,7 @@
 
 source "https://rubygems.org"
 
-gem "activemodel", github: "rails/rails", branch: "master"
+gem "activemodel", github: "rails/rails", branch: "main"
 
 platforms :mri_20, :mri_21 do
   gem "pry-byebug"
diff --git a/lib/state_machines/integrations/active_model.rb b/lib/state_machines/integrations/active_model.rb
index 50b4f8d..26c64a2 100644
--- a/lib/state_machines/integrations/active_model.rb
+++ b/lib/state_machines/integrations/active_model.rb
@@ -184,7 +184,9 @@ module StateMachines
     # == Observers
     #
     # In order to hook in observer support for your application, the
-    # ActiveModel::Observing feature must be included.  Because of the way
+    # ActiveModel::Observing feature must be included.  This can be added by including the
+    # https://github.com/state-machines/state_machines-activemodel-observers gem in your 
+    # Gemfile. Because of the way
     # ActiveModel observers are designed, there is less flexibility around the
     # specific transitions that can be hooked in.  However, a large number of
     # hooks *are* supported.  For example, if a transition for a object's
@@ -405,6 +407,10 @@ module StateMachines
       def define_state_initializer
         define_helper :instance, <<-end_eval, __FILE__, __LINE__ + 1
           def initialize(params = {})
+            params.transform_keys! do |key|
+              self.class.attribute_aliases[key.to_s] || key.to_s
+            end if self.class.respond_to?(:attribute_aliases)
+
             self.class.state_machines.initialize_states(self, {}, params) { super }
           end
         end_eval
diff --git a/state_machines-activemodel.gemspec b/state_machines-activemodel.gemspec
index 89a1ba9..a4989b4 100644
--- a/state_machines-activemodel.gemspec
+++ b/state_machines-activemodel.gemspec
@@ -1,7 +1,7 @@
 # coding: utf-8
 lib = File.expand_path('../lib', __FILE__)
 $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
-require 'state_machines/integrations/active_model/version'
+require_relative 'lib/state_machines/integrations/active_model/version'
 
 Gem::Specification.new do |spec|
   spec.name          = 'state_machines-activemodel'
@@ -16,9 +16,9 @@ Gem::Specification.new do |spec|
   spec.files         = `git ls-files -z`.split("\x0")
   spec.test_files    = spec.files.grep(/^test\//)
   spec.require_paths = ['lib']
-  spec.required_ruby_version     = '>= 2.2.2'
+  spec.required_ruby_version     = '>= 2.6.8'
   spec.add_dependency 'state_machines', '>= 0.5.0'
-  spec.add_dependency 'activemodel', '>= 5.1'
+  spec.add_dependency 'activemodel', '>= 6.0'
 
   spec.add_development_dependency 'bundler', '>= 1.6'
   spec.add_development_dependency 'rake', '>= 10'
diff --git a/test/machine_with_initialized_aliased_attribute_test.rb b/test/machine_with_initialized_aliased_attribute_test.rb
new file mode 100644
index 0000000..66c8ec6
--- /dev/null
+++ b/test/machine_with_initialized_aliased_attribute_test.rb
@@ -0,0 +1,33 @@
+require_relative 'test_helper'
+
+class MachineWithInitializedAliasedAttributeTest < BaseTestCase
+  def test_should_match_original_attribute_value_with_attribute_methods
+    model = new_model do
+      include ActiveModel::AttributeMethods
+      alias_attribute :custom_status, :state
+    end
+
+    machine = StateMachines::Machine.new(model, initial: :parked, integration: :active_model)
+    machine.other_states(:started)
+
+    record = model.new(custom_status: 'started')
+
+    refute record.state?(:parked)
+    assert record.state?(:started)
+  end
+
+  def test_should_not_match_original_attribute_value_without_attribute_methods
+    model = new_model do
+      alias_attribute :custom_status, :state
+    end
+
+    machine = StateMachines::Machine.new(model, initial: :parked, integration: :active_model)
+    machine.other_states(:started)
+
+    record = model.new(custom_status: 'started')
+
+    assert record.state?(:parked)
+    refute record.state?(:started)
+  end
+end
+

Debdiff

File lists identical (after any substitutions)

No differences were encountered in the control files

More details

Full run details