I don't think capture_fields is the problem tbh. The problem is just that the roles= setter expects an array but pickle doesn't how to do that (yet).
There are two solutions that I can see to your problem, using current pickle. One is to rewrite your roles= method to convert string to an array.
def roles=(roles)
roles = roles.split(',').map(&:squish) unless roles.is_a?(Array)
...
end
this will convert the arg as follows:
'vendor_admin' => ['vendor_admin']
'vendor_admin, client_admin' => ['vendor_admin', 'client_admin']
Or, write a custom step something like (remember pickle_steps.rb is just a starting point)
Given /a #{capture_model} with role: (/w+) exists/ do |model, role|
user = create_model(model)
user.roles = [role]
end
Hope that helps
Cheers,
Ian
> --
> You received this message because you are subscribed to the Google Groups "pickle" group.
> To post to this group, send email to pickle-...@googlegroups.com.
> To unsubscribe from this group, send email to pickle-cucumb...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/pickle-cucumber?hl=en.
>
Cheers,
Ian
Try this
create_model(model)
model!(model).roles = [role]
Cheers,
Ian
Given(/^#{capture_model} exists with role: (\w+)$/ do |user, role|
create_model(user)
model!(user).roles = [role]
end
Cheers,
Ian
Sent from my iPhone
CHeers,
Ian