summaryrefslogtreecommitdiff
path: root/spec/controllers/spree/admin/subscriptions_controller_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/controllers/spree/admin/subscriptions_controller_spec.rb')
-rw-r--r--spec/controllers/spree/admin/subscriptions_controller_spec.rb36
1 files changed, 18 insertions, 18 deletions
diff --git a/spec/controllers/spree/admin/subscriptions_controller_spec.rb b/spec/controllers/spree/admin/subscriptions_controller_spec.rb
index c12c0f7..a2fc8e6 100644
--- a/spec/controllers/spree/admin/subscriptions_controller_spec.rb
+++ b/spec/controllers/spree/admin/subscriptions_controller_spec.rb
@@ -112,75 +112,75 @@ RSpec.describe Spree::Admin::SubscriptionsController, type: :request do
end
describe 'POST cancel' do
- subject { delete spree.cancel_admin_subscription_path(subscription) }
+ subject(:delete_subscription) { delete spree.cancel_admin_subscription_path(subscription) }
- context 'the subscription can be canceled' do
+ context 'when the subscription can be canceled' do
let(:subscription) { create :subscription, :actionable }
it { is_expected.to redirect_to spree.admin_subscriptions_path }
it 'has a message' do
- subject
+ delete_subscription
expect(flash[:notice]).to be_present
end
it 'cancels the subscription' do
- expect { subject }.to change { subscription.reload.state }.from('active').to('canceled')
+ expect { delete_subscription }.to change { subscription.reload.state }.from('active').to('canceled')
end
end
- context 'the subscription cannot be canceled' do
+ context 'when the subscription cannot be canceled' do
let(:subscription) { create :subscription, :canceled }
it { is_expected.to redirect_to spree.admin_subscriptions_path }
it 'has a message' do
- subject
+ delete_subscription
expect(flash[:notice]).to be_present
end
it 'cancels the subscription' do
- expect { subject }.not_to change { subscription.reload.state }
+ expect { delete_subscription }.not_to(change { subscription.reload.state })
end
end
end
describe 'POST activate' do
- subject { post spree.activate_admin_subscription_path(subscription) }
+ subject(:activate) { post spree.activate_admin_subscription_path(subscription) }
- context 'the subscription can be activated' do
+ context 'when the subscription can be activated' do
let(:subscription) { create :subscription, :canceled, :with_line_item }
it { is_expected.to redirect_to spree.admin_subscriptions_path }
it 'has a message' do
- subject
+ activate
expect(flash[:notice]).to be_present
end
it 'cancels the subscription' do
- expect { subject }.to change { subscription.reload.state }.from('canceled').to('active')
+ expect { activate }.to change { subscription.reload.state }.from('canceled').to('active')
end
end
- context 'the subscription cannot be activated' do
+ context 'when the subscription cannot be activated' do
let(:subscription) { create :subscription, :actionable, :with_line_item }
it { is_expected.to redirect_to spree.admin_subscriptions_path }
it 'has a message' do
- subject
+ activate
expect(flash[:notice]).to be_present
end
it 'cancels the subscription' do
- expect { subject }.not_to change { subscription.reload.state }
+ expect { activate }.not_to(change{ subscription.reload.state })
end
end
end
describe 'POST skip' do
- subject { post spree.skip_admin_subscription_path(subscription) }
+ subject(:skip) { post spree.skip_admin_subscription_path(subscription) }
let(:subscription) { create :subscription, :actionable, :with_line_item }
let!(:expected_date) { subscription.next_actionable_date }
@@ -188,12 +188,12 @@ RSpec.describe Spree::Admin::SubscriptionsController, type: :request do
it { is_expected.to redirect_to spree.admin_subscriptions_path }
it 'has a message' do
- subject
+ skip
expect(flash[:notice]).to be_present
end
- it 'advances the actioanble_date' do
- expect { subject }.
+ it 'advances the actionable_date' do
+ expect { skip }.
to change { subscription.reload.actionable_date }.
from(subscription.actionable_date).to(expected_date)
end