gopher2000 0.4.0 → 0.5.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -18,11 +18,11 @@ describe Gopher::Application do
18
18
  describe "find_template" do
19
19
  it "should check in menus" do
20
20
  @s.menus['foo'] = "bar"
21
- @s.find_template('foo').should == ["bar", Gopher::Rendering::Menu]
21
+ expect(@s.find_template('foo')).to eq(["bar", Gopher::Rendering::Menu])
22
22
  end
23
23
  it "should check in text_templates" do
24
24
  @s.text_templates['foo'] = "bar"
25
- @s.find_template('foo').should == ["bar", Gopher::Rendering::Text]
25
+ expect(@s.find_template('foo')).to eq(["bar", Gopher::Rendering::Text])
26
26
  end
27
27
  end
28
28
 
@@ -37,7 +37,7 @@ describe Gopher::Application do
37
37
  @params
38
38
  end
39
39
 
40
- @s.render(:foo).should == "xyz"
40
+ expect(@s.render(:foo)).to eq("xyz")
41
41
  end
42
42
 
43
43
  it "has access to request obj" do
@@ -46,7 +46,7 @@ describe Gopher::Application do
46
46
  @request
47
47
  end
48
48
 
49
- @s.render(:foo).should == "abc"
49
+ expect(@s.render(:foo)).to eq("abc")
50
50
  end
51
51
 
52
52
  it "rendering text access to request obj" do
@@ -55,7 +55,7 @@ describe Gopher::Application do
55
55
  @request
56
56
  end
57
57
 
58
- @s.render(:foo).should == "abc"
58
+ expect(@s.render(:foo)).to eq("abc")
59
59
  end
60
60
  end
61
61
 
@@ -66,11 +66,11 @@ describe Gopher::Application do
66
66
 
67
67
  it "should use custom template if provided" do
68
68
  @s.not_found do ; end
69
- @s.not_found_template.should == :not_found
69
+ expect(@s.not_found_template).to eq(:not_found)
70
70
  end
71
71
 
72
72
  it "should use default otherwise" do
73
- @s.not_found_template.should == :'internal/not_found'
73
+ expect(@s.not_found_template).to eq(:'internal/not_found')
74
74
  end
75
75
  end
76
76
 
data/spec/request_spec.rb CHANGED
@@ -3,33 +3,33 @@ require File.join(File.dirname(__FILE__), '/spec_helper')
3
3
  describe Gopher::Request do
4
4
  it 'should split raw request' do
5
5
  request = Gopher::Request.new("foo\tbar")
6
- request.selector.should == "/foo"
7
- request.input.should == "bar"
6
+ expect(request.selector).to eq("/foo")
7
+ expect(request.input).to eq("bar")
8
8
  end
9
9
 
10
10
  it "normalizes by adding a slash to the front" do
11
11
  request = Gopher::Request.new("foo")
12
- request.selector.should == "/foo"
12
+ expect(request.selector).to eq("/foo")
13
13
  end
14
14
 
15
15
  it "should be ok with just selector" do
16
16
  request = Gopher::Request.new("/foo")
17
- request.selector.should == "/foo"
18
- request.input.should == nil
17
+ expect(request.selector).to eq("/foo")
18
+ expect(request.input).to eq(nil)
19
19
  end
20
20
 
21
21
  it "should accept ip_address" do
22
22
  request = Gopher::Request.new("foo", "bar")
23
- request.ip_address.should == "bar"
23
+ expect(request.ip_address).to eq("bar")
24
24
  end
25
25
 
26
26
  it "valid? == true for valid selectors" do
27
27
  request = Gopher::Request.new("x" * 254, "bar")
28
- request.valid?.should == true
28
+ expect(request.valid?).to eq(true)
29
29
  end
30
30
 
31
31
  it "valid? == false for invalid selectors" do
32
32
  request = Gopher::Request.new("x" * 255, "bar")
33
- request.valid?.should == false
33
+ expect(request.valid?).to eq(false)
34
34
  end
35
35
  end
@@ -8,17 +8,17 @@ describe Gopher::Response do
8
8
 
9
9
  it "gets size for string results" do
