File: config_spec.rb

package info (click to toggle)
ruby-buff-config 2.0.0-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 200 kB
  • sloc: ruby: 481; makefile: 4
file content (34 lines) | stat: -rw-r--r-- 788 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
require 'spec_helper'

describe Buff::Config::Base do
  subject { Class.new(described_class).new }

  describe "#to_hash" do
    it "returns a Hash" do
      expect(subject.to_hash).to be_a(Hash)
    end

    it "contains all of the attributes" do
      subject.set_attribute(:something, "value")

      expect(subject.to_hash).to have_key(:something)
      expect(subject.to_hash[:something]).to eql("value")
    end
  end

  describe "#slice" do
    before(:each) do
      subject.set_attribute(:one, nested: "value")
      subject.set_attribute(:two, nested: "other")
      @sliced = subject.slice(:one)
    end

    it "returns a Hash" do
      expect(@sliced).to be_a(Hash)
    end

    it "contains just the sliced elements" do
      expect(@sliced.size).to eq(1)
    end
  end
end