Skip to content
Snippets Groups Projects

In-app awareness of Registration Features - Group access by IP address

All threads resolved!
2 files
+ 104
5
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -19,7 +19,6 @@
@@ -19,7 +19,6 @@
it 'renders ranges in comma separated format' do
it 'renders ranges in comma separated format' do
render
render
expect(rendered).to render_template('groups/settings/_ip_restriction_form_group')
expect(rendered).to render_template('groups/settings/_ip_restriction')
expect(rendered).to render_template('groups/settings/_ip_restriction')
expect(rendered).to(have_field('group_ip_restriction_ranges',
expect(rendered).to(have_field('group_ip_restriction_ranges',
disabled: false,
disabled: false,
@@ -32,8 +31,7 @@
@@ -32,8 +31,7 @@
it 'does not render the ranges' do
it 'does not render the ranges' do
render
render
expect(rendered).to render_template('groups/settings/_ip_restriction_form_group')
expect(rendered).to render_template('groups/settings/_ip_restriction')
expect(rendered).not_to render_template('groups/settings/_ip_restriction')
expect(rendered).not_to have_field('group_ip_restriction_ranges', type: :hidden)
expect(rendered).not_to have_field('group_ip_restriction_ranges', type: :hidden)
end
end
end
end
@@ -42,8 +40,19 @@
@@ -42,8 +40,19 @@
it 'renders a placeholder input with registration features message' do
it 'renders a placeholder input with registration features message' do
render
render
expect(rendered).to render_template('shared/_registration_features_discovery_message')
expect(rendered).to have_field('disabled_ip_restriction_ranges', disabled: true)
expect(rendered).to have_field('disabled_ip_restriction_ranges', disabled: true)
 
expect(rendered).to have_content(s_("RegistrationFeatures|Want to %{feature_title} for free?") % { feature_title: s_('RegistrationFeatures|use this feature') })
 
expect(rendered).to have_link(s_('RegistrationFeatures|Registration Features Program'))
 
expect(rendered).to have_link(s_('RegistrationFeatures|Enable Service Ping and register for this feature.'))
 
end
 
end
 
 
shared_examples_for 'does not render registration features prompt' do
 
it 'does not render a placeholder input with registration features message' do
 
render
 
 
expect(rendered).not_to have_field('disabled_ip_restriction_ranges', disabled: true)
 
expect(rendered).not_to have_content(s_("RegistrationFeatures|Want to %{feature_title} for free?") % { feature_title: s_('RegistrationFeatures|use this feature') })
end
end
end
end
@@ -63,12 +72,14 @@
@@ -63,12 +72,14 @@
let(:ranges) { ['192.168.0.0/24'] }
let(:ranges) { ['192.168.0.0/24'] }
it_behaves_like 'renders ip_restriction setting'
it_behaves_like 'renders ip_restriction setting'
 
it_behaves_like 'does not render registration features prompt'
end
end
context 'with multiple subnets' do
context 'with multiple subnets' do
let(:ranges) { ['192.168.0.0/24', '192.168.1.0/8'] }
let(:ranges) { ['192.168.0.0/24', '192.168.1.0/8'] }
it_behaves_like 'renders ip_restriction setting'
it_behaves_like 'renders ip_restriction setting'
 
it_behaves_like 'does not render registration features prompt'
end
end
end
end
end
end
@@ -85,7 +96,39 @@
@@ -85,7 +96,39 @@
end
end
it_behaves_like 'does not render ip_restriction setting'
it_behaves_like 'does not render ip_restriction setting'
it_behaves_like 'renders registration features prompt'
end
 
 
context 'prompt user about registration features' do
 
context 'with service ping disabled' do
 
before do
 
stub_application_setting(usage_ping_enabled: false)
 
end
 
 
context 'with no license' do
 
before do
 
allow(License).to receive(:current).and_return(nil)
 
end
 
 
it_behaves_like 'renders registration features prompt'
 
end
 
 
context 'with a valid license' do
 
before do
 
license = build(:license)
 
allow(License).to receive(:current).and_return(license)
 
end
 
 
it_behaves_like 'does not render registration features prompt'
 
end
 
end
 
 
context 'with service ping enabled' do
 
before do
 
stub_application_setting(usage_ping_enabled: true)
 
end
 
 
it_behaves_like 'does not render registration features prompt'
 
end
end
end
end
end
Loading