10
10
  @response.body = "hi"
11
- @response.size.should == 2
11
+ expect(@response.size).to eq(2)
12
12
  end
13
13
 
14
14
  it "gets size for stringio results" do
15
15
  @response.body = StringIO.new("12345")
16
- @response.size.should == 5
16
+ expect(@response.size).to eq(5)
17
17
  end
18
18
 
19
19
  it "defaults to 0 size for weird objects" do
20
- @response.body = mock(Object)
21
- @response.size.should == 0
20
+ @response.body = double(Object)
21
+ expect(@response.size).to eq(0)
22
22
  end
23
23
 
24
24
 
@@ -28,6 +28,6 @@ describe Gopher::Response do
28
28
  temp_file.flush
29
29
 
30
30
  @response.body = File.new(temp_file.path)
31
- @response.size.should == 10
31
+ expect(@response.size).to eq(10)
32
32
  end
33
33
  end
data/spec/routing_spec.rb CHANGED
@@ -16,30 +16,30 @@ describe Gopher::Application do
16
16
  "hi"
17
17
  end
18
18
  junk, block = @router.lookup("sfssfdfsfsd")
19
- block.class.should eql(UnboundMethod)
19
+ expect(block.class).to eql(UnboundMethod)
20
20
  end
21
21
  end
22
22
 
23
23
  describe "globify" do
24
24
  it "should add glob if none yet" do
25
- @router.globify("/foo").should == "/foo/?*"
25
+ expect(@router.globify("/foo")).to eq("/foo/?*")
26
26
  end
27
27
 
28
28
  it "should be ok with trailing slashes" do
29
- @router.globify("/foo/").should == "/foo/?*"
29
+ expect(@router.globify("/foo/")).to eq("/foo/?*")
30
30
  end
31
31
 
32
32
  it "shouldn't add glob if there is one already" do
33
- @router.globify("/foo/*").should == "/foo/*"
33
+ expect(@router.globify("/foo/*")).to eq("/foo/*")
34
34
  end
35
35
  end
36
36
 
37
37
  describe "mount" do
38
38
  before(:each) do
39
- @h = mock(Gopher::Handlers::DirectoryHandler)
40
- @h.should_receive(:application=).with(@router)
39
+ @h = double(Gopher::Handlers::DirectoryHandler)
40
+ expect(@h).to receive(:application=).with(@router)
41
41
 
42
- Gopher::Handlers::DirectoryHandler.should_receive(:new).with({:bar => :baz, :mount_point => "/foo"}).and_return(@h)
42
+ expect(Gopher::Handlers::DirectoryHandler).to receive(:new).with({:bar => :baz, :mount_point => "/foo"}).and_return(@h)
43
43
  end
44
44
 
45
45
  it "should work" do
@@ -50,42 +50,42 @@ describe Gopher::Application do
50
50
  describe "compile" do
51
51
  it "should generate a basic string for routes without keys" do
52
52
  lookup, keys, block = @router.compile! "/foo" do; end
53
- lookup.to_s.should == /^\/foo$/.to_s
54
- keys.should == []
53
+ expect(lookup.to_s).to eq(/^\/foo$/.to_s)
54
+ expect(keys).to eq([])
55
55
  end
56
56
 
57
57
  context "with keys" do
58
58
  it "should generate a lookup and keys for routes with keys" do
59
59
  lookup, keys, block = @router.compile! "/foo/:bar" do; end
60
- lookup.to_s.should == "(?-mix:^\\/foo\\/([^\\/?#]+)$)"
60
+ expect(lookup.to_s).to eq("(?-mix:^\\/foo\\/([^\\/?#]+)$)")
61
61
 
62
- keys.should == ["bar"]
62
+ expect(keys).to eq(["bar"])
63
63
  end
64
64
 
65
65
  it "should match correctly" do
66
66
  lookup, keys, block = @router.compile! "/foo/:bar" do; end
67
- lookup.to_s.should == "(?-mix:^\\/foo\\/([^\\/?#]+)$)"
67
+ expect(lookup.to_s).to eq("(?-mix:^\\/foo\\/([^\\/?#]+)$)")
68
68
 
