rally-jasmine 1.2.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.
- data/.gitignore +13 -0
- data/.rspec +1 -0
- data/.travis.yml +58 -0
- data/Gemfile +8 -0
- data/HOW_TO_TEST.markdown +9 -0
- data/MIT.LICENSE +20 -0
- data/README.markdown +77 -0
- data/RELEASE.markdown +22 -0
- data/RELEASE_NOTES.markdown +6 -0
- data/Rakefile +53 -0
- data/bin/jasmine +6 -0
- data/generators/jasmine/jasmine_generator.rb +24 -0
- data/generators/jasmine/templates/INSTALL +9 -0
- data/generators/jasmine/templates/jasmine-example/SpecRunner.html +54 -0
- data/generators/jasmine/templates/jasmine-example/spec/PlayerSpec.js +58 -0
- data/generators/jasmine/templates/jasmine-example/spec/SpecHelper.js +9 -0
- data/generators/jasmine/templates/jasmine-example/src/Player.js +22 -0
- data/generators/jasmine/templates/jasmine-example/src/Song.js +7 -0
- data/generators/jasmine/templates/lib/tasks/jasmine.rake +8 -0
- data/generators/jasmine/templates/spec/javascripts/support/jasmine-rails.yml +81 -0
- data/generators/jasmine/templates/spec/javascripts/support/jasmine.yml +73 -0
- data/lib/generators/jasmine/examples/USAGE +11 -0
- data/lib/generators/jasmine/examples/examples_generator.rb +19 -0
- data/lib/generators/jasmine/examples/templates/app/assets/javascripts/jasmine_examples/Player.js +22 -0
- data/lib/generators/jasmine/examples/templates/app/assets/javascripts/jasmine_examples/Song.js +7 -0
- data/lib/generators/jasmine/examples/templates/spec/javascripts/helpers/SpecHelper.js +9 -0
- data/lib/generators/jasmine/examples/templates/spec/javascripts/jasmine_examples/PlayerSpec.js +58 -0
- data/lib/generators/jasmine/install/USAGE +11 -0
- data/lib/generators/jasmine/install/install_generator.rb +18 -0
- data/lib/generators/jasmine/install/templates/spec/javascripts/helpers/.gitkeep +0 -0
- data/lib/generators/jasmine/install/templates/spec/javascripts/support/jasmine.yml +76 -0
- data/lib/jasmine/application.rb +43 -0
- data/lib/jasmine/asset_pipeline_mapper.rb +19 -0
- data/lib/jasmine/base.rb +50 -0
- data/lib/jasmine/command_line_tool.rb +70 -0
- data/lib/jasmine/config.rb +121 -0
- data/lib/jasmine/dependencies.rb +59 -0
- data/lib/jasmine/firebug/firebug-1.6.2.xpi +0 -0
- data/lib/jasmine/firebug/firebug-1.7.0.xpi +0 -0
- data/lib/jasmine/firebug/firebug-license.txt +30 -0
- data/lib/jasmine/firebug/firebug.rb +30 -0
- data/lib/jasmine/page.rb +11 -0
- data/lib/jasmine/railtie.rb +21 -0
- data/lib/jasmine/results.rb +19 -0
- data/lib/jasmine/results_processor.rb +37 -0
- data/lib/jasmine/rspec_formatter.rb +92 -0
- data/lib/jasmine/run.html.erb +55 -0
- data/lib/jasmine/run_specs.rb +32 -0
- data/lib/jasmine/runner_config.rb +71 -0
- data/lib/jasmine/runners/http.rb +71 -0
- data/lib/jasmine/selenium_driver.rb +52 -0
- data/lib/jasmine/server.rb +20 -0
- data/lib/jasmine/sprockets_mapper.rb +13 -0
- data/lib/jasmine/tasks/jasmine.rake +56 -0
- data/lib/jasmine/tasks/jasmine_rails3.rake +1 -0
- data/lib/jasmine/version.rb +3 -0
- data/lib/jasmine.rb +23 -0
- data/lib/rack/jasmine/cache_control.rb +20 -0
- data/lib/rack/jasmine/focused_suite.rb +17 -0
- data/lib/rack/jasmine/redirect.rb +20 -0
- data/lib/rack/jasmine/runner.rb +27 -0
- data/spec/application_spec.rb +99 -0
- data/spec/asset_pipeline_mapper_spec.rb +18 -0
- data/spec/config_spec.rb +309 -0
- data/spec/dependencies_spec.rb +327 -0
- data/spec/fixture/Rakefile +4 -0
- data/spec/fixture/jasmine.erb.yml +4 -0
- data/spec/fixture/spec/example_spec.js +5 -0
- data/spec/fixture/src/example.js +3 -0
- data/spec/jasmine_command_line_tool_rakeless_spec.rb +20 -0
- data/spec/jasmine_command_line_tool_spec.rb +29 -0
- data/spec/jasmine_pojs_spec.rb +47 -0
- data/spec/jasmine_rails2_spec.rb +89 -0
- data/spec/jasmine_rails3_spec.rb +69 -0
- data/spec/jasmine_self_test_config.rb +19 -0
- data/spec/jasmine_self_test_spec.rb +22 -0
- data/spec/page_spec.rb +25 -0
- data/spec/rack/jasmine/runner_spec.rb +25 -0
- data/spec/results_processor_spec.rb +3 -0
- data/spec/results_spec.rb +27 -0
- data/spec/rspec_formatter_spec.rb +88 -0
- data/spec/runner_config_spec.rb +136 -0
- data/spec/server_spec.rb +48 -0
- data/spec/spec_helper.rb +55 -0
- data/spec/sprockets_mapper_spec.rb +17 -0
- metadata +319 -0
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'rack/jasmine/runner'
|
3
|
+
|
4
|
+
describe Rack::Jasmine::Runner do
|
5
|
+
describe "#call" do
|
6
|
+
let(:content) { "some content" }
|
7
|
+
let(:page) { double(Jasmine::Page, :render => content)}
|
8
|
+
let(:runner) { Rack::Jasmine::Runner.new(page)}
|
9
|
+
subject { runner.call("PATH_INFO" => path) }
|
10
|
+
context "PATH_INFO is /" do
|
11
|
+
let(:expected_headers) { {"Content-Type" => "text/html"} }
|
12
|
+
let(:path) { "/" }
|
13
|
+
it "should return a response with the passed content" do
|
14
|
+
subject.should == [200, expected_headers, [content]]
|
15
|
+
end
|
16
|
+
end
|
17
|
+
context "PATH_INFO is not /" do
|
18
|
+
let(:path) { "/some_foo" }
|
19
|
+
let(:expected_headers) { {"Content-Type" => "text/plain", "X-Cascade" => "pass"} }
|
20
|
+
it "should return a 404" do
|
21
|
+
subject.should == [404, expected_headers, ["File not found: #{path}\n"]]
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Jasmine::Results do
|
4
|
+
it "should be able to return suites" do
|
5
|
+
suites = {:some => 'suite'}
|
6
|
+
Jasmine::Results.new({}, suites, {}).suites.should == suites
|
7
|
+
end
|
8
|
+
|
9
|
+
it "should return a result for a particular spec id" do
|
10
|
+
result1 = {:some => 'result'}
|
11
|
+
result2 = {:some => 'other result'}
|
12
|
+
raw_results = {'1' => result1, '2' => result2 }
|
13
|
+
results = Jasmine::Results.new(raw_results, {}, {})
|
14
|
+
results.for_spec_id('1').should == result1
|
15
|
+
results.for_spec_id('2').should == result2
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should return an example location for a particular string" do
|
19
|
+
example_location1 = {:some => 'spec location'}
|
20
|
+
example_location2 = {:some => 'other spec location'}
|
21
|
+
example_locations = {'foo bar' => example_location1, 'baz quux' => example_location2 }
|
22
|
+
results = Jasmine::Results.new({}, {}, example_locations)
|
23
|
+
results.example_location_for('foo bar').should == example_location1
|
24
|
+
results.example_location_for('baz quux').should == example_location2
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
@@ -0,0 +1,88 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Jasmine::RspecFormatter do
|
4
|
+
describe "environment variables" do
|
5
|
+
def stub_env_hash(hash)
|
6
|
+
ENV.stub!(:[]) do |arg|
|
7
|
+
hash[arg]
|
8
|
+
end
|
9
|
+
end
|
10
|
+
describe "browser configuration" do
|
11
|
+
it "should use firefox by default" do
|
12
|
+
pending
|
13
|
+
stub_env_hash({"JASMINE_BROWSER" => nil})
|
14
|
+
config = double('config')
|
15
|
+
formatter = Jasmine::RspecFormatter.new(config)
|
16
|
+
Jasmine::SeleniumDriver.should_receive(:new).
|
17
|
+
with("firefox", anything).
|
18
|
+
and_return(mock(Jasmine::SeleniumDriver, :connect => true))
|
19
|
+
formatter.start
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should use ENV['JASMINE_BROWSER'] if set" do
|
23
|
+
pending
|
24
|
+
stub_env_hash({"JASMINE_BROWSER" => "mosaic"})
|
25
|
+
|
26
|
+
Jasmine::SeleniumDriver.should_receive(:new).
|
27
|
+
with("mosaic", anything).
|
28
|
+
and_return(mock(Jasmine::SeleniumDriver, :connect => true))
|
29
|
+
formatter.start
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
describe "jasmine host" do
|
34
|
+
it "should use http://localhost by default" do
|
35
|
+
pending
|
36
|
+
stub_env_hash({})
|
37
|
+
config = Jasmine::Config.new
|
38
|
+
config.instance_variable_set(:@jasmine_server_port, '1234')
|
39
|
+
config.stub!(:start_jasmine_server)
|
40
|
+
|
41
|
+
Jasmine::SeleniumDriver.should_receive(:new).
|
42
|
+
with(anything, "http://localhost:1234/").
|
43
|
+
and_return(mock(Jasmine::SeleniumDriver, :connect => true))
|
44
|
+
config.start
|
45
|
+
end
|
46
|
+
|
47
|
+
it "should use ENV['JASMINE_HOST'] if set" do
|
48
|
+
pending
|
49
|
+
stub_env_hash({"JASMINE_HOST" => "http://some_host"})
|
50
|
+
config = Jasmine::Config.new
|
51
|
+
config.instance_variable_set(:@jasmine_server_port, '1234')
|
52
|
+
config.stub!(:start_jasmine_server)
|
53
|
+
|
54
|
+
Jasmine::SeleniumDriver.should_receive(:new).
|
55
|
+
with(anything, "http://some_host:1234/").
|
56
|
+
and_return(mock(Jasmine::SeleniumDriver, :connect => true))
|
57
|
+
config.start
|
58
|
+
end
|
59
|
+
|
60
|
+
it "should use ENV['JASMINE_PORT'] if set" do
|
61
|
+
pending
|
62
|
+
stub_env_hash({"JASMINE_PORT" => "4321"})
|
63
|
+
config = Jasmine::Config.new
|
64
|
+
Jasmine.stub!(:wait_for_listener)
|
65
|
+
config.stub!(:start_server)
|
66
|
+
Jasmine::SeleniumDriver.should_receive(:new).
|
67
|
+
with(anything, "http://localhost:4321/").
|
68
|
+
and_return(mock(Jasmine::SeleniumDriver, :connect => true))
|
69
|
+
config.start
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
describe "external selenium server" do
|
74
|
+
it "should use an external selenium server if SELENIUM_SERVER is set" do
|
75
|
+
pending
|
76
|
+
stub_env_hash({"SELENIUM_SERVER" => "http://myseleniumserver.com:4441"})
|
77
|
+
Selenium::WebDriver.should_receive(:for).with(:remote, :url => "http://myseleniumserver.com:4441", :desired_capabilities => :firefox)
|
78
|
+
Jasmine::SeleniumDriver.new('firefox', 'http://localhost:8888')
|
79
|
+
end
|
80
|
+
it "should use an local selenium server with a specific port if SELENIUM_SERVER_PORT is set" do
|
81
|
+
pending
|
82
|
+
stub_env_hash({"SELENIUM_SERVER_PORT" => "4441"})
|
83
|
+
Selenium::WebDriver.should_receive(:for).with(:remote, :url => "http://localhost:4441/wd/hub", :desired_capabilities => :firefox)
|
84
|
+
Jasmine::SeleniumDriver.new('firefox', 'http://localhost:8888')
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
@@ -0,0 +1,136 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'selenium-webdriver'
|
3
|
+
|
4
|
+
describe Jasmine::RunnerConfig do
|
5
|
+
describe "css_files" do
|
6
|
+
it "should return the jasmine stylesheets and any user defined stylesheets" do
|
7
|
+
jasmine_stylesheets = ['some/css/file']
|
8
|
+
user_stylesheets = ['some/user/file']
|
9
|
+
user_config = double("config", :jasmine_stylesheets => jasmine_stylesheets, :user_stylesheets => user_stylesheets)
|
10
|
+
Jasmine::RunnerConfig.new(user_config).css_files.should == jasmine_stylesheets + user_stylesheets
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
describe "jasmine_files" do
|
15
|
+
it "should return the jasmine files from the config" do
|
16
|
+
jasmine_files = ['some/file']
|
17
|
+
user_config = double('config', :jasmine_javascripts => jasmine_files)
|
18
|
+
Jasmine::RunnerConfig.new(user_config).jasmine_files.should == jasmine_files
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
describe "js_files" do
|
23
|
+
it "should return the user js files from the config" do
|
24
|
+
js_files = ['some/file']
|
25
|
+
user_config = double('config', :js_files => js_files)
|
26
|
+
Jasmine::RunnerConfig.new(user_config).js_files.should == js_files
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
describe "spec_files" do
|
31
|
+
it "should return the user spec_files from the config" do
|
32
|
+
spec_files = ['some/file']
|
33
|
+
user_config = double('config', :spec_files => spec_files)
|
34
|
+
Jasmine::RunnerConfig.new(user_config).spec_files.should == spec_files
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
describe "spec_files_full_paths" do
|
39
|
+
it "should return the user spec_files_full_paths from the config" do
|
40
|
+
spec_files_full_paths = ['some/file_path']
|
41
|
+
user_config = double('config', :spec_files_full_paths => spec_files_full_paths)
|
42
|
+
Jasmine::RunnerConfig.new(user_config).spec_files_full_paths.should == spec_files_full_paths
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
describe "spec_path" do
|
47
|
+
it "should return the user spec_path from the config" do
|
48
|
+
spec_path = ['some/path']
|
49
|
+
user_config = double('config', :spec_path => spec_path)
|
50
|
+
Jasmine::RunnerConfig.new(user_config).spec_path.should == spec_path
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
describe "spec_dir" do
|
55
|
+
it "should return the user spec_dir from the config" do
|
56
|
+
spec_dir = ['some/dir']
|
57
|
+
user_config = double('config', :spec_dir => spec_dir)
|
58
|
+
Jasmine::RunnerConfig.new(user_config).spec_dir.should == spec_dir
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
describe "src_dir" do
|
63
|
+
it "should return the user src_dir from the config" do
|
64
|
+
src_dir = ['some/dir']
|
65
|
+
user_config = double('config', :src_dir => src_dir)
|
66
|
+
Jasmine::RunnerConfig.new(user_config).src_dir.should == src_dir
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
describe "project_root" do
|
71
|
+
it "should return the user project_root from the config" do
|
72
|
+
project_root = ['some/dir']
|
73
|
+
user_config = double('config', :project_root => project_root)
|
74
|
+
Jasmine::RunnerConfig.new(user_config).project_root.should == project_root
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
describe "root_path" do
|
79
|
+
it "should return the user root_path from the config" do
|
80
|
+
root_path = ['some/path']
|
81
|
+
user_config = double('config', :root_path => root_path)
|
82
|
+
Jasmine::RunnerConfig.new(user_config).root_path.should == root_path
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
describe "browser" do
|
87
|
+
it "should default to firefox" do
|
88
|
+
Jasmine::RunnerConfig.new.browser.should == 'firefox'
|
89
|
+
end
|
90
|
+
|
91
|
+
it "should use ENV['JASMINE_BROWSER'] if it exists" do
|
92
|
+
ENV.stub(:[], "JASMINE_BROWSER").and_return("foo")
|
93
|
+
Jasmine::RunnerConfig.new.browser.should == 'foo'
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
|
98
|
+
describe "src_mapper" do
|
99
|
+
it "should update the src_mapper in the user_config" do
|
100
|
+
config = Jasmine::RunnerConfig.new(user_config = Jasmine::Config.new)
|
101
|
+
mapper = double("mapper")
|
102
|
+
config.src_mapper = mapper
|
103
|
+
config.src_mapper.should == mapper
|
104
|
+
user_config.src_mapper.should == mapper
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
describe "jasmine_server_url" do
|
109
|
+
it "should return the correct server url" do
|
110
|
+
host = "the host"
|
111
|
+
port = "484"
|
112
|
+
user_config = double('config', :jasmine_host => host, :port => port)
|
113
|
+
Jasmine::RunnerConfig.new(user_config).jasmine_server_url.should == "#{host}:#{port}/"
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
describe "port" do
|
118
|
+
it "should return the port from the config" do
|
119
|
+
user_config = double('config', :port => 80)
|
120
|
+
Jasmine::RunnerConfig.new(user_config).port.should == 80
|
121
|
+
end
|
122
|
+
end
|
123
|
+
describe "result batch size" do
|
124
|
+
subject { Jasmine::RunnerConfig.new.result_batch_size }
|
125
|
+
|
126
|
+
context "when not specified" do
|
127
|
+
it("should use default") { should == 50 }
|
128
|
+
end
|
129
|
+
|
130
|
+
context "when overridden" do
|
131
|
+
before { ENV.stub(:[], "JASMINE_RESULT_BATCH_SIZE").and_return("500") }
|
132
|
+
it { should be(500) }
|
133
|
+
end
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
data/spec/server_spec.rb
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Jasmine::Server do
|
4
|
+
describe "rack ~> 1.0" do
|
5
|
+
before do
|
6
|
+
Jasmine::Dependencies.stub(:legacy_rack?).and_return(true)
|
7
|
+
end
|
8
|
+
|
9
|
+
it "should run the handler with the application" do
|
10
|
+
server = double(:server)
|
11
|
+
port = 1234
|
12
|
+
application = double(:application)
|
13
|
+
Rack::Handler.should_receive(:get).with("webrick").and_return(server)
|
14
|
+
server.should_receive(:run).with(application, hash_including(:Port => port))
|
15
|
+
Jasmine::Server.new(port, application).start
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
describe "rack >= 1.1" do
|
20
|
+
before do
|
21
|
+
Jasmine::Dependencies.stub(:legacy_rack?).and_return(false)
|
22
|
+
if !Rack.constants.include?(:Server)
|
23
|
+
Rack::Server = double("Rack::Server")
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
it "should create a Rack::Server with the correct port when passed" do
|
28
|
+
port = 1234
|
29
|
+
Rack::Server.should_receive(:new).with(hash_including(:Port => port)).and_return(double(:server).as_null_object)
|
30
|
+
Jasmine::Server.new(port).start
|
31
|
+
end
|
32
|
+
|
33
|
+
it "should start the server" do
|
34
|
+
server = double(:server)
|
35
|
+
Rack::Server.should_receive(:new) { server.as_null_object }
|
36
|
+
server.should_receive(:start)
|
37
|
+
Jasmine::Server.new.start
|
38
|
+
end
|
39
|
+
|
40
|
+
it "should set the app as the instance variable on the rack server" do
|
41
|
+
app = double('application')
|
42
|
+
server = double(:server)
|
43
|
+
Rack::Server.should_receive(:new) { server.as_null_object }
|
44
|
+
Jasmine::Server.new(1234, app).start
|
45
|
+
server.instance_variable_get(:@app).should == app
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
require "rubygems"
|
2
|
+
require "bundler"
|
3
|
+
require 'stringio'
|
4
|
+
require 'tmpdir'
|
5
|
+
|
6
|
+
envs = [:default, :development]
|
7
|
+
envs << :debug if ENV["DEBUG"]
|
8
|
+
Bundler.setup(*envs)
|
9
|
+
|
10
|
+
$:.unshift(File.expand_path(File.join(File.dirname(__FILE__), "../lib")))
|
11
|
+
require "jasmine"
|
12
|
+
|
13
|
+
if Jasmine::Dependencies.rspec2?
|
14
|
+
require 'rspec'
|
15
|
+
else
|
16
|
+
require 'spec'
|
17
|
+
end
|
18
|
+
|
19
|
+
|
20
|
+
def create_rails(name)
|
21
|
+
if Jasmine::Dependencies.rails3?
|
22
|
+
`rails new #{name}`
|
23
|
+
else
|
24
|
+
`rails #{name}`
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def create_temp_dir
|
29
|
+
tmp = File.join(Dir.tmpdir, "jasmine-gem-test_#{Time.now.to_f}")
|
30
|
+
FileUtils.rm_r(tmp, :force => true)
|
31
|
+
FileUtils.mkdir(tmp)
|
32
|
+
tmp
|
33
|
+
end
|
34
|
+
|
35
|
+
def temp_dir_before
|
36
|
+
@root = File.expand_path(File.join(File.dirname(__FILE__), ".."))
|
37
|
+
@old_dir = Dir::pwd
|
38
|
+
@tmp = create_temp_dir
|
39
|
+
end
|
40
|
+
|
41
|
+
def temp_dir_after
|
42
|
+
Dir::chdir @old_dir
|
43
|
+
FileUtils.rm_r @tmp
|
44
|
+
end
|
45
|
+
|
46
|
+
module Kernel
|
47
|
+
def capture_stdout
|
48
|
+
out = StringIO.new
|
49
|
+
$stdout = out
|
50
|
+
yield
|
51
|
+
return out.string
|
52
|
+
ensure
|
53
|
+
$stdout = STDOUT
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Jasmine::SprocketsMapper do
|
4
|
+
describe "mapping files" do
|
5
|
+
it "should retrieve asset paths from the the sprockets environment for passed files" do
|
6
|
+
src_files = ["assets/application.js", "assets/other_manifest.js"]
|
7
|
+
asset1 = double("asset1", :logical_path => "asset1.js")
|
8
|
+
asset2 = double("asset2", :logical_path => "asset2.js")
|
9
|
+
asset3 = double("asset3", :logical_path => "asset3.js")
|
10
|
+
asset_context = double("Sprockets::Environment")
|
11
|
+
asset_context.stub_chain(:find_asset).with("application").and_return([asset1, asset2])
|
12
|
+
asset_context.stub_chain(:find_asset).with("other_manifest").and_return([asset1, asset3])
|
13
|
+
mapper = Jasmine::SprocketsMapper.new(asset_context, 'some_location')
|
14
|
+
mapper.files(src_files).should == ['some_location/asset1.js?body=true', 'some_location/asset2.js?body=true', 'some_location/asset3.js?body=true']
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|