Skip to content

Commit

Permalink
test: fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeCisco committed Dec 3, 2020
1 parent 297bf88 commit a4def70
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app/helpers/forest_liana/widgets_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ module WidgetsHelper
'text input': 'text editor',
}

def set_field_widget(field)
def self.set_field_widget(field)
field[:widgetEdit] = nil
if field[:widget] && !field[:widgetEdit]
if v1_to_v2_edit_widgets_mapping[field[:widget]]
Expand All @@ -52,4 +52,4 @@ def set_field_widget(field)
field.delete(:widget)
end
end
end
end
5 changes: 4 additions & 1 deletion spec/requests/actions_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,10 @@
it 'should respond 200' do
post '/forest/actions/my_action/hooks/change', JSON.dump(params), 'CONTENT_TYPE' => 'application/json'
expect(response.status).to eq(200)
expect(JSON.parse(response.body)).to eq({'fields' => [updated_foo.merge({:value => 'baz'}).stringify_keys]})
expected = updated_foo.merge({:value => 'baz'})
expected[:widgetEdit] = nil
expected.delete(:widget)
expect(JSON.parse(response.body)).to eq({'fields' => [expected.stringify_keys]})
end

it 'should respond 500 with bad params' do
Expand Down

0 comments on commit a4def70

Please sign in to comment.