Created
February 12, 2010 15:07
-
-
Save rlivsey/302631 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') | |
# Not a fan of this spec | |
# Should really test behavior, not implementation. | |
# So should have controller/integration specs which make sure the right templates are rendered | |
# We can have those once we have some templates setup which should make this redundant | |
describe "view_paths" do | |
before(:each) do | |
template = ActionView::Template.new('sports/index.html.erb') | |
tab = mock(:tab, :template_directory => "tab_dir") | |
site = mock(:site, :template_directory => "test.com") | |
locale = mock(:locale, :code => "en-gb") | |
controller = mock(:controller, | |
:null_object => true, | |
:template => template) | |
controller.stub!(:current_site).and_return(site) | |
controller.stub!(:current_locale).and_return(locale) | |
controller.stub!(:current_tab).and_return(tab) | |
@view = ActionView::Base.new([], {}, controller) | |
end | |
it "should return the view paths which exist in the correct order" do | |
File.should_receive(:exists?).with(File.join(RAILS_ROOT, "app", "sites", "test.com")).once.and_return(false) | |
File.should_receive(:exists?).with(File.join(RAILS_ROOT, "app", "sites", "test.com", "en-gb")).once.and_return(true) | |
File.should_receive(:exists?).with(File.join(RAILS_ROOT, "app", "sites", "test.com", "en-gb", "tab_dir")).once.and_return(true) | |
@view.view_paths.should == [ | |
File.join(RAILS_ROOT, "app", "sites", "test.com", "en-gb", "tab_dir"), | |
File.join(RAILS_ROOT, "app", "sites", "test.com", "en-gb") | |
] | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment