| 66 | | it "should have load paths" |
|---|
| 67 | | it "should have plugin paths" |
|---|
| 68 | | it "should add load and plugin paths to the configuration" |
|---|
| 69 | | it "should have controller paths" |
|---|
| 70 | | it "should add controller paths to the configuration" |
|---|
| 71 | | it "should have view paths" |
|---|
| 72 | | it "should load and initialize etensions when discovering" |
|---|
| 73 | | it "should deactivate extensions" |
|---|
| 74 | | it "should activate extensions" |
|---|
| | 66 | it "should have load paths" do |
|---|
| | 67 | @instance.stub!(:load_extension_roots).and_return(@extension_paths) |
|---|
| | 68 | @instance.should respond_to(:load_paths) |
|---|
| | 69 | @instance.load_paths.should be_instance_of(Array) |
|---|
| | 70 | @instance.load_paths.all? {|f| File.directory?(f) }.should be_true |
|---|
| | 71 | end |
|---|
| | 72 | |
|---|
| | 73 | it "should have plugin paths" do |
|---|
| | 74 | @instance.stub!(:load_extension_roots).and_return(@extension_paths) |
|---|
| | 75 | @instance.should respond_to(:plugin_paths) |
|---|
| | 76 | @instance.plugin_paths.should be_instance_of(Array) |
|---|
| | 77 | @instance.plugin_paths.all? {|f| File.directory?(f) }.should be_true |
|---|
| | 78 | end |
|---|
| | 79 | |
|---|
| | 80 | it "should add load and plugin paths to the configuration" do |
|---|
| | 81 | load_paths, plugin_paths = [], [] |
|---|
| | 82 | @instance.should_receive(:load_paths).and_return(@extension_paths) |
|---|
| | 83 | @instance.should_receive(:plugin_paths).and_return([@extension_paths.first + "/vendor/plugins"]) |
|---|
| | 84 | @configuration.should_receive(:load_paths).at_least(:once).and_return(load_paths) |
|---|
| | 85 | @configuration.should_receive(:plugin_paths).and_return(plugin_paths) |
|---|
| | 86 | @instance.add_load_and_plugin_paths |
|---|
| | 87 | load_paths.should == @extension_paths |
|---|
| | 88 | plugin_paths.should == [@extension_paths.first + "/vendor/plugins"] |
|---|
| | 89 | end |
|---|
| | 90 | |
|---|
| | 91 | it "should have controller paths" do |
|---|
| | 92 | @instance.should respond_to(:controller_paths) |
|---|
| | 93 | @instance.controller_paths.should be_instance_of(Array) |
|---|
| | 94 | @instance.controller_paths.all? {|f| File.directory?(f) }.should be_true |
|---|
| | 95 | end |
|---|
| | 96 | |
|---|
| | 97 | it "should add controller paths to the configuration" do |
|---|
| | 98 | controller_paths = [] |
|---|
| | 99 | @instance.stub!(:extensions).and_return([BasicExtension]) |
|---|
| | 100 | @configuration.should_receive(:controller_paths).and_return(controller_paths) |
|---|
| | 101 | @instance.add_controller_paths |
|---|
| | 102 | controller_paths.should include(BasicExtension.root + "/app/controllers") |
|---|
| | 103 | end |
|---|
| | 104 | |
|---|
| | 105 | it "should have view paths" do |
|---|
| | 106 | @instance.should respond_to(:view_paths) |
|---|
| | 107 | @instance.view_paths.should be_instance_of(Array) |
|---|
| | 108 | @instance.view_paths.all? {|f| File.directory?(f) }.should be_true |
|---|
| | 109 | end |
|---|
| | 110 | |
|---|
| | 111 | it "should load and initialize extensions when discovering" do |
|---|
| | 112 | @instance.should_receive(:load_extension_roots).and_return(@extension_paths) |
|---|
| | 113 | @instance.discover_extensions |
|---|
| | 114 | @extensions.each do |ext| |
|---|
| | 115 | ext_class = Object.const_get(ext.gsub(/^\d+_/, '').camelize + "Extension") |
|---|
| | 116 | ext_class.should_not be_nil |
|---|
| | 117 | ext_class.root.should_not be_nil |
|---|
| | 118 | end |
|---|
| | 119 | end |
|---|
| | 120 | |
|---|
| | 121 | it "should deactivate extensions" do |
|---|
| | 122 | extensions = [BasicExtension, OverridingExtension] |
|---|
| | 123 | @instance.extensions = extensions |
|---|
| | 124 | @instance.deactivate_extensions |
|---|
| | 125 | extensions.any?(&:active?).should be_false |
|---|
| | 126 | end |
|---|
| | 127 | |
|---|
| | 128 | it "should activate extensions" do |
|---|
| | 129 | @initializer.should_receive(:initialize_default_admin_tabs) |
|---|
| | 130 | @initializer.should_receive(:initialize_framework_views) |
|---|
| | 131 | extensions = [BasicExtension, OverridingExtension] |
|---|
| | 132 | @instance.extensions = extensions |
|---|
| | 133 | @instance.activate_extensions |
|---|
| | 134 | extensions.all?(&:active?).should be_true |
|---|
| | 135 | end |
|---|