gopher2000 0.4.0 → 0.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -24,7 +24,7 @@ describe Gopher::Application do
24
24
  @request = Gopher::Request.new("/about")
25
25
 
26
26
  keys, block = @server.lookup(@request.selector)
27
- keys.should == {}
27
+ expect(keys).to eq({})
28
28
  end
29
29
 
30
30
  it "should translate path" do
@@ -32,7 +32,7 @@ describe Gopher::Application do
32
32
  @request = Gopher::Request.new("/about/x/y")
33
33
 
34
34
  keys, block = @server.lookup(@request.selector)
35
- keys.should == {:foo => 'x', :bar => 'y'}
35
+ expect(keys).to eq({:foo => 'x', :bar => 'y'})
36
36
  end
37
37
 
38
38
  it "should return default route if no other route found, and default is defined" do
@@ -41,8 +41,8 @@ describe Gopher::Application do
41
41
  end
42
42
  @request = Gopher::Request.new("/about/x/y")
43
43
  @response = @server.dispatch(@request)
44
- @response.body.should == "DEFAULT ROUTE"
45
- @response.code.should == :success
44
+ expect(@response.body).to eq("DEFAULT ROUTE")
45
+ expect(@response.code).to eq(:success)
46
46
  end
47
47
 
48
48
  it "should respond with error if no route found" do
@@ -50,7 +50,7 @@ describe Gopher::Application do
50
50
  @request = Gopher::Request.new("/junk/x/y")
51
51
 
52
52
  @response = @server.dispatch(@request)
53
- @response.code.should == :missing
53
+ expect(@response.code).to eq(:missing)
54
54
  end
55
55
 
56
56
  it "should respond with error if invalid request" do
@@ -58,7 +58,7 @@ describe Gopher::Application do
58
58
  @request = Gopher::Request.new("x" * 256)
59
59
 
60
60
  @response = @server.dispatch(@request)
61
- @response.code.should == :error
61
+ expect(@response.code).to eq(:error)
62
62
  end
63
63
 
64
64
  it "should respond with error if there's an exception" do
@@ -66,7 +66,7 @@ describe Gopher::Application do
66
66
  @request = Gopher::Request.new("/x")
67
67
 
68
68
  @response = @server.dispatch(@request)
69
- @response.code.should == :error
69
+ expect(@response.code).to eq(:error)
70
70
  end
71
71
  end
72
72
 
@@ -82,7 +82,7 @@ describe Gopher::Application do
82
82
 
83
83
  it "should run the block" do
84
84
  @response = @server.dispatch(@request)
85
- @response.body.should == "GOPHERTRON"
85
+ expect(@response.body).to eq("GOPHERTRON")
86
86
  end
87
87
  end
88
88
 
@@ -97,33 +97,33 @@ describe Gopher::Application do
97
97
 
98
98
  it "should use incoming params" do
99
99
  @response = @server.dispatch(@request)
100
- @response.body.should == "x/a/y/b"
100
+ expect(@response.body).to eq("x/a/y/b")
101
101
  end
102
102
  end
103
103
 
104
104
  describe "dispatch to mount" do
105
105
  before(:each) do
106
- @h = mock(Gopher::Handlers::DirectoryHandler)
107
- @h.should_receive(:application=).with(@server)
108
- Gopher::Handlers::DirectoryHandler.should_receive(:new).with({:bar => :baz, :mount_point => "/foo"}).and_return(@h)
106
+ @h = double(Gopher::Handlers::DirectoryHandler)
107
+ expect(@h).to receive(:application=).with(@server)
108
+ expect(Gopher::Handlers::DirectoryHandler).to receive(:new).with({:bar => :baz, :mount_point => "/foo"}).and_return(@h)
109
109
 
110
110
  @server.mount "/foo", :bar => :baz
111
111
  end
112
112
 
113
113
  it "should work for root path" do
114
114
  @request = Gopher::Request.new("/foo")
115
- @h.should_receive(:call).with({:splat => ""}, @request)
115
+ expect(@h).to receive(:call).with({:splat => ""}, @request)
116
116
 
