File: recursion_and_subclassing_spec.rb

package info (click to toggle)
ruby-recursive-open-struct 1.1.3-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 188 kB
  • sloc: ruby: 912; makefile: 6
file content (14 lines) | stat: -rw-r--r-- 431 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
require_relative '../spec_helper'
require 'recursive_open_struct'

describe RecursiveOpenStruct do
  describe "subclassing RecursiveOpenStruct" do
    let(:subclass) { Class.new(RecursiveOpenStruct) }

    subject(:rossc) { subclass.new({ :one => [{:two => :three}] }, recurse_over_arrays: true) }

    specify "nested objects use the subclass of the parent" do
      expect(rossc.one.first.class).to eq subclass
    end
  end
end