Sha256: d0213699debc491a4f00fa0f39bf9b0069569aee30e72c13896fccb346aeb07b
Contents?: true
Size: 529 Bytes
Versions: 4
Compression:
Stored size: 529 Bytes
Contents
Given /^There is (?:a\s)?(.*)(?:\swith (.*))/ do |resource, params| # Rails.logger.info "--- #{params}" resource = resource.scan(/\w+/).join('_') attributes = {} begin pairs = params.scan(/(\w+)\s"(.*?)"(?:,\s|and\s)?/) raise "Somethings wrong with arguments parsing. Check scenarios!" if pairs.any? {|el| el.nil? } attributes = Hash[pairs] end if params res = instance_variable_set :"@#{resource}", singleton(:"#{resource}", attributes) # Rails.logger.info("created resource - #{res.inspect}") end
Version data entries
4 entries across 4 versions & 1 rubygems