Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

More tests about subdirectories

2 more, and keeping the implicit forward slash test.
 * With an explicit leading slash (it works!)
 * With an explicit trailing slash (doesn't work, misses the implicit leading
   and doubles up the trailing slash.)
  • Loading branch information...
commit db06befc9e303d29bbadb4ff2aeeded8d50e8c90 1 parent e6c61c0
@evaryont evaryont authored Alexis Sellier committed
Showing with 36 additions and 8 deletions.
  1. +36 −8 test/toto_test.rb
View
44 test/toto_test.rb
@@ -188,16 +188,44 @@ def readme() "#{self[:name]}'s README" end
end
context "in a subdirectory" do
- setup do
- conf = Toto::Config.new({})
- conf.set(:prefix, "blog")
- Toto::Article.new({
- :title => "Toto & The Wizard of Oz.",
- :body => "#Chapter I\nhello, *stranger*."
- }, conf)
+ context "with implicit leading forward slash" do
+ setup do
+ conf = Toto::Config.new({})
+ conf.set(:prefix, "blog")
+ Toto::Article.new({
+ :title => "Toto & The Wizard of Oz.",
+ :body => "#Chapter I\nhello, *stranger*."
+ }, conf)
+ end
+
+ should("be in the directory") { topic.path }.equals Date.today.strftime("/blog/%Y/%m/%d/toto-and-the-wizard-of-oz/")
end
- should("be in the directory") { topic.path }.equals Date.today.strftime("/blog/%Y/%m/%d/toto-and-the-wizard-of-oz/")
+ context "with explicit leading forward slash" do
+ setup do
+ conf = Toto::Config.new({})
+ conf.set(:prefix, "/blog")
+ Toto::Article.new({
+ :title => "Toto & The Wizard of Oz.",
+ :body => "#Chapter I\nhello, *stranger*."
+ }, conf)
+ end
+
+ should("be in the directory") { topic.path }.equals Date.today.strftime("/blog/%Y/%m/%d/toto-and-the-wizard-of-oz/")
+ end
+
+ context "with explicit trailing forward slash" do
+ setup do
+ conf = Toto::Config.new({})
+ conf.set(:prefix, "blog/")
+ Toto::Article.new({
+ :title => "Toto & The Wizard of Oz.",
+ :body => "#Chapter I\nhello, *stranger*."
+ }, conf)
+ end
+
+ should("be in the directory") { topic.path }.equals Date.today.strftime("/blog/%Y/%m/%d/toto-and-the-wizard-of-oz/")
+ end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.