Skip to content

Context structs

This patch rewrites tests to use more Object friendly code in the step definitions and @context object, using Ruby Structs (Simple classes with methods).

it is the first step towards makes scenarios demanding more than one patron possible easier to write, as the structs can have methods, and can be nested

patron = Patron.new generates also a branch and a patron category from this struct

Patron = Struct.new(:cardnumber, :surname, :branch, :category) do
  def initialize
    self.cardnumber = generateRandomString
    self.surname    = generateRandomString
    self.branch     = Branch.new
    self.category   = PatronCategory.new
  end
end

and can further trigger page objects or steps to actually generate the branch and patron category

Merge request reports