spec/roboto/content_provider_spec.rb in roboto-0.0.2 vs spec/roboto/content_provider_spec.rb in roboto-0.1.0
- old
+ new
@@ -15,11 +15,19 @@
FileUtils.mkdir_p(Rails.root.join(relative_robots_dir))
end
it 'uses the environment specific file if found' do
path = Rails.root.join("config/robots/test.txt")
- FileUtils.touch(path)
+ File.open(path, 'wb') { |f| f.write(Rails.env) }
content_provider.path.should eql(path)
+ content_provider.contents.should eql(Rails.env)
+ end
+
+ it 'supports erb pre-processing' do
+ path = Rails.root.join("config/robots/test.txt.erb")
+ File.open(path, 'wb') { |f| f.write('<%= Rails.env %>') }
+ content_provider.path.should eql(path)
+ content_provider.contents.should eql(Rails.env)
end
it 'uses the default robots file if found in the rails root' do
path = Rails.root.join(relative_path_to_default)
FileUtils.touch(path)