|
29 | 29 | category: category, |
30 | 30 | fixed_parameters: { 'Platform Fee' => '1000' }, |
31 | 31 | open_parameters_label: ['Users'], |
32 | | - pricing_options: { 'Tier' => { 'Silver' => '150' } }, |
| 32 | + pricing_options: { "Tier" => { "options" => { "Silver" => "200" }, "value_label" => "Cost Per User" } }, |
33 | 33 | calculation_formula: 'Platform Fee * Tier') |
34 | 34 | end |
35 | 35 |
|
|
43 | 43 | expect(response.body).to include('Users') |
44 | 44 | expect(response.body).to include('Tier') |
45 | 45 | expect(response.body).to include('Silver') |
46 | | - expect(response.body).to include('150') |
| 46 | + expect(response.body).to include('200') |
| 47 | + expect(response.body).to include('Cost Per User') |
47 | 48 | expect(response.body).to include('Platform Fee * Tier') |
48 | 49 | end |
49 | 50 | end |
|
88 | 89 | post '/admin/items/new/create_parameter', params: { |
89 | 90 | parameter_type: 'Select', |
90 | 91 | select_parameter_name: 'Tier', |
91 | | - option_description_1: '1-5', # rubocop:disable Naming/VariableNumber |
92 | | - option_value_1: '100' # rubocop:disable Naming/VariableNumber |
| 92 | + value_label: 'Cost Per User', |
| 93 | + select_options: [ |
| 94 | + { description: '1-5', value: '100' } |
| 95 | + ] |
93 | 96 | } |
94 | 97 |
|
95 | 98 | post '/admin/items/new/update_formula', params: { |
|
105 | 108 | item = Item.last |
106 | 109 | expect(item.fixed_parameters).to eq('Acquisition' => '2500') |
107 | 110 | expect(item.open_parameters_label).to eq(['Custom']) |
108 | | - expect(item.pricing_options).to eq('Tier' => { '1-5' => '100' }) |
| 111 | + expect(item.pricing_options).to eq("Tier" => { "options" => { "1-5" => "100" }, "value_label" => "Cost Per User" }) |
109 | 112 | expect(item.formula_parameters).to eq(%w[Acquisition Custom Tier]) |
110 | 113 | expect(item.calculation_formula).to eq('Acquisition * Tier') |
111 | 114 | expect(item.is_fixed).to be true |
|
199 | 202 | post '/admin/items/new/create_parameter', params: { |
200 | 203 | parameter_type: 'Select', |
201 | 204 | select_parameter_name: 'Tier', |
202 | | - option_description_1: '1-5', # rubocop:disable Naming/VariableNumber |
203 | | - option_value_1: '100' # rubocop:disable Naming/VariableNumber |
| 205 | + value_label: 'Cost Per User', |
| 206 | + select_options: [ |
| 207 | + { description: '1-5', value: '100' } |
| 208 | + ] |
204 | 209 | } |
205 | 210 |
|
206 | 211 | post '/admin/items/new/update_formula', params: { |
|
228 | 233 | expect(response.body).not_to include('Tier') |
229 | 234 | end |
230 | 235 | end |
231 | | - |
232 | | - describe 'POST /admin/items/:id/update_formula' do |
233 | | - it 'updates the calculation formula for a persisted item' do |
234 | | - post "/admin/items/#{item.id}/update_formula", params: { |
235 | | - calculation_formula: 'NewFormula * 2' |
236 | | - } |
237 | | - item.reload |
238 | | - expect(item.calculation_formula).to eq('NewFormula * 2') |
239 | | - expect(response).to redirect_to("/admin/items/#{item.id}/edit") |
240 | | - expect(flash[:notice]).to eq('Formula saved!') |
241 | | - end |
242 | | - end |
243 | 236 | end |
0 commit comments