BUGFIX: broken spec
This commit is contained in:
parent
239bcd19df
commit
a3f270f0e9
|
@ -3,68 +3,75 @@ require 'discourse_plugin_registry'
|
|||
|
||||
describe DiscoursePluginRegistry do
|
||||
|
||||
let(:registry) { DiscoursePluginRegistry.new }
|
||||
class TestRegistry < DiscoursePluginRegistry; end
|
||||
|
||||
let(:registry) { TestRegistry }
|
||||
let(:registry_instance) { registry.new }
|
||||
|
||||
context '#stylesheets' do
|
||||
it 'defaults to an empty Set' do
|
||||
DiscoursePluginRegistry.stylesheets = nil
|
||||
DiscoursePluginRegistry.stylesheets.should == Set.new
|
||||
registry.stylesheets = nil
|
||||
registry.stylesheets.should == Set.new
|
||||
end
|
||||
end
|
||||
|
||||
context '#javascripts' do
|
||||
it 'defaults to an empty Set' do
|
||||
DiscoursePluginRegistry.javascripts = nil
|
||||
DiscoursePluginRegistry.javascripts.should == Set.new
|
||||
registry.javascripts = nil
|
||||
registry.javascripts.should == Set.new
|
||||
end
|
||||
end
|
||||
|
||||
context '#server_side_javascripts' do
|
||||
it 'defaults to an empty Set' do
|
||||
DiscoursePluginRegistry.server_side_javascripts = nil
|
||||
DiscoursePluginRegistry.server_side_javascripts.should == Set.new
|
||||
registry.server_side_javascripts = nil
|
||||
registry.server_side_javascripts.should == Set.new
|
||||
end
|
||||
end
|
||||
|
||||
context '#admin_javascripts' do
|
||||
it 'defaults to an empty Set' do
|
||||
DiscoursePluginRegistry.admin_javascripts = nil
|
||||
DiscoursePluginRegistry.admin_javascripts.should == Set.new
|
||||
registry.admin_javascripts = nil
|
||||
registry.admin_javascripts.should == Set.new
|
||||
end
|
||||
end
|
||||
|
||||
context '.register_css' do
|
||||
before do
|
||||
registry.register_css('hello.css')
|
||||
registry_instance.register_css('hello.css')
|
||||
end
|
||||
|
||||
it 'is not leaking' do
|
||||
DiscoursePluginRegistry.new.stylesheets.should be_blank
|
||||
end
|
||||
|
||||
it 'is returned by DiscoursePluginRegistry.stylesheets' do
|
||||
registry.stylesheets.include?('hello.css').should be_true
|
||||
registry_instance.stylesheets.include?('hello.css').should be_true
|
||||
end
|
||||
|
||||
it "won't add the same file twice" do
|
||||
lambda { registry.register_css('hello.css') }.should_not change(registry.stylesheets, :size)
|
||||
lambda { registry_instance.register_css('hello.css') }.should_not change(registry.stylesheets, :size)
|
||||
end
|
||||
end
|
||||
|
||||
context '.register_js' do
|
||||
before do
|
||||
registry.register_js('hello.js')
|
||||
registry_instance.register_js('hello.js')
|
||||
end
|
||||
|
||||
it 'is returned by DiscoursePluginRegistry.javascripts' do
|
||||
registry.javascripts.include?('hello.js').should be_true
|
||||
registry_instance.javascripts.include?('hello.js').should be_true
|
||||
end
|
||||
|
||||
it "won't add the same file twice" do
|
||||
lambda { registry.register_js('hello.js') }.should_not change(registry.javascripts, :size)
|
||||
lambda { registry_instance.register_js('hello.js') }.should_not change(registry.javascripts, :size)
|
||||
end
|
||||
end
|
||||
|
||||
context '.register_archetype' do
|
||||
it "delegates archetypes to the Archetype component" do
|
||||
Archetype.expects(:register).with('threaded', hello: 123)
|
||||
registry.register_archetype('threaded', hello: 123)
|
||||
registry_instance.register_archetype('threaded', hello: 123)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue