summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorAlessandro Desantis <desa.alessandro@gmail.com>2021-02-05 14:40:12 +0100
committerGitHub <noreply@github.com>2021-02-05 14:40:12 +0100
commit6c415c25cead5ecd219b4a5a0004870211440f00 (patch)
tree813cc803aca66a13cef3476dd2cd9dea482ac71c /spec
parent4bd54e61e4f0c47664115171298e8875b4110c00 (diff)
parentb904fb5aa324b0907cba9bdd3c718ae9d704c536 (diff)
Merge pull request #193 from solidusio-contrib/deprecate-nested-subscription-attributes-from-user
Deprecate nested subscription attributes from user
Diffstat (limited to 'spec')
-rw-r--r--spec/decorators/models/solidus_subscriptions/spree/user/have_many_subscriptions.rb8
-rw-r--r--spec/decorators/models/solidus_subscriptions/spree/user/have_many_subscriptions_spec.rb20
2 files changed, 20 insertions, 8 deletions
diff --git a/spec/decorators/models/solidus_subscriptions/spree/user/have_many_subscriptions.rb b/spec/decorators/models/solidus_subscriptions/spree/user/have_many_subscriptions.rb
deleted file mode 100644
index 4ef7491..0000000
--- a/spec/decorators/models/solidus_subscriptions/spree/user/have_many_subscriptions.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-require 'spec_helper'
-
-RSpec.describe SolidusSubscriptions::Spree::User::HaveManySubscritptions, type: :model do
- subject { Spree::User.new }
-
- it { is_expected.to have_many :subscriptions }
- it { is_expected.to accept_nested_attributes_for :subscriptions }
-end
diff --git a/spec/decorators/models/solidus_subscriptions/spree/user/have_many_subscriptions_spec.rb b/spec/decorators/models/solidus_subscriptions/spree/user/have_many_subscriptions_spec.rb
new file mode 100644
index 0000000..a76f130
--- /dev/null
+++ b/spec/decorators/models/solidus_subscriptions/spree/user/have_many_subscriptions_spec.rb
@@ -0,0 +1,20 @@
+require 'spec_helper'
+
+RSpec.describe SolidusSubscriptions::Spree::User::HaveManySubscriptions, type: :model do
+ subject { Spree::User.new }
+
+ it { is_expected.to have_many :subscriptions }
+ it { is_expected.to accept_nested_attributes_for :subscriptions }
+
+ describe '#subscriptions_attributes=' do
+ it 'throws a deprecation warning' do
+ allow(::Spree::Deprecation).to receive(:warn)
+
+ subject.subscriptions_attributes = [{ interval_length: 2 }]
+
+ expect(::Spree::Deprecation)
+ .to have_received(:warn)
+ .with(/Creating or updating subscriptions through Spree::User nested attributes is deprecated/)
+ end
+ end
+end