69
- lookup.match("/foo/baz").should_not be_nil
70
- lookup.match("/foo2/baz").should be_nil
71
- lookup.match("/baz/foo/baz").should be_nil
72
- lookup.match("/foo/baz/bar").should be_nil
69
+ expect(lookup.match("/foo/baz")).not_to be_nil
70
+ expect(lookup.match("/foo2/baz")).to be_nil
71
+ expect(lookup.match("/baz/foo/baz")).to be_nil
72
+ expect(lookup.match("/foo/baz/bar")).to be_nil
73
73
  end
74
74
  end
75
75
 
76
76
  context "with splat" do
77
77
  it "should work with splats" do
78
78
  lookup, keys, block = @router.compile! "/foo/*" do; end
79
- lookup.to_s.should == "(?-mix:^\\/foo\\/(.*?)$)"
80
- keys.should == ["splat"]
79
+ expect(lookup.to_s).to eq("(?-mix:^\\/foo\\/(.*?)$)")
80
+ expect(keys).to eq(["splat"])
81
81
  end
82
82
 
83
83
  it "should match correctly" do
84
84
  lookup, keys, block = @router.compile! "/foo/*" do; end
85
85
 
86
- lookup.match("/foo/baz/bar/bam").should_not be_nil
87
- lookup.match("/foo2/baz").should be_nil
88
- lookup.match("/baz/foo/baz").should be_nil
86
+ expect(lookup.match("/foo/baz/bar/bam")).not_to be_nil
87
+ expect(lookup.match("/foo2/baz")).to be_nil
88
+ expect(lookup.match("/baz/foo/baz")).to be_nil
89
89
  end
90
90
  end
91
91
  end
data/spec/server_spec.rb CHANGED
@@ -31,7 +31,7 @@ if ENV["WITH_SERVER_SPECS"].to_i == 1
31
31
 
32
32
  it "should work in non-blocking mode" do
33
33
  @application.fake_response = @response
34
- @application.stub!(:non_blocking?).and_return(false)
34
+ allow(@application).to receive(:non_blocking?).and_return(false)
35
35
 
36
36
  ::EM.run {
37
37
  server = Gopher::Server.new(@application)
@@ -42,7 +42,7 @@ if ENV["WITH_SERVER_SPECS"].to_i == 1
42
42
  socket.send_data("123\n")
43
43
 
44
44
  socket.onopen = lambda {
45
- socket.data.last.chomp.should == "hi\r\n."
45
+ expect(socket.data.last.chomp).to eq("hi\r\n.")
46
46
  EM.stop
47
47
  }
48
48
  }
@@ -60,7 +60,7 @@ if ENV["WITH_SERVER_SPECS"].to_i == 1
60
60
  socket.send_data("123\n")
61
61
 
62
62
  socket.onopen = lambda {
63
- socket.data.last.chomp.should == "hi\r\n."
63
+ expect(socket.data.last.chomp).to eq("hi\r\n.")
64
64
  EM.stop
65
65
  }
66
66
  }
@@ -78,7 +78,7 @@ if ENV["WITH_SERVER_SPECS"].to_i == 1
78
78
  socket.send_data("123\n")
79
79
 
80
80
  socket.onopen = lambda {
81
- socket.data.last.chomp.should == "hi\r\n."
81
+ expect(socket.data.last.chomp).to eq("hi\r\n.")
82
82
  EM.stop
83
83
  }
84
84
  }
@@ -100,7 +100,7 @@ if ENV["WITH_SERVER_SPECS"].to_i == 1
100
100
  socket.send_data("123\n")
101
101
 
102
102
  socket.onopen = lambda {
103
- socket.data.last.chomp.should == "hi"
103
+ expect(socket.data.last.chomp).to eq("hi")
104
104
  EM.stop
105
105
  }
106
106
  }
@@ -118,7 +118,7 @@ if ENV["WITH_SERVER_SPECS"].to_i == 1
118
118
  socket.send_data("123\n")
119
119
 
120
120
  socket.onopen = lambda {
121
- socket.data.last.chomp.should == "hi\r\n."
121
+ expect(socket.data.last.chomp).to eq("hi\r\n.")
122
122
  EM.stop
123
123
  }
