snapdragon 1.0.0 → 2.0.0
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 +4 -4
- data/.gitmodules +0 -3
- data/.ruby-version +1 -1
- data/ChangeLog.markdown +7 -2
- data/lib/jasmine/MIT.LICENSE +20 -0
- data/lib/jasmine/boot.js +181 -0
- data/lib/jasmine/console.js +160 -0
- data/lib/jasmine/jasmine-html.js +359 -0
- data/lib/jasmine/jasmine.css +55 -0
- data/lib/jasmine/jasmine.js +2402 -0
- data/lib/jasmine/jasmine_favicon.png +0 -0
- data/lib/jasmine_v1/MIT.LICENSE +20 -0
- data/lib/{jasmine/lib/jasmine-core → jasmine_v1}/jasmine-html.js +0 -0
- data/lib/{jasmine/lib/jasmine-core → jasmine_v1}/jasmine.css +0 -0
- data/lib/{jasmine/lib/jasmine-core → jasmine_v1}/jasmine.js +0 -0
- data/lib/snapdragon/command_line_parser.rb +7 -3
- data/lib/snapdragon/resources/SnapdragonConsoleReporter.js +129 -128
- data/lib/snapdragon/resources/SnapdragonConsoleReporter_v1.js +162 -0
- data/lib/snapdragon/resources/SnapdragonJUnitReporter.js +142 -131
- data/lib/snapdragon/resources/SnapdragonJUnitReporter_v1.js +158 -0
- data/lib/snapdragon/suite.rb +4 -0
- data/lib/snapdragon/version.rb +1 -1
- data/lib/snapdragon/views/run.erb +21 -44
- data/lib/snapdragon/views/run_v1.erb +60 -0
- data/lib/snapdragon/web_application.rb +11 -3
- data/snapdragon.gemspec +7 -7
- data/spec/lib/snapdragon/cli_application_spec.rb +20 -19
- data/spec/lib/snapdragon/command_line_parser_spec.rb +44 -20
- data/spec/lib/snapdragon/path_spec.rb +21 -20
- data/spec/lib/snapdragon/spec_directory_spec.rb +2 -1
- data/spec/lib/snapdragon/spec_file_spec.rb +2 -1
- data/spec/lib/snapdragon/suite_spec.rb +54 -44
- data/spec/spec_helper.rb +7 -0
- metadata +51 -48
- data/lib/jasmine/lib/jasmine-core/example/SpecRunner.html +0 -54
- data/lib/jasmine/lib/jasmine-core/example/spec/PlayerSpec.js +0 -58
- data/lib/jasmine/lib/jasmine-core/example/spec/SpecHelper.js +0 -9
- data/lib/jasmine/lib/jasmine-core/example/src/Player.js +0 -22
- data/lib/jasmine/lib/jasmine-core/example/src/Song.js +0 -7
- data/lib/jasmine/lib/jasmine-core/json2.js +0 -478
- data/lib/jasmine/lib/jasmine-core/version.rb +0 -6
- data/lib/snapdragon/resources/.gitkeep +0 -0
data/lib/snapdragon/suite.rb
CHANGED
data/lib/snapdragon/version.rb
CHANGED
@@ -1,11 +1,29 @@
|
|
1
|
-
<link rel="stylesheet" type="text/css" href="/jasmine
|
2
|
-
<script type="text/javascript" src="/jasmine
|
3
|
-
<script type="text/javascript" src="/jasmine
|
1
|
+
<link rel="stylesheet" type="text/css" href="/jasmine/jasmine.css">
|
2
|
+
<script type="text/javascript" src="/jasmine/jasmine.js"></script>
|
3
|
+
<script type="text/javascript" src="/jasmine/jasmine-html.js"></script>
|
4
|
+
<script type="text/javascript" src="/jasmine/boot.js"></script>
|
4
5
|
|
5
6
|
<% if @suite.formatter == "junit" %>
|
6
7
|
<script type="text/javascript" src="/resources/SnapdragonJUnitReporter.js"></script>
|
8
|
+
<script>
|
9
|
+
var env = jasmine.getEnv();
|
10
|
+
jasmineRequire.console(jasmineRequire, jasmine);
|
11
|
+
var snapdragonJUnitReporter = new jasmine.SnapdragonJUnitReporter({
|
12
|
+
env: env
|
13
|
+
});
|
14
|
+
env.addReporter(snapdragonJUnitReporter);
|
15
|
+
</script>
|
7
16
|
<% else %>
|
8
17
|
<script type="text/javascript" src="/resources/SnapdragonConsoleReporter.js"></script>
|
18
|
+
<script>
|
19
|
+
var env = jasmine.getEnv();
|
20
|
+
jasmineRequire.console(jasmineRequire, jasmine);
|
21
|
+
var snapdragonConsoleReporter = new jasmine.SnapdragonConsoleReporter({
|
22
|
+
env: env,
|
23
|
+
showColors: <% if @suite.use_color? %>true<% else %>false<% end %>
|
24
|
+
});
|
25
|
+
env.addReporter(snapdragonConsoleReporter);
|
26
|
+
</script>
|
9
27
|
<% end %>
|
10
28
|
|
11
29
|
<!-- The implementation code the spec files being tested need -->
|
@@ -17,44 +35,3 @@
|
|
17
35
|
<% @suite.spec_files.each do |spec| %>
|
18
36
|
<script type="text/javascript" src="<%= spec.relative_url_path %>"></script>
|
19
37
|
<% end %>
|
20
|
-
|
21
|
-
<script type="text/javascript">
|
22
|
-
(function() {
|
23
|
-
var jasmineEnv = jasmine.getEnv();
|
24
|
-
jasmineEnv.updateInterval = 1000;
|
25
|
-
|
26
|
-
var htmlReporter = new jasmine.HtmlReporter();
|
27
|
-
jasmineEnv.addReporter(htmlReporter);
|
28
|
-
|
29
|
-
jasmineEnv.specFilter = function(spec) {
|
30
|
-
return htmlReporter.specFilter(spec);
|
31
|
-
};
|
32
|
-
|
33
|
-
<% if @suite.formatter == "junit" %>
|
34
|
-
var snapdragonJUnitReporter = new jasmine.SnapdragonJUnitReporter();
|
35
|
-
jasmineEnv.addReporter(snapdragonJUnitReporter);
|
36
|
-
<% else %>
|
37
|
-
var reporterOptions = {};
|
38
|
-
<% if @suite.use_color? %>
|
39
|
-
reporterOptions.showColors = true;
|
40
|
-
<% end %>
|
41
|
-
|
42
|
-
var snapdragonConsoleReporter = new jasmine.SnapdragonConsoleReporter(reporterOptions);
|
43
|
-
jasmineEnv.addReporter(snapdragonConsoleReporter);
|
44
|
-
<% end %>
|
45
|
-
|
46
|
-
var currentWindowOnload = window.onload;
|
47
|
-
|
48
|
-
window.onload = function() {
|
49
|
-
if (currentWindowOnload) {
|
50
|
-
currentWindowOnload();
|
51
|
-
}
|
52
|
-
execJasmine();
|
53
|
-
};
|
54
|
-
|
55
|
-
function execJasmine() {
|
56
|
-
jasmineEnv.execute();
|
57
|
-
}
|
58
|
-
|
59
|
-
})();
|
60
|
-
</script>
|
@@ -0,0 +1,60 @@
|
|
1
|
+
<link rel="stylesheet" type="text/css" href="/jasmine_v1/jasmine.css">
|
2
|
+
<script type="text/javascript" src="/jasmine_v1/jasmine.js"></script>
|
3
|
+
<script type="text/javascript" src="/jasmine_v1/jasmine-html.js"></script>
|
4
|
+
|
5
|
+
<% if @suite.formatter == "junit" %>
|
6
|
+
<script type="text/javascript" src="/resources/SnapdragonJUnitReporter_v1.js"></script>
|
7
|
+
<% else %>
|
8
|
+
<script type="text/javascript" src="/resources/SnapdragonConsoleReporter_v1.js"></script>
|
9
|
+
<% end %>
|
10
|
+
|
11
|
+
<!-- The implementation code the spec files being tested need -->
|
12
|
+
<% @suite.require_file_relative_url_paths.each do |path| %>
|
13
|
+
<script type="text/javascript" src="<%= path %>"></script>
|
14
|
+
<% end %>
|
15
|
+
|
16
|
+
<!-- The spec files -->
|
17
|
+
<% @suite.spec_files.each do |spec| %>
|
18
|
+
<script type="text/javascript" src="<%= spec.relative_url_path %>"></script>
|
19
|
+
<% end %>
|
20
|
+
|
21
|
+
<script type="text/javascript">
|
22
|
+
(function() {
|
23
|
+
var jasmineEnv = jasmine.getEnv();
|
24
|
+
jasmineEnv.updateInterval = 1000;
|
25
|
+
|
26
|
+
var htmlReporter = new jasmine.HtmlReporter();
|
27
|
+
jasmineEnv.addReporter(htmlReporter);
|
28
|
+
|
29
|
+
jasmineEnv.specFilter = function(spec) {
|
30
|
+
return htmlReporter.specFilter(spec);
|
31
|
+
};
|
32
|
+
|
33
|
+
<% if @suite.formatter == "junit" %>
|
34
|
+
var snapdragonJUnitReporter = new jasmine.SnapdragonJUnitReporter();
|
35
|
+
jasmineEnv.addReporter(snapdragonJUnitReporter);
|
36
|
+
<% else %>
|
37
|
+
var reporterOptions = {};
|
38
|
+
<% if @suite.use_color? %>
|
39
|
+
reporterOptions.showColors = true;
|
40
|
+
<% end %>
|
41
|
+
|
42
|
+
var snapdragonConsoleReporter = new jasmine.SnapdragonConsoleReporter(reporterOptions);
|
43
|
+
jasmineEnv.addReporter(snapdragonConsoleReporter);
|
44
|
+
<% end %>
|
45
|
+
|
46
|
+
var currentWindowOnload = window.onload;
|
47
|
+
|
48
|
+
window.onload = function() {
|
49
|
+
if (currentWindowOnload) {
|
50
|
+
currentWindowOnload();
|
51
|
+
}
|
52
|
+
execJasmine();
|
53
|
+
};
|
54
|
+
|
55
|
+
function execJasmine() {
|
56
|
+
jasmineEnv.execute();
|
57
|
+
}
|
58
|
+
|
59
|
+
})();
|
60
|
+
</script>
|
@@ -12,11 +12,19 @@ module Snapdragon
|
|
12
12
|
end
|
13
13
|
|
14
14
|
get "/run" do
|
15
|
-
|
15
|
+
if @suite.jasmine_ver == "1"
|
16
|
+
erb :run_v1
|
17
|
+
else
|
18
|
+
erb :run
|
19
|
+
end
|
16
20
|
end
|
17
21
|
|
18
|
-
get "/jasmine
|
19
|
-
send_file ::File.expand_path(::File.join('../jasmine
|
22
|
+
get "/jasmine/*" do |path|
|
23
|
+
send_file ::File.expand_path(::File.join('../jasmine', path), ::File.dirname(__FILE__))
|
24
|
+
end
|
25
|
+
|
26
|
+
get "/jasmine_v1/*" do |path|
|
27
|
+
send_file ::File.expand_path(::File.join('../jasmine_v1', path), ::File.dirname(__FILE__))
|
20
28
|
end
|
21
29
|
|
22
30
|
get "/resources/*" do |path|
|
data/snapdragon.gemspec
CHANGED
@@ -18,11 +18,11 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.add_dependency "capybara", "~> 2.
|
22
|
-
spec.add_dependency "poltergeist", "~> 1.
|
23
|
-
spec.add_dependency "sinatra", "~> 1.4
|
24
|
-
spec.add_dependency "launchy", "~> 2.
|
25
|
-
spec.add_development_dependency "bundler", "~> 1.
|
26
|
-
spec.add_development_dependency "rake"
|
27
|
-
spec.add_development_dependency "rspec", "~> 2.
|
21
|
+
spec.add_dependency "capybara", "~> 2.2"
|
22
|
+
spec.add_dependency "poltergeist", "~> 1.5"
|
23
|
+
spec.add_dependency "sinatra", "~> 1.4"
|
24
|
+
spec.add_dependency "launchy", "~> 2.4"
|
25
|
+
spec.add_development_dependency "bundler", "~> 1.5"
|
26
|
+
spec.add_development_dependency "rake", "~> 10.1"
|
27
|
+
spec.add_development_dependency "rspec", "~> 2.14"
|
28
28
|
end
|
@@ -1,54 +1,55 @@
|
|
1
|
+
require 'spec_helper'
|
1
2
|
require_relative '../../../lib/snapdragon/cli_application'
|
2
3
|
|
3
4
|
describe Snapdragon::CliApplication do
|
4
5
|
describe "#initialize" do
|
5
6
|
it "creates an empty Suite" do
|
6
|
-
Snapdragon::Suite.
|
7
|
-
Snapdragon::CliApplication.new(
|
7
|
+
expect(Snapdragon::Suite).to receive(:new)
|
8
|
+
Snapdragon::CliApplication.new(double, double)
|
8
9
|
end
|
9
10
|
|
10
11
|
it "assigns the new Suite to an instance variable" do
|
11
|
-
suite =
|
12
|
-
Snapdragon::Suite.
|
13
|
-
app = Snapdragon::CliApplication.new(
|
14
|
-
app.instance_variable_get(:@suite).
|
12
|
+
suite = double('suite')
|
13
|
+
allow(Snapdragon::Suite).to receive(:new).and_return(suite)
|
14
|
+
app = Snapdragon::CliApplication.new(double, double)
|
15
|
+
expect(app.instance_variable_get(:@suite)).to be(suite)
|
15
16
|
end
|
16
17
|
end
|
17
18
|
|
18
19
|
describe "#run" do
|
19
|
-
let(:paths) {
|
20
|
-
let(:options) {
|
20
|
+
let(:paths) { double('paths') }
|
21
|
+
let(:options) { double('options') }
|
21
22
|
subject { Snapdragon::CliApplication.new(options, paths) }
|
22
23
|
|
23
24
|
it "creates a capybara session" do
|
24
|
-
suite =
|
25
|
-
Snapdragon::Suite.
|
26
|
-
Capybara::Session.
|
25
|
+
suite = double(filtered?: false)
|
26
|
+
allow(Snapdragon::Suite).to receive(:new).and_return(suite)
|
27
|
+
expect(Capybara::Session).to receive(:new).and_return(double.as_null_object)
|
27
28
|
subject.run
|
28
29
|
end
|
29
30
|
|
30
31
|
context "when suite is filtered" do
|
31
32
|
before do
|
32
|
-
subject.instance_variable_set(:@suite,
|
33
|
+
subject.instance_variable_set(:@suite, double(:filtered? => true, :spec_query_param => 'some_query_param_spec_filter'))
|
33
34
|
end
|
34
35
|
|
35
36
|
it "visits /run with the spec query param in the capybara session" do
|
36
|
-
session =
|
37
|
-
Capybara::Session.
|
38
|
-
session.
|
37
|
+
session = double(find: nil)
|
38
|
+
allow(Capybara::Session).to receive(:new).and_return(session)
|
39
|
+
expect(session).to receive(:visit).with("/run?spec=some_query_param_spec_filter")
|
39
40
|
subject.run
|
40
41
|
end
|
41
42
|
end
|
42
43
|
|
43
44
|
context "when suite is NOT filtered" do
|
44
45
|
before do
|
45
|
-
subject.instance_variable_set(:@suite,
|
46
|
+
subject.instance_variable_set(:@suite, double(:filtered? => false))
|
46
47
|
end
|
47
48
|
|
48
49
|
it "visits /run in that capybara session" do
|
49
|
-
session =
|
50
|
-
Capybara::Session.
|
51
|
-
session.
|
50
|
+
session = double(find: nil)
|
51
|
+
allow(Capybara::Session).to receive(:new).and_return(session)
|
52
|
+
expect(session).to receive(:visit).with('/run')
|
52
53
|
subject.run
|
53
54
|
end
|
54
55
|
end
|
@@ -4,70 +4,94 @@ require_relative '../../../lib/snapdragon/command_line_parser'
|
|
4
4
|
describe Snapdragon::CommandLineParser do
|
5
5
|
describe "#parse" do
|
6
6
|
subject { Snapdragon::CommandLineParser }
|
7
|
-
|
7
|
+
|
8
8
|
it "display version information" do
|
9
9
|
output = capture_stdout { subject.parse(["-v"]) }
|
10
|
-
output.
|
10
|
+
expect(output).to match(/\d+\.\d+\.\d+/)
|
11
11
|
end
|
12
|
-
|
12
|
+
|
13
13
|
it "exit once version information is displayed" do
|
14
|
-
|
14
|
+
expect { hide_stdout { subject.parse(["-v"]) } }.to raise_error(SystemExit)
|
15
15
|
end
|
16
|
-
|
16
|
+
|
17
17
|
it "display usage information" do
|
18
18
|
output = capture_stdout { subject.parse(["-h"]) }
|
19
|
-
output.
|
19
|
+
expect(output).to match(/Usage/)
|
20
20
|
end
|
21
|
-
|
21
|
+
|
22
22
|
it "exit once usage information is displayed" do
|
23
|
-
|
23
|
+
expect { hide_stdout { subject.parse(["-h"]) } }.to raise_error(SystemExit)
|
24
24
|
end
|
25
|
-
|
25
|
+
|
26
26
|
context "no args supplied" do
|
27
27
|
it "exit" do
|
28
|
-
|
28
|
+
expect { hide_stdout { subject.parse([]) } }.not_to raise_error()
|
29
29
|
end
|
30
30
|
end
|
31
|
-
|
31
|
+
|
32
32
|
context "args supplied" do
|
33
33
|
it "continue execution" do
|
34
|
-
|
34
|
+
expect { subject.parse(["spec/hello_spec.rb"]) }.not_to raise_error()
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
38
|
context "when format is provided" do
|
39
39
|
it "sets the format value" do
|
40
|
-
subject.parse(["--format", "junit", "spec/hello_spec.rb"]).format.
|
40
|
+
expect(subject.parse(["--format", "junit", "spec/hello_spec.rb"]).format).to eq "junit"
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
44
44
|
context "when format is not provided" do
|
45
45
|
it "defaults to console" do
|
46
|
-
subject.parse(["spec/hello_spec.rb"]).format.
|
46
|
+
expect(subject.parse(["spec/hello_spec.rb"]).format).to eq "console"
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
50
50
|
context "when color option is not provided" do
|
51
51
|
it "defaults to true" do
|
52
|
-
subject.parse(["spec/hello_spec.rb"]).color.
|
52
|
+
expect(subject.parse(["spec/hello_spec.rb"]).color).to eq true
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
56
56
|
context "when no-color option is provided" do
|
57
57
|
it "sets the color option" do
|
58
|
-
subject.parse(["
|
58
|
+
expect(subject.parse(["-N", "spec/hello_spec.rb"]).color).to eq false
|
59
|
+
end
|
60
|
+
|
61
|
+
it "sets the color option" do
|
62
|
+
expect(subject.parse(["--nocolor", "spec/hello_spec.rb"]).color).to eq false
|
63
|
+
end
|
64
|
+
|
65
|
+
it "sets the color option" do
|
66
|
+
expect(subject.parse(["--nocolour", "spec/hello_spec.rb"]).color).to eq false
|
59
67
|
end
|
60
68
|
end
|
61
|
-
|
69
|
+
|
62
70
|
context "when pattern is provided" do
|
63
71
|
it "sets the pattern value" do
|
64
|
-
subject.parse(["--pattern", "spec/*/*_test.js"]).pattern.
|
72
|
+
expect(subject.parse(["--pattern", "spec/*/*_test.js"]).pattern).to eq "spec/*/*_test.js"
|
65
73
|
end
|
66
74
|
end
|
67
|
-
|
75
|
+
|
68
76
|
context "when pattern is not provided" do
|
69
77
|
it "defaults to 'spec/**/*_spec.js'" do
|
70
|
-
subject.parse([]).pattern.
|
78
|
+
expect(subject.parse([]).pattern).to eq "spec/**/*_spec.js"
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
context "when Jasmine version is not provided" do
|
83
|
+
it "defaults to '2'" do
|
84
|
+
expect(subject.parse([]).jasmine_ver).to eq '2'
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
context "when Jasmine version is provided" do
|
89
|
+
it "defaults to '1'" do
|
90
|
+
expect(subject.parse(['-J1', 'spec/hello_spec.rb']).jasmine_ver).to eq '1'
|
91
|
+
end
|
92
|
+
|
93
|
+
it "defaults to '1'" do
|
94
|
+
expect(subject.parse(['--jasminev1', 'spec/hello_spec.rb']).jasmine_ver).to eq '1'
|
71
95
|
end
|
72
96
|
end
|
73
97
|
end
|
@@ -1,28 +1,29 @@
|
|
1
|
+
require 'spec_helper'
|
1
2
|
require_relative '../../../lib/snapdragon/path'
|
2
3
|
|
3
4
|
describe Snapdragon::Path do
|
4
5
|
describe "#initialize" do
|
5
6
|
it "stores the raw path in an instance variable" do
|
6
7
|
path = Snapdragon::Path.new('some/path:423')
|
7
|
-
path.instance_variable_get(:@raw_path).
|
8
|
+
expect(path.instance_variable_get(:@raw_path)).to eq('some/path:423')
|
8
9
|
end
|
9
10
|
|
10
11
|
context "when given a path and line number" do
|
11
12
|
it "stores the path in an instance variable" do
|
12
13
|
path = Snapdragon::Path.new('some/path:423')
|
13
|
-
path.instance_variable_get(:@path).
|
14
|
+
expect(path.instance_variable_get(:@path)).to eq('some/path')
|
14
15
|
end
|
15
16
|
|
16
17
|
it "stores the line number in an instance variable" do
|
17
18
|
path = Snapdragon::Path.new('some/path:423')
|
18
|
-
path.instance_variable_get(:@line_number).
|
19
|
+
expect(path.instance_variable_get(:@line_number)).to eq(423)
|
19
20
|
end
|
20
21
|
end
|
21
22
|
|
22
23
|
context "when given a path" do
|
23
24
|
it "stores teh path in an instance variable" do
|
24
25
|
path = Snapdragon::Path.new('some/path')
|
25
|
-
path.instance_variable_get(:@path).
|
26
|
+
expect(path.instance_variable_get(:@path)).to eq('some/path')
|
26
27
|
end
|
27
28
|
end
|
28
29
|
end
|
@@ -32,51 +33,51 @@ describe Snapdragon::Path do
|
|
32
33
|
|
33
34
|
context "when does NOT exist" do
|
34
35
|
before do
|
35
|
-
path.
|
36
|
+
allow(path).to receive(:exists?).and_return(false)
|
36
37
|
end
|
37
38
|
|
38
39
|
it "returns an empty array" do
|
39
|
-
path.spec_files.
|
40
|
+
expect(path.spec_files).to eq([])
|
40
41
|
end
|
41
42
|
end
|
42
43
|
|
43
44
|
context "when does exist" do
|
44
45
|
before do
|
45
|
-
path.
|
46
|
+
allow(path).to receive(:exists?).and_return(true)
|
46
47
|
end
|
47
48
|
|
48
49
|
context "when is a directory" do
|
49
50
|
before do
|
50
|
-
path.
|
51
|
+
allow(path).to receive(:is_a_directory?).and_return(true)
|
51
52
|
end
|
52
53
|
|
53
54
|
it "constructs a spec directory" do
|
54
|
-
Snapdragon::SpecDirectory.
|
55
|
+
expect(Snapdragon::SpecDirectory).to receive(:new).and_return(double.as_null_object)
|
55
56
|
path.spec_files
|
56
57
|
end
|
57
58
|
|
58
59
|
it "returns the spec files recursively found in the spec directory" do
|
59
|
-
spec_files =
|
60
|
-
spec_dir =
|
61
|
-
Snapdragon::SpecDirectory.
|
62
|
-
path.spec_files.
|
60
|
+
spec_files = double
|
61
|
+
spec_dir = double(spec_files: spec_files)
|
62
|
+
expect(Snapdragon::SpecDirectory).to receive(:new).and_return(spec_dir)
|
63
|
+
expect(path.spec_files).to eq(spec_files)
|
63
64
|
end
|
64
65
|
end
|
65
66
|
|
66
67
|
context "when is NOT a directory" do
|
67
68
|
before do
|
68
|
-
path.
|
69
|
+
allow(path).to receive(:is_a_directory?).and_return(false)
|
69
70
|
end
|
70
71
|
|
71
72
|
it "constructs a spec file" do
|
72
|
-
Snapdragon::SpecFile.
|
73
|
+
expect(Snapdragon::SpecFile).to receive(:new)
|
73
74
|
path.spec_files
|
74
75
|
end
|
75
76
|
|
76
77
|
it "returns an array containing a newly constructed spec file" do
|
77
|
-
spec_file =
|
78
|
-
Snapdragon::SpecFile.
|
79
|
-
path.spec_files.
|
78
|
+
spec_file = double
|
79
|
+
allow(Snapdragon::SpecFile).to receive(:new).and_return(spec_file)
|
80
|
+
expect(path.spec_files).to eq([spec_file])
|
80
81
|
end
|
81
82
|
end
|
82
83
|
end
|
@@ -86,14 +87,14 @@ describe Snapdragon::Path do
|
|
86
87
|
context "when the given raw path has a line number" do
|
87
88
|
it "returns true" do
|
88
89
|
path = Snapdragon::Path.new('some/path:234')
|
89
|
-
path.has_line_number
|
90
|
+
expect(path.has_line_number?).to be_true
|
90
91
|
end
|
91
92
|
end
|
92
93
|
|
93
94
|
context "when the given raw path does NOT have a line number" do
|
94
95
|
it "returns false" do
|
95
96
|
path = Snapdragon::Path.new('some/path')
|
96
|
-
path.has_line_number
|
97
|
+
expect(path.has_line_number?).to be_false
|
97
98
|
end
|
98
99
|
end
|
99
100
|
end
|