117
117
  @response = @server.dispatch(@request)
118
- @response.code.should == :success
118
+ expect(@response.code).to eq(:success)
119
119
  end
120
120
 
121
121
  it "should work for subdir" do
122
122
  @request = Gopher::Request.new("/foo/bar")
123
- @h.should_receive(:call).with({:splat => "bar"}, @request)
123
+ expect(@h).to receive(:call).with({:splat => "bar"}, @request)
124
124
 
125
125
  @response = @server.dispatch(@request)
126
- @response.code.should == :success
126
+ expect(@response.code).to eq(:success)
127
127
  end
128
128
  end
129
129
 
@@ -138,7 +138,7 @@ describe Gopher::Application do
138
138
  it "should put wildcard into param[:splat]" do
139
139
  @request = Gopher::Request.new("/about/a/b")
140
140
  @response = @server.dispatch(@request)
141
- @response.body.should == "a/b"
141
+ expect(@response.body).to eq("a/b")
142
142
  end
143
143
  end
144
144
  end
data/spec/dsl_spec.rb CHANGED
@@ -14,7 +14,7 @@ describe Gopher::DSL do
14
14
 
15
15
  @server = FakeServer.new(@app)
16
16
  @server.send :require, 'gopher2000/dsl'
17
- @server.stub!(:application).and_return(@app)
17
+ allow(@server).to receive(:application).and_return(@app)
18
18
  @app.reset!
19
19
  end
20
20
 
@@ -22,13 +22,13 @@ describe Gopher::DSL do
22
22
  describe "set" do
23
23
  it "should set a config var" do
24
24
  @server.set :foo, 'bar'
25
- @app.config[:foo].should == 'bar'
25
+ expect(@app.config[:foo]).to eq('bar')
26
26
  end
27
27
  end
28
28
 
29
29
  describe "route" do
30
30
  it "should pass a lookup and block to the app" do
31
- @app.should_receive(:route).with('/foo')
31
+ expect(@app).to receive(:route).with('/foo')
32
32
  @server.route '/foo' do
33
33
  "hi"
34
34
  end
@@ -37,7 +37,7 @@ describe Gopher::DSL do
37
37
 
38
38
  describe "default_route" do
39
39
  it "should pass a default block to the app" do
40
- @app.should_receive(:default_route)
40
+ expect(@app).to receive(:default_route)
41
41
  @server.default_route do
42
42
  "hi"
43
43
  end
@@ -46,19 +46,19 @@ describe Gopher::DSL do
46
46
 
47
47
  describe "mount" do
48
48
  it "should pass a route, path, and some opts to the app" do
49
- @app.should_receive(:mount).with('/foo', {:path => "/bar"})
49
+ expect(@app).to receive(:mount).with('/foo', {:path => "/bar"})
50
50
  @server.mount "/foo" => "/bar"
51
51
  end
52
52
 
53
53
  it "should pass a route, path, filter, and some opts to the app" do
54
- @app.should_receive(:mount).with('/foo', {:path => "/bar", :filter => "*.jpg"})
54
+ expect(@app).to receive(:mount).with('/foo', {:path => "/bar", :filter => "*.jpg"})
55
55
  @server.mount "/foo" => "/bar", :filter => "*.jpg"
56
56
  end
57
57
  end
58
58
 
59
59
  describe "menu" do
60
60
  it "should pass a menu key and block to the app" do
61
- @app.should_receive(:menu).with('/foo')
61
+ expect(@app).to receive(:menu).with('/foo')
62
62
  @server.menu '/foo' do
63
63
  "hi"
64
64
  end
@@ -67,7 +67,7 @@ describe Gopher::DSL do
67
67
 
68
68
  describe "text" do
69
69
  it "should pass a text_template key and block to the app" do
70
- @app.should_receive(:text).with('/foo')
70
+ expect(@app).to receive(:text).with('/foo')
71
71
  @server.text '/foo' do
72
72
  "hi"
73
73
  end
