spec/models/blacklight/configurable_spec.rb in blacklight-6.25.0 vs spec/models/blacklight/configurable_spec.rb in blacklight-7.0.0.rc1

- old
+ new

@@ -1,8 +1,8 @@ # frozen_string_literal: true -describe "Blacklight::Configurable" do +RSpec.describe "Blacklight::Configurable" do describe "inheritence" do before(:all) do module TestCaseInheritence class Parent @@ -15,23 +15,23 @@ class Child < Parent end end end - it "inherits the configuration when subclassed" do + it "inherits the configuration when subclassed" do expect(TestCaseInheritence::Child.blacklight_config.list).to include(1,2,3) end - - it "inherited version should be a deep copy, not original" do + + it "inherited version should be a deep copy, not original" do expect(TestCaseInheritence::Child.blacklight_config).to_not be(TestCaseInheritence::Parent.blacklight_config) - + TestCaseInheritence::Child.blacklight_config.list << "child_only" - expect(TestCaseInheritence::Child.blacklight_config.list).to include("child_only") + expect(TestCaseInheritence::Child.blacklight_config.list).to include("child_only") expect(TestCaseInheritence::Parent.blacklight_config.list).to_not include("child_only") - end + end end describe "default configuration" do before(:each) do Blacklight::Configurable.default_configuration = nil @@ -54,44 +54,44 @@ Blacklight::Configurable.default_configuration = Blacklight::Configuration.new :a => 1 a.send(:include, Blacklight::Configurable) expect(a.blacklight_config.a).to eq 1 end - + it "has configure_blacklight convenience method" do klass = Class.new klass.send(:include, Blacklight::Configurable) - + klass.configure_blacklight do |config| config.my_key = 'value' - end - + end + expect(klass.blacklight_config.my_key).to eq 'value' end it "allows the instance to set a radically different config from the class" do klass = Class.new klass.send(:include, Blacklight::Configurable) klass.blacklight_config.foo = "bar" instance = klass.new instance.blacklight_config = Blacklight::Configuration.new - + expect(instance.blacklight_config).to_not eq klass.blacklight_config expect(instance.blacklight_config.foo).to be_nil end - + it "allows instance to set it's own config seperate from class" do # this is built into class_attribute; we spec it both to document it, # and to ensure we preserve this feature if we change implementation # to not use class_attribute klass = Class.new klass.send(:include, Blacklight::Configurable) klass.blacklight_config.foo = "bar" klass.blacklight_config.bar = [] klass.blacklight_config.bar << "asd" - + instance = klass.new instance.blacklight_config.bar << "123" expect(instance.blacklight_config).to_not eq klass.blacklight_config expect(klass.blacklight_config.foo).to eq "bar" expect(instance.blacklight_config.foo).to eq "bar" @@ -109,9 +109,8 @@ klass2.blacklight_config.foo = "asdf" expect(klass.blacklight_config.foo).to eq "bar" expect(klass2.blacklight_config.foo).to eq "asdf" end - + end end -