Sha256: c41374a0c38fe596f5e4f60eadd912e4f91f0a7641d34a0107b535cf833ac0d7

Contents?: true

Size: 476 Bytes

Versions: 8

Compression:

Stored size: 476 Bytes

Contents

require 'spec_helper'

describe NightcrawlerSwift::Ext::OpenStruct do

  let :hash do
    {key1: "value", key2: true}
  end

  subject do
    OpenStruct.new hash
  end

  describe "#to_h" do
    it "returns a hash with the content" do
      expect(subject.to_h).to eql hash
    end

    describe "for a blank object" do
      subject do
        OpenStruct.new
      end

      it "returns an empty hash" do
        expect(subject.to_h).to eql({})
      end
    end
  end

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
nightcrawler_swift-1.0.0 spec/lib/nightcrawler_swift/ext/open_struct_spec.rb
nightcrawler_swift-0.11.1 spec/lib/nightcrawler_swift/ext/open_struct_spec.rb
nightcrawler_swift-0.11.0 spec/lib/nightcrawler_swift/ext/open_struct_spec.rb
nightcrawler_swift-0.10.0 spec/lib/nightcrawler_swift/ext/open_struct_spec.rb
nightcrawler_swift-0.9.0 spec/lib/nightcrawler_swift/ext/open_struct_spec.rb
nightcrawler_swift-0.8.1 spec/lib/nightcrawler_swift/ext/open_struct_spec.rb
nightcrawler_swift-0.8.0 spec/lib/nightcrawler_swift/ext/open_struct_spec.rb
nightcrawler_swift-0.7.0 spec/lib/nightcrawler_swift/ext/open_struct_spec.rb