@@ -76,7 +76,7 @@ describe Gopher::DSL do
76
76
 
77
77
  describe "helpers" do
78
78
  it "should pass a block to the app" do
79
- @app.should_receive(:helpers)
79
+ expect(@app).to receive(:helpers)
80
80
  @server.helpers do
81
81
  "hi"
82
82
  end
@@ -85,30 +85,30 @@ describe Gopher::DSL do
85
85
 
86
86
  describe "watch" do
87
87
  it "should pass a script app for watching" do
88
- @app.scripts.should_receive(:<<).with("foo")
88
+ expect(@app.scripts).to receive(:<<).with("foo")
89
89
  @server.watch("foo")
90
90
  end
91
91
  end
92
92
 
93
93
  describe "run" do
94
94
  it "should set any incoming opts" do
95
- @server.should_receive(:set).with(:x, 1)
96
- @server.should_receive(:set).with(:y, 2)
97
- @server.stub!(:load)
95
+ expect(@server).to receive(:set).with(:x, 1)
96
+ expect(@server).to receive(:set).with(:y, 2)
97
+ allow(@server).to receive(:load)
98
98
 
99
99
  @server.run("foo", {:x => 1, :y => 2})
100
100
  end
101
101
 
102
102
  it "should turn on script watching if in debug mode" do
103
103
  @app.config[:debug] = true
104
- @server.should_receive(:watch).with("foo.rb")
105
- @server.should_receive(:load).with("foo.rb")
104
+ expect(@server).to receive(:watch).with("foo.rb")
105
+ expect(@server).to receive(:load).with("foo.rb")
106
106
 
107
107
  @server.run("foo.rb")
108
108
  end
109
109
 
110
110
  it "should load the script" do
111
- @server.should_receive(:load).with("foo.rb")
111
+ expect(@server).to receive(:load).with("foo.rb")
112
112
  @server.run("foo.rb")
113
113
  end
114
114
  end
@@ -2,7 +2,7 @@ require File.join(File.dirname(__FILE__), '..', '/spec_helper')
2
2
 
3
3
  describe Gopher::Handlers::DirectoryHandler do
4
4
  before(:each) do
