spec/support/models/arstotzka/dummy.rb in arstotzka-1.0.1 vs spec/support/models/arstotzka/dummy.rb in arstotzka-1.0.2

- old
+ new

@@ -1,23 +1,27 @@ -class Arstotzka::Dummy - include Arstotzka - attr_reader :json +# frozen_string_literal: true - expose :id - expose :name, path: 'user' - expose :father_name, full_path: 'father.name' - expose :age, cached: true - expose :house, class: ::House - expose :old_house, class: ::House, cached: true - expose :games, class: ::Game - expose :games_filtered, class: ::Game, after: :filter_games, full_path: 'games' +module Arstotzka + class Dummy + include Arstotzka + attr_reader :json - def initialize(json) - @json = json - end + expose :id + expose :name, path: 'user' + expose :father_name, full_path: 'father.name' + expose :age, cached: true + expose :house, class: ::House + expose :old_house, class: ::House, cached: true + expose :games, class: ::Game + expose :games_filtered, class: ::Game, after: :filter_games, full_path: 'games' - def filter_games(games) - games.select do |g| - g.publisher != 'sega' + def initialize(json) + @json = json + end + + def filter_games(games) + games.reject do |g| + g.publisher == 'sega' + end end end end