Commit a94aa40d authored by Angelo Gulina's avatar Angelo Gulina Committed by Sean McGivern

Add licenses helper

parent c3228bff
......@@ -48,5 +48,11 @@ module LicenseHelper
end
end
def cloud_license_view_data
{
current_plan_title: current_license_title
}
end
extend self
end
......@@ -78,4 +78,24 @@ RSpec.describe LicenseHelper do
end
end
end
describe '#cloud_license_view_data' do
context 'when there is a current license' do
it 'returns the data for the view' do
custom_plan = 'custom plan'
license = double('License', plan: custom_plan)
allow(License).to receive(:current).and_return(license)
expect(cloud_license_view_data).to eq({ current_plan_title: 'Custom Plan' })
end
end
context 'when there is no current license' do
it 'returns the data for the view' do
allow(License).to receive(:current).and_return(nil)
expect(cloud_license_view_data).to eq({ current_plan_title: 'Core' })
end
end
end
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