5
- app = mock(Gopher::Application,
5
+ app = double(Gopher::Application,
6
6
  :host => "host",
7
7
  :port => 1234,
8
8
  :config => {})
@@ -13,18 +13,18 @@ describe Gopher::Handlers::DirectoryHandler do
13
13
 
14
14
  describe "filtering" do
15
15
  before(:each) do
16
- File.should_receive(:directory?).with("/tmp/bar/baz").and_return(true)
17
- File.should_receive(:directory?).with("/tmp/bar/baz/a.txt").and_return(false)
18
- File.should_receive(:directory?).with("/tmp/bar/baz/b.exe").and_return(false)
19
- File.should_receive(:directory?).with("/tmp/bar/baz/dir2").and_return(true)
16
+ expect(File).to receive(:directory?).with("/tmp/bar/baz").and_return(true)
17
+ expect(File).to receive(:directory?).with("/tmp/bar/baz/a.txt").and_return(false)
18
+ expect(File).to receive(:directory?).with("/tmp/bar/baz/b.exe").and_return(false)
19
+ expect(File).to receive(:directory?).with("/tmp/bar/baz/dir2").and_return(true)
20
20
 
21
- File.should_receive(:file?).with("/tmp/bar/baz/a.txt").and_return(true)
22
- File.should_receive(:file?).with("/tmp/bar/baz/b.exe").and_return(true)
21
+ expect(File).to receive(:file?).with("/tmp/bar/baz/a.txt").and_return(true)
22
+ expect(File).to receive(:file?).with("/tmp/bar/baz/b.exe").and_return(true)
23
23
 
24
- File.should_receive(:fnmatch).with("*.txt", "/tmp/bar/baz/a.txt").and_return(true)
25
- File.should_receive(:fnmatch).with("*.txt", "/tmp/bar/baz/b.exe").and_return(false)
24
+ expect(File).to receive(:fnmatch).with("*.txt", "/tmp/bar/baz/a.txt").and_return(true)
25
+ expect(File).to receive(:fnmatch).with("*.txt", "/tmp/bar/baz/b.exe").and_return(false)
26
26
 
27
- Dir.should_receive(:glob).with("/tmp/bar/baz/*.*").and_return([
27
+ expect(Dir).to receive(:glob).with("/tmp/bar/baz/*").and_return([
28
28
  "/tmp/bar/baz/a.txt",
29
29
  "/tmp/bar/baz/b.exe",
30
30
  "/tmp/bar/baz/dir2"])
@@ -39,78 +39,78 @@ describe Gopher::Handlers::DirectoryHandler do
39
39
 
40
40
  describe "request_path" do
41
41
  it "should join existing path with incoming path" do
42
- @h.request_path(:splat => "bar/baz").should == "/tmp/bar/baz"
42
+ expect(@h.request_path(:splat => "bar/baz")).to eq("/tmp/bar/baz")
43
43
  end
44
44
  end
45
45
 
46
46
  describe "to_selector" do
47
47
  it "should work" do
48
- @h.to_selector("/tmp/foo/bar.html").should == "/xyz/123/foo/bar.html"
49
- @h.to_selector("/tmp/foo/baz").should == "/xyz/123/foo/baz"
50
- @h.to_selector("/tmp").should == "/xyz/123"
48
+ expect(@h.to_selector("/tmp/foo/bar.html")).to eq("/xyz/123/foo/bar.html")
49
+ expect(@h.to_selector("/tmp/foo/baz")).to eq("/xyz/123/foo/baz")
50
+ expect(@h.to_selector("/tmp")).to eq("/xyz/123")
51
51
  end
52
52
  end
53
53
 
54
54
  describe "contained?" do
55
55
  it "should be false if not under base path" do
56
- @h.contained?("/home/gopher").should == false
56
+ expect(@h.contained?("/home/gopher")).to eq(false)
57
57
  end
58
58
  it "should be true if under base path" do
59
- @h.contained?("/tmp/gopher").should == true
59
+ expect(@h.contained?("/tmp/gopher")).to eq(true)
60
60
  end
61
61
  end
62
62
 
63
63
  describe "safety checks" do
64
64
  it "should raise exception for invalid directory" do
65
- lambda {
66
- @h.call(:splat => "../../../home/foo/bar/baz").to_s.should == "0a\t/tmp/bar/baz/a\thost\t1234"
67
- }.should raise_error(Gopher::InvalidRequest)
65
+ expect {
66
+ expect(@h.call(:splat => "../../../home/foo/bar/baz").to_s).to eq("0a\t/tmp/bar/baz/a\thost\t1234")
67
+ }.to raise_error(Gopher::InvalidRequest)
68
68
  end
69
69
  end
70
70
 
71
71
  describe "directories" do
72
72
  before(:each) do
73
- File.should_receive(:directory?).with("/tmp/bar/baz").and_return(true)
74
- File.should_receive(:directory?).with("/tmp/bar/baz/a").and_return(false)
75
- File.should_receive(:directory?).with("/tmp/bar/baz/dir2").and_return(true)
73
+ expect(File).to receive(:directory?).with("/tmp/bar/baz").and_return(true)
74
+ expect(File).to receive(:directory?).with("/tmp/bar/baz/a").and_return(false)
75
+ expect(File).to receive(:directory?).with("/tmp/bar/baz/dir2").and_return(true)
76
76
 
77
- File.should_receive(:file?).with("/tmp/bar/baz/a").and_return(true)
78
- File.should_receive(:fnmatch).with("*.*", "/tmp/bar/baz/a").and_return(true)
77
+ expect(File).to receive(:file?).with("/tmp/bar/baz/a").and_return(true)
78
+ expect(File).to receive(:fnmatch).with("*.*", "/tmp/bar/baz/a").and_return(true)
79
79
 
80
- Dir.should_receive(:glob).with("/tmp/bar/baz/*.*").and_return([
80
+ expect(Dir).to receive(:glob).with("/tmp/bar/baz/*").and_return([
81
81
  "/tmp/bar/baz/a",
82
82
  "/tmp/bar/baz/dir2"])
83
83
  end
84
84
 
85
85
  it "should work" do
86
- @h.call(:splat => "bar/baz").to_s.should == "iBrowsing: /tmp/bar/baz\tnull\t(FALSE)\t0\r\n0a\t/xyz/123/bar/baz/a\thost\t1234\r\n1dir2\t/xyz/123/bar/baz/dir2\thost\t1234\r\n"
86
+ expect(@h.call(:splat => "bar/baz").to_s).to eq("iBrowsing: /tmp/bar/baz\tnull\t(FALSE)\t0\r\n9a\t/xyz/123/bar/baz/a\thost\t1234\r\n1dir2\t/xyz/123/bar/baz/dir2\thost\t1234\r\n")
87
87
  end
88
88
  end
89
89
 
90
90
  describe "files" do
91
91
  before(:each) do
92
- @file = mock(File)
93
- File.should_receive(:directory?).with("/tmp/baz.txt").and_return(false)
92
+ @file = double(File)
93
+ expect(File).to receive(:directory?).with("/tmp/baz.txt").and_return(false)
94
94
 
95
- File.should_receive(:file?).with("/tmp/baz.txt").and_return(true)
96
- File.should_receive(:new).with("/tmp/baz.txt").and_return(@file)
95
+ expect(File).to receive(:file?).with("/tmp/baz.txt").and_return(true)
96
+ expect(File).to receive(:new).with("/tmp/baz.txt").and_return(@file)
97
97
  end
98
98
 
99
99
  it "should work" do
100
- @h.call(:splat => "baz.txt").should == @file
100
+ expect(@h.call(:splat => "baz.txt")).to eq(@file)
101
101
  end
102
102
  end
103
103
 
104
104
  describe "missing stuff" do
105
105
  before(:each) do
106
- File.should_receive(:directory?).with("/tmp/baz.txt").and_return(false)
107
- File.should_receive(:file?).with("/tmp/baz.txt").and_return(false)
106
+ expect(File).to receive(:directory?).with("/tmp/baz.txt").and_return(false)
107
+ expect(File).to receive(:file?).with("/tmp/baz.txt").and_return(false)
108
108
  end
109
109
 
110
110
  it "should return not found" do
111
- lambda {
111
+ expect {
112
112
  @h.call(:splat => "baz.txt")
113
- }.should raise_error(Gopher::NotFoundError)
113
+ }.to raise_error(Gopher::NotFoundError)
114
114
  end
115
115
  end
116
116
  end
data/spec/helpers_spec.rb CHANGED
@@ -11,6 +11,6 @@ describe Gopher::Application do
11
11
  def foo; "FOO"; end
12
12
  end
13
13
 
14
- @obj.foo.should == "FOO"
14
+ expect(@obj.foo).to eq("FOO")
15
15
  end
16
16
  end
@@ -8,32 +8,32 @@ describe Gopher::Rendering::Base do
8
8
  it 'should add text' do
9
9
  @ctx.text("line 1")
10
10
  @ctx.text("line 2")
11
- @ctx.result.should == "line 1\r\nline 2\r\n"
11
+ expect(@ctx.result).to eq("line 1\r\nline 2\r\n")
12
12
  end
13
13
 
14
14
  it "should add breaks correctly" do
15
15
  @ctx.spacing 2
16
16
  @ctx.text("line 1")
17
17
  @ctx.text("line 2")
18
- @ctx.result.should == "line 1\r\n\r\nline 2\r\n\r\n"
18
+ expect(@ctx.result).to eq("line 1\r\n\r\nline 2\r\n\r\n")
19
19
  end
20
20
 
21
21
  it "br outputs a bunch of newlines" do
22
- @ctx.br(2).should == "\r\n\r\n"
22
+ expect(@ctx.br(2)).to eq("\r\n\r\n")
23
23
  end
24
24
 
25
25
  describe "underline" do
26
26
  it "underline outputs a pretty line" do
27
- @ctx.underline(1, 'x').should == "x\r\n"
27
+ expect(@ctx.underline(1, 'x')).to eq("x\r\n")
28
28
  end
29
29
  it "has defaults" do
30
- @ctx.underline.should == "=" * 70 + "\r\n"
30
+ expect(@ctx.underline).to eq("=" * 70 + "\r\n")
31
31
  end
32
32
  end
33
33
 
34
34
  describe "figlet" do
35
35
  it "outputs a figlet" do
36
- @ctx.figlet('pie').should == " _ \r\n (_) \r\n _ __ _ ___ \r\n | '_ \\| |/ _ \\\r\n | |_) | | __/\r\n | .__/|_|\\___|\r\n | | \r\n |_| \r\n"
36
+ expect(@ctx.figlet('pie')).to eq(" _ \r\n (_) \r\n _ __ _ ___ \r\n | '_ \\| |/ _ \\\r\n | |_) | | __/\r\n | .__/|_|\\___|\r\n | | \r\n |_| \r\n")
37
37
  end
38
38
  end
39
39
 
@@ -41,25 +41,25 @@ describe Gopher::Rendering::Base do
41
41
  describe "big_header" do
42
42
  it "outputs a box with text" do
43
43
  @ctx.width(5)
44
- @ctx.big_header('pie').should == "\r\n=====\r\n=pie=\r\n=====\r\n\r\n"
44
+ expect(@ctx.big_header('pie')).to eq("\r\n=====\r\n=pie=\r\n=====\r\n\r\n")
45
45
  end
46
46
  end
47
47
 
48
48
  describe "header" do
49
49
  it "outputs underlined text" do
50
50
  @ctx.width(5)
51
- @ctx.header('pie').should == " pie \r\n=====\r\n"
51
+ expect(@ctx.header('pie')).to eq(" pie \r\n=====\r\n")
52
52
  end
53
53
  end
54
54
 
55
55
  it "uses to_s to output result" do
56
56
  @ctx.text("line 1")
57
- @ctx.to_s.should == @ctx.result
57
+ expect(@ctx.to_s).to eq(@ctx.result)
58
58
  end
59
59
 
60
60
  describe "block" do
61
61
  it "wraps text" do
62
- @ctx.should_receive(:text).twice.with "a"
62
+ expect(@ctx).to receive(:text).twice.with "a"
63
63
  @ctx.block("a a",1)
64
64
  end
65
65
  end
@@ -12,80 +12,86 @@ describe Gopher::Rendering::Menu do
12
12
 
13
13
  it 'should add text as a gopher line' do
14
14
  @ctx.text("gopher forever")
15
- @ctx.result.should == "igopher forever\tnull\t(FALSE)\t0\r\n"
15
+ expect(@ctx.result).to eq("igopher forever\tnull\t(FALSE)\t0\r\n")
16
16
  end
17
17
 
18
18
  describe "sanitize_text" do
19
19
  it "should remove extra whitespace from end of line" do
20
- @ctx.sanitize_text("x ").should == "x"
20
+ expect(@ctx.sanitize_text("x ")).to eq("x")
21
21
  end
22
22
 
23
23
  it "should convert tabs to spaces" do
24
- @ctx.sanitize_text("x\tx").should == "x x"
24
+ expect(@ctx.sanitize_text("x\tx")).to eq("x x")
25
25
  end
26
26
 
27
27
  it "should remove newlines" do
28
- @ctx.sanitize_text("x\nx").should == "xx"
28
+ expect(@ctx.sanitize_text("x\nx")).to eq("xx")
29
29
  end
30
30
  end
31
31
 
32
32
  describe "line" do
33
33
  it "should work" do
34
- @ctx.line("type", "text", "selector", "host", "port").should == "typetext\tselector\thost\tport\r\n"
34
+ expect(@ctx.line("type", "text", "selector", "host", "port")).to eq("typetext\tselector\thost\tport\r\n")
35
35
  end
36
36
 
37
37
  it "should use application host/port as defaults" do
38
- @ctx.line("type", "text", "selector").should == "typetext\tselector\thost\t1234\r\n"
38
+ expect(@ctx.line("type", "text", "selector")).to eq("typetext\tselector\thost\t1234\r\n")
39
39
  end
40
40
  end
41
41
 
42
42
  describe "error" do
43
43
  it "should call text with right selector" do
44
- @ctx.should_receive(:text).with("foo", '3')
44
+ expect(@ctx).to receive(:text).with("foo", '3')
45
45
  @ctx.error("foo")
46
46
  end
47
47
  end
48
48
 
49
49
  describe "directory" do
50
50
  it "should call link with right selector" do
51
- @ctx.should_receive(:line).with("1", "foo", "/bar/foo", nil, nil)
51
+ expect(@ctx).to receive(:line).with("1", "foo", "/bar/foo", nil, nil)
52
52
  @ctx.directory("foo", "/bar/foo")
53
53
  end
54
54
  end
55
55
 
56
56
  describe "link" do
57
57
  it "should get type with determine_type" do
58
- @ctx.should_receive(:determine_type).with("foo.txt").and_return("A")
59
- @ctx.link("FILE", "foo.txt").should == "AFILE\tfoo.txt\thost\t1234\r\n"
58
+ expect(@ctx).to receive(:determine_type).with("foo.txt").and_return("A")
59
+ expect(@ctx.link("FILE", "foo.txt")).to eq("AFILE\tfoo.txt\thost\t1234\r\n")
60
+ end
61
+ end
62
+
63
+ describe "http" do
64
+ it "should work" do
65
+ expect(@ctx.http("weblink", "http://google.com")).to eq("hweblink\tURL:http://google.com\thost\t1234\r\n")
60
66
  end
61
67
  end
62
68
 
63
69
  describe "search" do
64
70
  it "should output link type/text" do
65
- @ctx.search("FIND", "search").should == "7FIND\tsearch\thost\t1234\r\n"
71
+ expect(@ctx.search("FIND", "search")).to eq("7FIND\tsearch\thost\t1234\r\n")
66
72
  end
67
73
  end
68
74
 
69
75
  describe "menu" do
70
76
  it "should output link type/text" do
71
- @ctx.menu("MENU ITEM", "item").should == "1MENU ITEM\titem\thost\t1234\r\n"
77
+ expect(@ctx.menu("MENU ITEM", "item")).to eq("1MENU ITEM\titem\thost\t1234\r\n")
72
78
  end
73
79
  end
74
80
 
75
81
  describe "br" do
76
82
  it "should generate an empty text line" do
77
- @ctx.should_receive(:text).with("i", "")
83
+ expect(@ctx).to receive(:text).with("i", "")
78
84
  @ctx.br
79
85
  end
80
86
 
81
87
  it "should call #text multiple times" do
82
- @ctx.should_receive(:text).twice.with("i", "")
88
+ expect(@ctx).to receive(:text).twice.with("i", "")
83
89
  @ctx.br(2)
84
90
  end
85
91
 
86
92
  it "should output an empty menu item" do
87
93
  @ctx.br
88
- @ctx.result.should == "i\tnull\t(FALSE)\t0\r\n"
94
+ expect(@ctx.result).to eq("i\tnull\t(FALSE)\t0\r\n")
89
95
  end
90
96
  end
91
97
 
@@ -99,10 +105,10 @@ describe Gopher::Rendering::Menu do
99
105
  "foo.png" => 'I',
100
106
  "foo.mp3" => 's',
101
107
  "foo.wav" => 's',
102
- "foo.random-file" => "0"
108
+ "foo.random-file" => "9"
103
109
  }.each do |file, expected|
104
110
  it "should have right selector for #{file}" do
105
- @ctx.determine_type(file).should == expected
111
+ expect(@ctx.determine_type(file)).to eq(expected)
106
112
  end
107
113
  end
108
114
  end