gopher2000 0.2.2 → 0.5.5
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.
- checksums.yaml +7 -0
- data/.ruby-version +1 -0
- data/.travis.yml +8 -0
- data/Gemfile +1 -16
- data/README.markdown +3 -1
- data/bin/gopher2000 +1 -1
- data/examples/default_route.rb +0 -0
- data/examples/figlet.rb +28 -0
- data/examples/nyan.rb +0 -0
- data/examples/simple.rb +2 -2
- data/examples/twitter.rb +0 -0
- data/examples/weather.rb +0 -0
- data/gopher2000.gemspec +5 -5
- data/lib/gopher2000.rb +1 -1
- data/lib/gopher2000/base.rb +83 -37
- data/lib/gopher2000/dispatcher.rb +13 -4
- data/lib/gopher2000/dsl.rb +1 -1
- data/lib/gopher2000/handlers/directory_handler.rb +5 -7
- data/lib/gopher2000/rendering/base.rb +42 -1
- data/lib/gopher2000/rendering/menu.rb +104 -15
- data/lib/gopher2000/request.rb +13 -2
- data/lib/gopher2000/server.rb +11 -4
- data/lib/gopher2000/version.rb +1 -1
- data/spec/application_spec.rb +12 -12
- data/spec/dispatching_spec.rb +38 -17
- data/spec/dsl_spec.rb +76 -67
- data/spec/handlers/directory_handler_spec.rb +35 -35
- data/spec/helpers_spec.rb +1 -1
- data/spec/rendering/base_spec.rb +16 -9
- data/spec/rendering/menu_spec.rb +40 -18
- data/spec/rendering_spec.rb +7 -7
- data/spec/request_spec.rb +21 -10
- data/spec/response_spec.rb +5 -5
- data/spec/routing_spec.rb +21 -21
- data/spec/server_spec.rb +23 -7
- metadata +117 -65
- data/.rvmrc +0 -1
data/spec/dsl_spec.rb
CHANGED
@@ -14,103 +14,112 @@ 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)
|
18
|
-
@app.reset!
|
19
17
|
end
|
20
18
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
@server.set :foo, 'bar'
|
25
|
-
@app.config[:foo].should == 'bar'
|
19
|
+
describe "application" do
|
20
|
+
it "should return a Gopher::Application" do
|
21
|
+
expect(@server.application).to be_a(Gopher::Application)
|
26
22
|
end
|
27
23
|
end
|
28
24
|
|
29
|
-
|
30
|
-
|
31
|
-
@
|
32
|
-
@
|
33
|
-
|
25
|
+
context "with application" do
|
26
|
+
before do
|
27
|
+
allow(@server).to receive(:application).and_return(@app)
|
28
|
+
@app.reset!
|
29
|
+
end
|
30
|
+
|
31
|
+
describe "set" do
|
32
|
+
it "should set a config var" do
|
33
|
+
@server.set :foo, 'bar'
|
34
|
+
expect(@app.config[:foo]).to eq('bar')
|
34
35
|
end
|
35
36
|
end
|
36
|
-
end
|
37
37
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
38
|
+
describe "route" do
|
39
|
+
it "should pass a lookup and block to the app" do
|
40
|
+
expect(@app).to receive(:route).with('/foo')
|
41
|
+
@server.route '/foo' do
|
42
|
+
"hi"
|
43
|
+
end
|
43
44
|
end
|
44
45
|
end
|
45
|
-
end
|
46
46
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
47
|
+
describe "default_route" do
|
48
|
+
it "should pass a default block to the app" do
|
49
|
+
expect(@app).to receive(:default_route)
|
50
|
+
@server.default_route do
|
51
|
+
"hi"
|
52
|
+
end
|
53
|
+
end
|
51
54
|
end
|
52
55
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
+
describe "mount" do
|
57
|
+
it "should pass a route, path, and some opts to the app" do
|
58
|
+
expect(@app).to receive(:mount).with('/foo', {:path => "/bar"})
|
59
|
+
@server.mount "/foo" => "/bar"
|
60
|
+
end
|
61
|
+
|
62
|
+
it "should pass a route, path, filter, and some opts to the app" do
|
63
|
+
expect(@app).to receive(:mount).with('/foo', {:path => "/bar", :filter => "*.jpg"})
|
64
|
+
@server.mount "/foo" => "/bar", :filter => "*.jpg"
|
65
|
+
end
|
56
66
|
end
|
57
|
-
end
|
58
67
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
68
|
+
describe "menu" do
|
69
|
+
it "should pass a menu key and block to the app" do
|
70
|
+
expect(@app).to receive(:menu).with('/foo')
|
71
|
+
@server.menu '/foo' do
|
72
|
+
"hi"
|
73
|
+
end
|
64
74
|
end
|
65
75
|
end
|
66
|
-
end
|
67
76
|
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
77
|
+
describe "text" do
|
78
|
+
it "should pass a text_template key and block to the app" do
|
79
|
+
expect(@app).to receive(:text).with('/foo')
|
80
|
+
@server.text '/foo' do
|
81
|
+
"hi"
|
82
|
+
end
|
73
83
|
end
|
74
84
|
end
|
75
|
-
end
|
76
85
|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
86
|
+
describe "helpers" do
|
87
|
+
it "should pass a block to the app" do
|
88
|
+
expect(@app).to receive(:helpers)
|
89
|
+
@server.helpers do
|
90
|
+
"hi"
|
91
|
+
end
|
82
92
|
end
|
83
93
|
end
|
84
|
-
end
|
85
94
|
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
95
|
+
describe "watch" do
|
96
|
+
it "should pass a script app for watching" do
|
97
|
+
expect(@app.scripts).to receive(:<<).with("foo")
|
98
|
+
@server.watch("foo")
|
99
|
+
end
|
90
100
|
end
|
91
|
-
end
|
92
101
|
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
102
|
+
describe "run" do
|
103
|
+
it "should set any incoming opts" do
|
104
|
+
expect(@server).to receive(:set).with(:x, 1)
|
105
|
+
expect(@server).to receive(:set).with(:y, 2)
|
106
|
+
allow(@server).to receive(:load)
|
98
107
|
|
99
|
-
|
100
|
-
|
108
|
+
@server.run("foo", {:x => 1, :y => 2})
|
109
|
+
end
|
101
110
|
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
111
|
+
it "should turn on script watching if in debug mode" do
|
112
|
+
@app.config[:debug] = true
|
113
|
+
expect(@server).to receive(:watch).with("foo.rb")
|
114
|
+
expect(@server).to receive(:load).with("foo.rb")
|
106
115
|
|
107
|
-
|
108
|
-
|
116
|
+
@server.run("foo.rb")
|
117
|
+
end
|
109
118
|
|
110
|
-
|
111
|
-
|
112
|
-
|
119
|
+
it "should load the script" do
|
120
|
+
expect(@server).to receive(:load).with("foo.rb")
|
121
|
+
@server.run("foo.rb")
|
122
|
+
end
|
113
123
|
end
|
114
124
|
end
|
115
|
-
|
116
125
|
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 =
|
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.
|
17
|
-
File.
|
18
|
-
File.
|
19
|
-
File.
|
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.
|
22
|
-
File.
|
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.
|
25
|
-
File.
|
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.
|
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").
|
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").
|
49
|
-
@h.to_selector("/tmp/foo/baz").
|
50
|
-
@h.to_selector("/tmp").
|
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").
|
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").
|
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
|
-
|
66
|
-
@h.call(:splat => "../../../home/foo/bar/baz").to_s.
|
67
|
-
}.
|
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.
|
74
|
-
File.
|
75
|
-
File.
|
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.
|
78
|
-
File.
|
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.
|
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.
|
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 =
|
93
|
-
File.
|
92
|
+
@file = double(File)
|
93
|
+
expect(File).to receive(:directory?).with("/tmp/baz.txt").and_return(false)
|
94
94
|
|
95
|
-
File.
|
96
|
-
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").
|
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.
|
107
|
-
File.
|
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
|
-
|
111
|
+
expect {
|
112
112
|
@h.call(:splat => "baz.txt")
|
113
|
-
}.
|
113
|
+
}.to raise_error(Gopher::NotFoundError)
|
114
114
|
end
|
115
115
|
end
|
116
116
|
end
|
data/spec/helpers_spec.rb
CHANGED
data/spec/rendering/base_spec.rb
CHANGED
@@ -8,51 +8,58 @@ 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.
|
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.
|
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).
|
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').
|
27
|
+
expect(@ctx.underline(1, 'x')).to eq("x\r\n")
|
28
28
|
end
|
29
29
|
it "has defaults" do
|
30
|
-
@ctx.underline.
|
30
|
+
expect(@ctx.underline).to eq("=" * 70 + "\r\n")
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
34
|
+
describe "figlet" do
|
35
|
+
it "outputs a figlet" do
|
36
|
+
expect(@ctx.figlet('pie')).to eq(" _ \r\n (_) \r\n _ __ _ ___ \r\n | '_ \\| |/ _ \\\r\n | |_) | | __/\r\n | .__/|_|\\___|\r\n | | \r\n |_| \r\n")
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
|
34
41
|
describe "big_header" do
|
35
42
|
it "outputs a box with text" do
|
36
43
|
@ctx.width(5)
|
37
|
-
@ctx.big_header('pie').
|
44
|
+
expect(@ctx.big_header('pie')).to eq("\r\n=====\r\n=pie=\r\n=====\r\n\r\n")
|
38
45
|
end
|
39
46
|
end
|
40
47
|
|
41
48
|
describe "header" do
|
42
49
|
it "outputs underlined text" do
|
43
50
|
@ctx.width(5)
|
44
|
-
@ctx.header('pie').
|
51
|
+
expect(@ctx.header('pie')).to eq(" pie \r\n=====\r\n")
|
45
52
|
end
|
46
53
|
end
|
47
54
|
|
48
55
|
it "uses to_s to output result" do
|
49
56
|
@ctx.text("line 1")
|
50
|
-
@ctx.to_s.
|
57
|
+
expect(@ctx.to_s).to eq(@ctx.result)
|
51
58
|
end
|
52
59
|
|
53
60
|
describe "block" do
|
54
61
|
it "wraps text" do
|
55
|
-
@ctx.
|
62
|
+
expect(@ctx).to receive(:text).twice.with "a"
|
56
63
|
@ctx.block("a a",1)
|
57
64
|
end
|
58
65
|
end
|
data/spec/rendering/menu_spec.rb
CHANGED
@@ -12,80 +12,102 @@ 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.
|
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 ").
|
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").
|
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").
|
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").
|
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").
|
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.
|
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.
|
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
|
-
|
58
|
-
|
59
|
-
|
57
|
+
context "with filepath" do
|
58
|
+
it "should get type with determine_type" do
|
59
|
+
expect(@ctx).to receive(:determine_type).with("foo.txt").and_return("A")
|
60
|
+
expect(@ctx.link("FILE", "thing", "external-server.com", 70, "foo.txt")).to eq("AFILE\tthing\texternal-server.com\t70\r\n")
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
context "without filepath" do
|
65
|
+
it "should get type with determine_type" do
|
66
|
+
expect(@ctx).to receive(:determine_type).with("foo.txt").and_return("A")
|
67
|
+
expect(@ctx.link("FILE", "foo.txt")).to eq("AFILE\tfoo.txt\thost\t1234\r\n")
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
end
|
72
|
+
|
73
|
+
describe "text_link" do
|
74
|
+
it "should work" do
|
75
|
+
expect(@ctx.text_link("text link", "/files/foo.txt")).to eq("0text link\t/files/foo.txt\thost\t1234\r\n")
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
describe "http" do
|
80
|
+
it "should work" do
|
81
|
+
expect(@ctx.http("weblink", "http://google.com")).to eq("hweblink\tURL:http://google.com\thost\t1234\r\n")
|
60
82
|
end
|
61
83
|
end
|
62
84
|
|
63
85
|
describe "search" do
|
64
86
|
it "should output link type/text" do
|
65
|
-
@ctx.search("FIND", "search").
|
87
|
+
expect(@ctx.search("FIND", "search")).to eq("7FIND\tsearch\thost\t1234\r\n")
|
66
88
|
end
|
67
89
|
end
|
68
90
|
|
69
91
|
describe "menu" do
|
70
92
|
it "should output link type/text" do
|
71
|
-
@ctx.menu("MENU ITEM", "item").
|
93
|
+
expect(@ctx.menu("MENU ITEM", "item")).to eq("1MENU ITEM\titem\thost\t1234\r\n")
|
72
94
|
end
|
73
95
|
end
|
74
96
|
|
75
97
|
describe "br" do
|
76
98
|
it "should generate an empty text line" do
|
77
|
-
@ctx.
|
99
|
+
expect(@ctx).to receive(:text).with("i", "")
|
78
100
|
@ctx.br
|
79
101
|
end
|
80
102
|
|
81
103
|
it "should call #text multiple times" do
|
82
|
-
@ctx.
|
104
|
+
expect(@ctx).to receive(:text).twice.with("i", "")
|
83
105
|
@ctx.br(2)
|
84
106
|
end
|
85
107
|
|
86
108
|
it "should output an empty menu item" do
|
87
109
|
@ctx.br
|
88
|
-
@ctx.result.
|
110
|
+
expect(@ctx.result).to eq("i\tnull\t(FALSE)\t0\r\n")
|
89
111
|
end
|
90
112
|
end
|
91
113
|
|
@@ -99,10 +121,10 @@ describe Gopher::Rendering::Menu do
|
|
99
121
|
"foo.png" => 'I',
|
100
122
|
"foo.mp3" => 's',
|
101
123
|
"foo.wav" => 's',
|
102
|
-
"foo.random-file" => "
|
124
|
+
"foo.random-file" => "9"
|
103
125
|
}.each do |file, expected|
|
104
126
|
it "should have right selector for #{file}" do
|
105
|
-
@ctx.determine_type(file).
|
127
|
+
expect(@ctx.determine_type(file)).to eq(expected)
|
106
128
|
end
|
107
129
|
end
|
108
130
|
end
|