Commit 5748f9af authored by Vitaly Slobodin's avatar Vitaly Slobodin

Switch to addon form data shared example

parent e9922349
# frozen_string_literal: true
RSpec.shared_examples_for 'subscription form data' do |js_selector|
before do
allow(view).to receive(:subscription_data).and_return(
......@@ -18,3 +19,21 @@ RSpec.shared_examples_for 'subscription form data' do |js_selector|
it { is_expected.to have_selector("#{js_selector}[data-plan-id='bronze_id']") }
it { is_expected.to have_selector("#{js_selector}[data-source='some_source']") }
end
RSpec.shared_examples_for 'addon form data' do |js_selector|
before do
allow(view).to receive(:addon_data).and_return(
plan_data: '[{"id":"ci_minutes_plan_id","code":"ci_minutes","price_per_year":10.0}]',
namespace_id: '1',
plan_id: 'ci_minutes_plan_id',
source: 'some_source'
)
end
subject { render }
it { is_expected.to have_selector("#{js_selector}[data-plan-data='[{\"id\":\"ci_minutes_plan_id\",\"code\":\"ci_minutes\",\"price_per_year\":10.0}]']") }
it { is_expected.to have_selector("#{js_selector}[data-plan-id='ci_minutes_plan_id']") }
it { is_expected.to have_selector("#{js_selector}[data-namespace-id='1']") }
it { is_expected.to have_selector("#{js_selector}[data-source='some_source']") }
end
......@@ -3,5 +3,5 @@
require 'spec_helper'
RSpec.describe 'subscriptions/buy_minutes' do
it_behaves_like 'subscription form data', '#js-buy-minutes'
it_behaves_like 'addon form data', '#js-buy-minutes'
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment