Permalink
Browse files

Improve command documentation and allow users to nest quotations

  • Loading branch information...
1 parent 4c6624f commit 740df515145c3af6a2ddbb2b712a1e8c415d5f8b @brentvatne committed Jan 20, 2012
View
@@ -46,13 +46,17 @@ me something interesting`. I'm not judging you, Jester might be.
Here's a grab bag of everything you can do. Keep in mind that wherever
you see quotation marks, they are required.
-`a '___' story` - Teaches Jester a story so he can share it with others
+`a ____ story 'story name here'` - Teaches Jester a story so he can share it with others.
+Example: `a funny story 'This story is really funny isn't it'`
`tell me something __` - Hear a particular kind of story, such as funny
+Example: `tell me something funny`
-`tell something '___' to __@__.__` - Sends a random story to a friend!
+`tell something ___ to __@__.__` - Sends a random story to a friend!
+Example: `tell something funny to you@example.com`
`tell me '___'` - Jester tells you a specific story from his collection
+Example: `tell me 'What do you call a lazy bear?'`
`what stories do you know?` - Lists all of Jester's stories
@@ -3,7 +3,7 @@ module Request
class RememberStory
attr_reader :story, :email
- REQUEST_STRING = /^an? (?<type>\w+) story ['"](?<title>[\w\s]+)['"]\s*$/i
+ REQUEST_STRING = /^an? (?<type>\w+) story ['"](?<title>[\w\s'"]+)['"]\s*$/i
# Determines whether the message is calling for this request
#
@@ -18,7 +18,7 @@ def self.handle(message)
end
def self.description
- "a '___' story - Teaches Jester a story so he can share it with others"
+ "a ___ story '___' - Teaches Jester a story so he can share it with others"
end
def initialize(story, email)
@@ -3,7 +3,7 @@ module Request
class TellSpecificStory
attr_reader :title, :email
- REQUEST_STRING = /^tell me ['"](?<title>[\w\s]+)['"]\s*$/i
+ REQUEST_STRING = /^tell me ['"](?<title>[\w\s'"]+)['"]\s*$/i
# Determines whether the message is calling for this request
#
@@ -14,6 +14,11 @@
subject.handle(fishing).should be_a(subject)
end
+ it "should allow quotations between the quotations" do
+ quotations = email(:subject => "a funny story 'let's try this'")
+ subject.handle(quotations).should be_a(subject)
+ end
+
it "correctly handles the arguments" do
request_object = subject.handle(fishing)
request_object.story.type.should == "funny"
@@ -14,6 +14,11 @@
subject.handle(tornado).should be_a(subject)
end
+ it "should allow quotations between the quotations" do
+ quotations = email(:subject => "tell me 'let's try this'")
+ subject.handle(quotations).should be_a(subject)
+ end
+
it "correctly handles the arguments" do
subject.handle(tornado).title.should == 'tornado'
end

0 comments on commit 740df51

Please sign in to comment.