124
124
  }
metadata CHANGED
@@ -1,137 +1,169 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gopher2000
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
5
- prerelease:
4
+ version: 0.5.3
6
5
  platform: ruby
7
6
  authors:
8
7
  - Colin Mitchell
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-05-08 00:00:00.000000000Z
11
+ date: 2020-01-05 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rspec
16
- requirement: &13099820 !ruby/object:Gem::Requirement
17
- none: false
15
+ requirement: !ruby/object:Gem::Requirement
18
16
  requirements:
19
- - - ! '>='
17
+ - - ">="
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :development
23
21
  prerelease: false
24
- version_requirements: *13099820
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
25
27
  - !ruby/object:Gem::Dependency
26
28
  name: redcarpet
27
- requirement: &13098680 !ruby/object:Gem::Requirement
28
- none: false
29
+ requirement: !ruby/object:Gem::Requirement
29
30
  requirements:
30
- - - ! '>='
31
+ - - ">="
31
32
  - !ruby/object:Gem::Version
32
33
  version: '0'
33
34
  type: :development
34
35
  prerelease: false
35
- version_requirements: *13098680
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
36
41
  - !ruby/object:Gem::Dependency
37
42
  name: yard
38
- requirement: &13096940 !ruby/object:Gem::Requirement
39
- none: false
43
+ requirement: !ruby/object:Gem::Requirement
40
44
  requirements:
41
- - - ! '>='
45
+ - - ">="
42
46
  - !ruby/object:Gem::Version
43
47
  version: '0'
44
48
  type: :development
45
49
  prerelease: false
46
- version_requirements: *13096940
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
47
55
  - !ruby/object:Gem::Dependency
48
56
  name: shoulda
49
- requirement: &13066600 !ruby/object:Gem::Requirement
50
- none: false
57
+ requirement: !ruby/object:Gem::Requirement
51
58
  requirements:
52
- - - ! '>='
59
+ - - ">="
53
60
  - !ruby/object:Gem::Version
54
61
  version: '0'
55
62
  type: :development
56
63
  prerelease: false
57
- version_requirements: *13066600
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
58
69
  - !ruby/object:Gem::Dependency
59
70
  name: rdoc
60
- requirement: &13062740 !ruby/object:Gem::Requirement
61
- none: false
71
+ requirement: !ruby/object:Gem::Requirement
62
72
  requirements:
63
- - - ! '>='
73
+ - - ">="
64
74
  - !ruby/object:Gem::Version
65
75
  version: '0'
66
76
  type: :development
67
77
  prerelease: false
68
- version_requirements: *13062740
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: simplecov
71
- requirement: &13003680 !ruby/object:Gem::Requirement
72
- none: false
85
+ requirement: !ruby/object:Gem::Requirement
73
86
  requirements:
74
- - - ! '>='
87
+ - - "~>"
75
88
  - !ruby/object:Gem::Version
76
- version: '0'
89
+ version: 0.16.1
77
90
  type: :development
78
91
  prerelease: false
79
- version_requirements: *13003680
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 0.16.1
80
97
  - !ruby/object:Gem::Dependency
81
98
  name: watchr
82
- requirement: &13002280 !ruby/object:Gem::Requirement
83
- none: false
99
+ requirement: !ruby/object:Gem::Requirement
84
100
  requirements:
85
- - - ! '>='
101
+ - - ">="
86
102
  - !ruby/object:Gem::Version
87
103
  version: '0'
88
104
  type: :development
89
105
  prerelease: false
90
- version_requirements: *13002280
91
- - !ruby/object:Gem::Dependency
92
- name: eventmachine
93
- requirement: &13001380 !ruby/object:Gem::Requirement
94
- none: false
106
+ version_requirements: !ruby/object:Gem::Requirement
95
107
  requirements:
96
- - - ! '>='
108
+ - - ">="
97
109
  - !ruby/object:Gem::Version
98
110
  version: '0'
99
- type: :development
100
- prerelease: false
101
- version_requirements: *13001380
102
111
  - !ruby/object:Gem::Dependency
103
112
  name: artii
