mirror of
https://github.com/discourse/discourse.git
synced 2024-11-28 16:18:33 +08:00
33 lines
980 B
Ruby
33 lines
980 B
Ruby
|
require 'spec_helper'
|
||
|
require_dependency 'plugin/instance'
|
||
|
|
||
|
describe Plugin::Instance do
|
||
|
|
||
|
context "activate!" do
|
||
|
it "can activate plugins correctly" do
|
||
|
plugin = Plugin.new
|
||
|
plugin.path = "#{Rails.root}/spec/fixtures/plugins/my_plugin/plugin.rb"
|
||
|
junk_file = "#{plugin.auto_generated_path}/junk"
|
||
|
|
||
|
plugin.ensure_directory(junk_file)
|
||
|
File.open("#{plugin.auto_generated_path}/junk", "w") {|f| f.write("junk")}
|
||
|
plugin.activate!
|
||
|
|
||
|
plugin.auth_providers.count.should == 1
|
||
|
auth_provider = plugin.auth_providers[0]
|
||
|
auth_provider.options.should == {:identifier => 'https://zappa.com'}
|
||
|
auth_provider.type.should == :open_id
|
||
|
|
||
|
# calls ensure_assets! make sure they are there
|
||
|
plugin.assets.count.should == 2
|
||
|
plugin.assets.each do |a|
|
||
|
File.exists?(a).should be_true
|
||
|
end
|
||
|
|
||
|
# ensure it cleans up all crap in autogenerated directory
|
||
|
File.exists?(junk_file).should be_false
|
||
|
end
|
||
|
end
|
||
|
|
||
|
end
|