Sha256: 6aeb31be6ee497dd45ad2de5d82e1ea8b489413f584e2c88c743451c280568ca

Contents?: true

Size: 1.35 KB

Versions: 16

Compression:

Stored size: 1.35 KB

Contents

require "rails_helper"

describe MagicLamp::Configuration do
  context "attr_accessor" do
    it { is_expected.to attr_accessorize :before_each_proc }
    it { is_expected.to attr_accessorize :after_each_proc }
    it { is_expected.to attr_accessorize :infer_names }
    it { is_expected.to attr_accessorize :global_defaults }
  end

  describe "#initialize" do
    it "infers names by default" do
      expect(subject.infer_names).to eq(true)
    end

    it "has an empty hash for global defaults" do
      expect(subject.global_defaults).to eq({})
    end
  end

  describe "#before_each" do
    it "saves its given block" do
      block = proc { "something before" }
      subject.before_each(&block)
      expect(subject.before_each_proc).to eq(block)
    end

    it "raises an error when not given a block" do
      expect do
        subject.before_each
      end.to raise_error(MagicLamp::ArgumentError, /configuration#before_each requires a block/)
    end
  end

  describe "#after_each" do
    it "saves its given block" do
      block = proc { "something before" }
      subject.after_each(&block)
      expect(subject.after_each_proc).to eq(block)
    end

    it "raises an error when not given a block" do
      expect do
        subject.after_each
      end.to raise_error(MagicLamp::ArgumentError, /configuration#after_each requires a block/)
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
magic_lamp-1.8.1 spec/lib/configuration_spec.rb
magic_lamp-1.8.0 spec/lib/configuration_spec.rb
magic_lamp-1.7.0 spec/lib/configuration_spec.rb
magic_lamp-1.6.2 spec/lib/configuration_spec.rb
magic_lamp-1.6.1 spec/lib/configuration_spec.rb
magic_lamp-1.6.0 spec/lib/configuration_spec.rb
magic_lamp-1.5.2 spec/lib/configuration_spec.rb
magic_lamp-1.5.1 spec/lib/configuration_spec.rb
magic_lamp-1.5.0 spec/lib/configuration_spec.rb
magic_lamp-1.4.1 spec/lib/configuration_spec.rb
magic_lamp-1.4.0 spec/lib/configuration_spec.rb
magic_lamp-1.3.1 spec/lib/configuration_spec.rb
magic_lamp-1.3.0 spec/lib/configuration_spec.rb
magic_lamp-1.2.0 spec/lib/configuration_spec.rb
magic_lamp-1.1.1 spec/lib/configuration_spec.rb
magic_lamp-1.1.0 spec/lib/configuration_spec.rb