/
eee_helpers_spec.rb
49 lines (39 loc) · 1.27 KB
/
eee_helpers_spec.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
require File.expand_path(File.dirname(__FILE__) + '/spec_helper' )
describe "wiki" do
it "should return simple text as unaltered text" do
wiki("bob").should contain("bob")
end
it "should return an empty string if called with nil" do
wiki(nil).should == ""
end
it "should convert textile to HTML" do
textile = <<_TEXTILE
paragraph 1 *bold text*
paragraph 2
_TEXTILE
wiki(textile).
should have_selector("p", :content => "paragraph 1 bold text") do |p|
p.should have_selector("strong", :content => "bold text")
end
end
it "should wikify temperatures" do
wiki("250F").should contain("250° F")
end
context "data stored in CouchDB" do
before(:each) do
self.stub!(:_db).and_return("http://example.org/couchdb")
end
it "should lookup kid nicknames" do
RestClient.stub!(:get).and_return('{"marsha":"the oldest Brady girl"}')
wiki("[kid:marsha]").should contain("the oldest Brady girl")
end
it "should wikify recipe URIs" do
RestClient.stub!(:get).
and_return('{"_id":"id-123","title":"Title"}')
wiki("[recipe:id-123]").
should have_selector("a",
:href => "/recipes/id-123",
:content => "Title")
end
end
end