104
- requirement: &13000160 !ruby/object:Gem::Requirement
105
- none: false
113
+ requirement: !ruby/object:Gem::Requirement
106
114
  requirements:
107
- - - ! '>='
115
+ - - ">="
108
116
  - !ruby/object:Gem::Version
109
117
  version: 2.0.1
110
118
  type: :runtime
111
119
  prerelease: false
112
- version_requirements: *13000160
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: 2.0.1
113
125
  - !ruby/object:Gem::Dependency
114
126
  name: eventmachine
115
- requirement: &12998560 !ruby/object:Gem::Requirement
116
- none: false
127
+ requirement: !ruby/object:Gem::Requirement
117
128
  requirements:
118
- - - ! '>='
129
+ - - "~>"
119
130
  - !ruby/object:Gem::Version
120
- version: '0'
131
+ version: 1.2.5
121
132
  type: :runtime
122
133
  prerelease: false
123
- version_requirements: *12998560
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: 1.2.5
124
139
  - !ruby/object:Gem::Dependency
125
140
  name: logging
126
- requirement: &12997620 !ruby/object:Gem::Requirement
127
- none: false
141
+ requirement: !ruby/object:Gem::Requirement
128
142
  requirements:
129
- - - ! '>='
143
+ - - ">="
130
144
  - !ruby/object:Gem::Version
131
145
  version: '0'
132
146
  type: :runtime
133
147
  prerelease: false
134
- version_requirements: *12997620
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: mimemagic
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ type: :runtime
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
135
167
  description: Gopher2000 is a ruby-based Gopher server. It is built for speedy, enjoyable
136
168
  development of all sorts of gopher sites.
137
169
  email:
@@ -141,8 +173,9 @@ executables:
141
173
  extensions: []
142
174
  extra_rdoc_files: []
143
175
  files:
144
- - .gitignore
145
- - .rvmrc
176
+ - ".gitignore"
177
+ - ".ruby-version"
178
+ - ".travis.yml"
146
179
  - Gemfile
147
180
  - LICENSE.txt
148
181
  - README.markdown
@@ -191,33 +224,40 @@ files:
191
224
  homepage: https://github.com/muffinista/gopher2000
192
225
  licenses:
193
226
  - WTFPL
227
+ metadata: {}
194
228
  post_install_message:
195
229
  rdoc_options: []
196
230
  require_paths:
197
231
  - lib
198
232
  required_ruby_version: !ruby/object:Gem::Requirement
199
- none: false
200
233
  requirements:
201
- - - ! '>='
234
+ - - ">="
202
235
  - !ruby/object:Gem::Version
203
236
  version: '0'
204
- segments:
205
- - 0
206
- hash: -984672476065544858
207
237
  required_rubygems_version: !ruby/object:Gem::Requirement
208
- none: false
209
238
  requirements:
210
- - - ! '>='
239
+ - - ">="
211
240
  - !ruby/object:Gem::Version
212
241
  version: '0'
213
- segments:
214
- - 0
215
- hash: -984672476065544858
216
242
  requirements: []
217
- rubyforge_project: gopher2000
218
- rubygems_version: 1.8.17
243
+ rubygems_version: 3.0.3
219
244
  signing_key:
220
- specification_version: 3
245
+ specification_version: 4
221
246
  summary: Gopher2000 - A Gopher server for the next millenium
222
- test_files: []
223
- has_rdoc:
247
+ test_files:
248
+ - spec/application_spec.rb
249
+ - spec/dispatching_spec.rb
250
+ - spec/dsl_spec.rb
251
+ - spec/gopher_spec.rb
252
+ - spec/handlers/directory_handler_spec.rb
253
+ - spec/helpers_spec.rb
254
+ - spec/rendering/base_spec.rb
255
+ - spec/rendering/menu_spec.rb
256
+ - spec/rendering_spec.rb
257
+ - spec/request_spec.rb
258
+ - spec/response_spec.rb
259
+ - spec/routing_spec.rb
260
+ - spec/sandbox/old/socks.txt
261
+ - spec/sandbox/socks.txt
262
+ - spec/server_spec.rb
263
+ - spec/spec_helper.rb