jasmine-multi_json 1.3.1.1
Sign up to get free protection for your applications and to get access to all the features.
- 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 +62 -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 +74 -0
- data/jasmine.gemspec +74 -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.rb +31 -0
- data/lib/jasmine/application.rb +21 -0
- data/lib/jasmine/asset_expander.rb +19 -0
- data/lib/jasmine/asset_pipeline_mapper.rb +16 -0
- data/lib/jasmine/asset_pipeline_utility.rb +19 -0
- data/lib/jasmine/base.rb +54 -0
- data/lib/jasmine/command_line_tool.rb +70 -0
- data/lib/jasmine/config.rb +85 -0
- data/lib/jasmine/configuration.rb +83 -0
- data/lib/jasmine/core_configuration.rb +28 -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/javascripts/boot.js +28 -0
- data/lib/jasmine/page.rb +11 -0
- data/lib/jasmine/path_expander.rb +18 -0
- data/lib/jasmine/path_mapper.rb +29 -0
- data/lib/jasmine/railtie.rb +21 -0
- data/lib/jasmine/results.rb +19 -0
- data/lib/jasmine/results_processor.rb +38 -0
- data/lib/jasmine/rspec_formatter.rb +92 -0
- data/lib/jasmine/run.html.erb +18 -0
- data/lib/jasmine/run_specs.rb +36 -0
- data/lib/jasmine/runners/http.rb +71 -0
- data/lib/jasmine/selenium_driver.rb +41 -0
- data/lib/jasmine/server.rb +20 -0
- data/lib/jasmine/tasks/jasmine.rake +55 -0
- data/lib/jasmine/tasks/jasmine_rails3.rake +1 -0
- data/lib/jasmine/version.rb +3 -0
- data/lib/jasmine/yaml_config_parser.rb +54 -0
- data/lib/rack/jasmine/cache_control.rb +20 -0
- data/lib/rack/jasmine/focused_suite.rb +17 -0
- data/lib/rack/jasmine/runner.rb +27 -0
- data/spec/application_integration_spec.rb +15 -0
- data/spec/application_spec.rb +44 -0
- data/spec/asset_expander_spec.rb +42 -0
- data/spec/asset_pipeline_mapper_spec.rb +19 -0
- data/spec/base_spec.rb +14 -0
- data/spec/configuration_spec.rb +163 -0
- data/spec/dependencies_spec.rb +315 -0
- data/spec/fixture/Rakefile +4 -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_spec.rb +29 -0
- data/spec/page_spec.rb +23 -0
- data/spec/path_expander_spec.rb +96 -0
- data/spec/path_mapper_spec.rb +33 -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/server_spec.rb +48 -0
- data/spec/spec_helper.rb +55 -0
- data/spec/yaml_config_parser_spec.rb +182 -0
- metadata +310 -0
@@ -0,0 +1,315 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
#rspec 1 fails to stub respond_to
|
4
|
+
if Jasmine::Dependencies.rspec2?
|
5
|
+
describe Jasmine::Dependencies do
|
6
|
+
module Rails
|
7
|
+
end
|
8
|
+
|
9
|
+
context "with ruby_gems > 1.8" do
|
10
|
+
before do
|
11
|
+
Gem::Specification.should_receive(:respond_to?).with(:find_by_name).and_return(true)
|
12
|
+
end
|
13
|
+
|
14
|
+
describe ".rspec2?" do
|
15
|
+
subject { Jasmine::Dependencies.rspec2? }
|
16
|
+
context "when rspec 2 is present" do
|
17
|
+
before do
|
18
|
+
Gem::Specification.should_receive(:find_by_name).with("rspec", ">= 2.0").and_return(true)
|
19
|
+
end
|
20
|
+
it { should be_true }
|
21
|
+
end
|
22
|
+
context "when rspec 2 is not present" do
|
23
|
+
before do
|
24
|
+
Gem::Specification.should_receive(:find_by_name).with("rspec", ">= 2.0").and_raise(Gem::LoadError)
|
25
|
+
end
|
26
|
+
it { should be_false }
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
describe ".rails2?" do
|
31
|
+
subject { Jasmine::Dependencies.rails2? }
|
32
|
+
context "when rails 2 is present and running" do
|
33
|
+
before do
|
34
|
+
Gem::Specification.should_receive(:find_by_name).with("rails", "~> 2.3").and_return(true)
|
35
|
+
Rails.stub(:respond_to?).with(:version).and_return(true)
|
36
|
+
Rails.stub(:version).and_return(running_rails_version)
|
37
|
+
end
|
38
|
+
let(:running_rails_version) { "2.3.11" }
|
39
|
+
it { should be_true }
|
40
|
+
end
|
41
|
+
context "when rails 2 is present but not running" do
|
42
|
+
before do
|
43
|
+
Gem::Specification.should_receive(:find_by_name).with("rails", "~> 2.3").and_raise(Gem::LoadError)
|
44
|
+
end
|
45
|
+
it { should be_false }
|
46
|
+
end
|
47
|
+
context "when rails 2 is not present" do
|
48
|
+
before do
|
49
|
+
Gem::Specification.should_receive(:find_by_name).with("rails", "~> 2.3").and_raise(Gem::LoadError)
|
50
|
+
end
|
51
|
+
it { should be_false }
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
describe ".legacy_rails?" do
|
56
|
+
subject { Jasmine::Dependencies.legacy_rails? }
|
57
|
+
context "when rails < 2.3.11 is present and running" do
|
58
|
+
before do
|
59
|
+
Gem::Specification.should_receive(:find_by_name).with("rails", "< 2.3.11").and_return(true)
|
60
|
+
Rails.stub(:respond_to?).with(:version).and_return(true)
|
61
|
+
Rails.stub(:version).and_return(running_rails_version)
|
62
|
+
end
|
63
|
+
let(:running_rails_version) { "2.3.8" }
|
64
|
+
it { should be_true }
|
65
|
+
end
|
66
|
+
context "when rails < 2.3.11 is present but not running" do
|
67
|
+
before do
|
68
|
+
Gem::Specification.should_receive(:find_by_name).with("rails", "< 2.3.11").and_return(true)
|
69
|
+
end
|
70
|
+
it { should be_false }
|
71
|
+
end
|
72
|
+
context "when rails < 2.3.11 is not present" do
|
73
|
+
before do
|
74
|
+
Gem::Specification.should_receive(:find_by_name).with("rails", "< 2.3.11").and_raise(Gem::LoadError)
|
75
|
+
end
|
76
|
+
it { should be_false }
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
describe ".rails3?" do
|
81
|
+
subject { Jasmine::Dependencies.rails3? }
|
82
|
+
context "when rails 3 is present and running" do
|
83
|
+
before do
|
84
|
+
Gem::Specification.should_receive(:find_by_name).with("rails", ">= 3.0").and_return(true)
|
85
|
+
Rails.stub(:respond_to?).with(:version).and_return(true)
|
86
|
+
Rails.stub(:version).and_return(running_rails_version)
|
87
|
+
end
|
88
|
+
let(:running_rails_version) { "3.2" }
|
89
|
+
it { should be_true }
|
90
|
+
end
|
91
|
+
context "when rails 3 is present but not running" do
|
92
|
+
before do
|
93
|
+
Gem::Specification.should_receive(:find_by_name).with("rails", ">= 3.0").and_return(true)
|
94
|
+
end
|
95
|
+
it { should be_false }
|
96
|
+
end
|
97
|
+
context "when rails 3 is not present" do
|
98
|
+
before do
|
99
|
+
Gem::Specification.should_receive(:find_by_name).with("rails", ">= 3.0").and_raise(Gem::LoadError)
|
100
|
+
end
|
101
|
+
it { should be_false }
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
describe ".rails_3_asset_pipeline?" do
|
106
|
+
subject { Jasmine::Dependencies.rails_3_asset_pipeline? }
|
107
|
+
let(:application) { double(:application) }
|
108
|
+
let(:running_rails_version) { "3.2" }
|
109
|
+
before do
|
110
|
+
Rails.stub(:respond_to?).with(:application).and_return(respond_to_application)
|
111
|
+
Rails.stub(:application).and_return(application)
|
112
|
+
Rails.stub(:respond_to?).with(:version).and_return(true)
|
113
|
+
Rails.stub(:version).and_return(running_rails_version)
|
114
|
+
end
|
115
|
+
context "when rails 3 is present and the application pipeline is in use" do
|
116
|
+
before do
|
117
|
+
Gem::Specification.should_receive(:find_by_name).with("rails", ">= 3.0").and_return(true)
|
118
|
+
application.stub(:assets).and_return(rails_application_assets)
|
119
|
+
end
|
120
|
+
let(:rails3_present) { true }
|
121
|
+
let(:respond_to_application) { true }
|
122
|
+
let(:rails_application_assets) { true }
|
123
|
+
it { should be_true }
|
124
|
+
end
|
125
|
+
context "when rails 3 is present and the application pipeline is not in use" do
|
126
|
+
before do
|
127
|
+
Gem::Specification.should_receive(:find_by_name).with("rails", ">= 3.0").and_return(true)
|
128
|
+
application.stub(:assets).and_return(rails_application_assets)
|
129
|
+
end
|
130
|
+
let(:rails3_present) { true }
|
131
|
+
let(:respond_to_application) { true }
|
132
|
+
let(:rails_application_assets) { false }
|
133
|
+
it { should be_false }
|
134
|
+
end
|
135
|
+
context "when rails 3 is present but not loaded" do
|
136
|
+
before do
|
137
|
+
Gem::Specification.should_receive(:find_by_name).with("rails", ">= 3.0").and_return(true)
|
138
|
+
application.stub(:assets).and_return(rails_application_assets)
|
139
|
+
end
|
140
|
+
let(:rails3_present) { true }
|
141
|
+
let(:respond_to_application) { false }
|
142
|
+
let(:rails_application_assets) { false }
|
143
|
+
it { should be_false }
|
144
|
+
end
|
145
|
+
context "when rails 3 is present but doesn't respond to assets" do
|
146
|
+
before do
|
147
|
+
Gem::Specification.should_receive(:find_by_name).with("rails", ">= 3.0").and_return(true)
|
148
|
+
end
|
149
|
+
let(:rails3_present) { true }
|
150
|
+
let(:respond_to_application) { true }
|
151
|
+
it { should be_false }
|
152
|
+
end
|
153
|
+
context "when rails 3 is not present" do
|
154
|
+
before do
|
155
|
+
Gem::Specification.should_receive(:find_by_name).with("rails", ">= 3.0").and_raise(Gem::LoadError)
|
156
|
+
end
|
157
|
+
let(:rails3_present) { false }
|
158
|
+
let(:respond_to_application) { false }
|
159
|
+
let(:rails_application_assets) { false }
|
160
|
+
it { should be_false }
|
161
|
+
end
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
165
|
+
context "with ruby_gems < 1.8" do
|
166
|
+
before do
|
167
|
+
Gem::Specification.should_receive(:respond_to?).with(:find_by_name).and_return(false)
|
168
|
+
end
|
169
|
+
|
170
|
+
describe ".rspec2?" do
|
171
|
+
subject { Jasmine::Dependencies.rspec2? }
|
172
|
+
before do
|
173
|
+
Gem.should_receive(:available?).with("rspec", ">= 2.0").and_return(rspec2_present)
|
174
|
+
end
|
175
|
+
context "when rspec 2 is present" do
|
176
|
+
let(:rspec2_present) { true }
|
177
|
+
it { should be_true }
|
178
|
+
end
|
179
|
+
context "when rspec 2 is not present" do
|
180
|
+
let(:rspec2_present) { false }
|
181
|
+
it { should be_false }
|
182
|
+
end
|
183
|
+
end
|
184
|
+
|
185
|
+
describe ".rails2?" do
|
186
|
+
subject { Jasmine::Dependencies.rails2? }
|
187
|
+
before do
|
188
|
+
Gem.should_receive(:available?).with("rails", "~> 2.3").and_return(rails2_present)
|
189
|
+
end
|
190
|
+
context "when rails 2 is present and running" do
|
191
|
+
before do
|
192
|
+
Rails.stub(:respond_to?).with(:version).and_return(true)
|
193
|
+
Rails.stub(:version).and_return(running_rails_version)
|
194
|
+
end
|
195
|
+
|
196
|
+
let(:running_rails_version) { "2.3" }
|
197
|
+
let(:rails2_present) { true }
|
198
|
+
it { should be_true }
|
199
|
+
end
|
200
|
+
context "when rails 2 is present but not running" do
|
201
|
+
before do
|
202
|
+
Rails.stub(:respond_to?).with(:version).and_return(true)
|
203
|
+
Rails.stub(:version).and_return(running_rails_version)
|
204
|
+
end
|
205
|
+
|
206
|
+
let(:running_rails_version) { "3.2" }
|
207
|
+
let(:rails2_present) { true }
|
208
|
+
it { should be_false }
|
209
|
+
end
|
210
|
+
context "when rails 2 is not present" do
|
211
|
+
let(:rails2_present) { false }
|
212
|
+
it { should be_false }
|
213
|
+
end
|
214
|
+
end
|
215
|
+
|
216
|
+
describe ".legacy_rails?" do
|
217
|
+
subject { Jasmine::Dependencies.legacy_rails? }
|
218
|
+
before do
|
219
|
+
Gem.should_receive(:available?).with("rails", "< 2.3.11").and_return(legacy_rails_present)
|
220
|
+
end
|
221
|
+
context "when rails < 2.3.11 is present and running" do
|
222
|
+
before do
|
223
|
+
Rails.stub(:respond_to?).with(:version).and_return(true)
|
224
|
+
Rails.stub(:version).and_return(running_rails_version)
|
225
|
+
end
|
226
|
+
let(:running_rails_version) { "2.3.8" }
|
227
|
+
let(:legacy_rails_present) { true }
|
228
|
+
it { should be_true }
|
229
|
+
end
|
230
|
+
|
231
|
+
context "when rails < 2.3.11 is present but not running" do
|
232
|
+
let(:legacy_rails_present) { true }
|
233
|
+
it { should be_false }
|
234
|
+
end
|
235
|
+
|
236
|
+
context "when rails < 2.3.11 is not present" do
|
237
|
+
let(:legacy_rails_present) { false }
|
238
|
+
it { should be_false }
|
239
|
+
end
|
240
|
+
end
|
241
|
+
|
242
|
+
describe ".rails3?" do
|
243
|
+
subject { Jasmine::Dependencies.rails3? }
|
244
|
+
before do
|
245
|
+
Gem.should_receive(:available?).with("rails", ">= 3.0").and_return(rails3_present)
|
246
|
+
end
|
247
|
+
context "when rails 3 is present" do
|
248
|
+
before do
|
249
|
+
Rails.stub(:respond_to?).with(:version).and_return(true)
|
250
|
+
Rails.stub(:version).and_return(running_rails_version)
|
251
|
+
end
|
252
|
+
let(:running_rails_version) { "3.2" }
|
253
|
+
let(:rails3_present) { true }
|
254
|
+
it { should be_true }
|
255
|
+
end
|
256
|
+
context "when rails 3 is not present" do
|
257
|
+
let(:rails3_present) { false }
|
258
|
+
it { should be_false }
|
259
|
+
end
|
260
|
+
end
|
261
|
+
|
262
|
+
describe ".rails_3_asset_pipeline?" do
|
263
|
+
subject { Jasmine::Dependencies.rails_3_asset_pipeline? }
|
264
|
+
let(:application) { double(:application, :assets => rails_application_assets)}
|
265
|
+
before do
|
266
|
+
Gem.should_receive(:available?).with("rails", ">= 3.0").and_return(rails3_present)
|
267
|
+
Rails.stub(:respond_to?).with(:application).and_return(respond_to_application)
|
268
|
+
Rails.stub(:respond_to?).with(:version).and_return(true)
|
269
|
+
Rails.stub(:application).and_return(application)
|
270
|
+
end
|
271
|
+
|
272
|
+
context "when rails 3 is present, running, and the application pipeline is in use" do
|
273
|
+
before do
|
274
|
+
Rails.stub(:respond_to?).with(:version).and_return(true)
|
275
|
+
Rails.stub(:version).and_return(running_rails_version)
|
276
|
+
end
|
277
|
+
let(:rails3_present) { true }
|
278
|
+
let(:running_rails_version) { "3.2" }
|
279
|
+
let(:respond_to_application) { true }
|
280
|
+
let(:rails_application_assets) { true }
|
281
|
+
it { should be_true }
|
282
|
+
end
|
283
|
+
context "when rails 3 is present, running, and the application pipeline is not in use" do
|
284
|
+
before do
|
285
|
+
Rails.stub(:respond_to?).with(:version).and_return(true)
|
286
|
+
Rails.stub(:version).and_return(running_rails_version)
|
287
|
+
end
|
288
|
+
let(:rails3_present) { true }
|
289
|
+
let(:running_rails_version) { "3.2" }
|
290
|
+
let(:respond_to_application) { true }
|
291
|
+
let(:rails_application_assets) { false }
|
292
|
+
it { should be_false }
|
293
|
+
end
|
294
|
+
context "when rails 3 is present but not loaded" do
|
295
|
+
before do
|
296
|
+
Rails.stub(:respond_to?).with(:version).and_return(false)
|
297
|
+
end
|
298
|
+
let(:rails3_present) { true }
|
299
|
+
let(:respond_to_application) { false }
|
300
|
+
let(:rails_application_assets) { false }
|
301
|
+
it { should be_false }
|
302
|
+
end
|
303
|
+
context "when rails 3 is not present" do
|
304
|
+
before do
|
305
|
+
Rails.stub(:respond_to?).with(:version).and_return(false)
|
306
|
+
end
|
307
|
+
let(:rails3_present) { false }
|
308
|
+
let(:respond_to_application) { false }
|
309
|
+
let(:rails_application_assets) { false }
|
310
|
+
it { should be_false }
|
311
|
+
end
|
312
|
+
end
|
313
|
+
end
|
314
|
+
end
|
315
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "Jasmine command line tool" do
|
4
|
+
context "when rake has not been required yet" do
|
5
|
+
before :each do
|
6
|
+
temp_dir_before
|
7
|
+
Dir::chdir @tmp
|
8
|
+
end
|
9
|
+
|
10
|
+
after :each do
|
11
|
+
temp_dir_after
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should append to an existing Rakefile" do
|
15
|
+
FileUtils.cp("#{@old_dir}/spec/fixture/Rakefile", @tmp)
|
16
|
+
output = capture_stdout { Jasmine::CommandLineTool.new.process ["init"] }
|
17
|
+
output.should =~ /Jasmine has been installed with example specs./
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "Jasmine command line tool" do
|
4
|
+
before :each do
|
5
|
+
temp_dir_before
|
6
|
+
Dir::chdir @tmp
|
7
|
+
end
|
8
|
+
|
9
|
+
after :each do
|
10
|
+
temp_dir_after
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should create files on init" do
|
14
|
+
output = capture_stdout { Jasmine::CommandLineTool.new.process ["init"] }
|
15
|
+
output.should =~ /Jasmine has been installed with example specs./
|
16
|
+
|
17
|
+
my_jasmine_lib = File.expand_path(File.join(@root, "lib"))
|
18
|
+
bootstrap = "$:.unshift('#{my_jasmine_lib}')"
|
19
|
+
|
20
|
+
ENV['JASMINE_GEM_PATH'] = "#{@root}/lib"
|
21
|
+
ci_output = `rake -E "#{bootstrap}" --trace jasmine:ci`
|
22
|
+
ci_output.should =~ (/[1-9][0-9]* examples, 0 failures/)
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should include license info" do
|
26
|
+
output = capture_stdout { Jasmine::CommandLineTool.new.process ["license"] }
|
27
|
+
output.should =~ /Copyright/
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "POJS jasmine install" do
|
4
|
+
|
5
|
+
before :each do
|
6
|
+
temp_dir_before
|
7
|
+
Dir::chdir @tmp
|
8
|
+
@install_directory = 'pojs-example'
|
9
|
+
Dir::mkdir @install_directory
|
10
|
+
Dir::chdir @install_directory
|
11
|
+
end
|
12
|
+
|
13
|
+
after :each do
|
14
|
+
temp_dir_after
|
15
|
+
end
|
16
|
+
|
17
|
+
context "when the Jasmine generators are available" do
|
18
|
+
before :each do
|
19
|
+
`jasmine init`
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should find the Jasmine configuration files" do
|
23
|
+
File.exists?("spec/javascripts/support/jasmine.yml").should == true
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should find the Jasmine example files" do
|
27
|
+
File.exists?("public/javascripts/Player.js").should == true
|
28
|
+
File.exists?("public/javascripts/Song.js").should == true
|
29
|
+
|
30
|
+
File.exists?("spec/javascripts/PlayerSpec.js").should == true
|
31
|
+
File.exists?("spec/javascripts/helpers/SpecHelper.js").should == true
|
32
|
+
|
33
|
+
File.exists?("spec/javascripts/support/jasmine.yml").should == true
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should show jasmine rake task" do
|
37
|
+
output = `rake -T`
|
38
|
+
output.should include("jasmine ")
|
39
|
+
output.should include("jasmine:ci")
|
40
|
+
end
|
41
|
+
|
42
|
+
it "should successfully run rake jasmine:ci" do
|
43
|
+
output = `rake jasmine:ci`
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,89 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
if Jasmine::Dependencies.rails2? && !Jasmine::Dependencies.legacy_rails?
|
4
|
+
|
5
|
+
describe "A Rails 2 app" do
|
6
|
+
|
7
|
+
before :each do
|
8
|
+
temp_dir_before
|
9
|
+
Dir::chdir @tmp
|
10
|
+
create_rails 'rails-example'
|
11
|
+
Dir::chdir 'rails-example'
|
12
|
+
end
|
13
|
+
|
14
|
+
after :each do
|
15
|
+
temp_dir_after
|
16
|
+
end
|
17
|
+
|
18
|
+
context "before Jasmine has been installed" do
|
19
|
+
|
20
|
+
it "should not show the jasmine:install generator" do
|
21
|
+
output = `./script/generate --help`
|
22
|
+
output.should_not include('jasmine:install')
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should not show jasmine:install help" do
|
26
|
+
output = `rails g`
|
27
|
+
output.should_not include('This will create')
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should not show jasmine rake task" do
|
31
|
+
output = `rake -T`
|
32
|
+
output.should_not include("jasmine ")
|
33
|
+
end
|
34
|
+
|
35
|
+
it "should not show jasmine:ci rake task" do
|
36
|
+
output = `rake -T`
|
37
|
+
output.should_not include("jasmine:ci")
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
|
42
|
+
context "when the Jasmine generators are available" do
|
43
|
+
before :each do
|
44
|
+
`mkdir -p lib/generators && ln -s #{@root}/generators/jasmine lib/generators/jasmine`
|
45
|
+
end
|
46
|
+
|
47
|
+
it "should show the Jasmine generator" do
|
48
|
+
output = `./script/generate --help`
|
49
|
+
output.should include("Lib: jasmine")
|
50
|
+
end
|
51
|
+
|
52
|
+
it "should show jasmine:install help" do
|
53
|
+
output = `./script/generate jasmine --help`
|
54
|
+
|
55
|
+
output.should include("Usage: ./script/generate jasmine")
|
56
|
+
end
|
57
|
+
|
58
|
+
context "and been run" do
|
59
|
+
before :each do
|
60
|
+
`./script/generate jasmine`
|
61
|
+
end
|
62
|
+
|
63
|
+
it "should find the Jasmine configuration files" do
|
64
|
+
File.exists?("spec/javascripts/support/jasmine.yml").should == true
|
65
|
+
end
|
66
|
+
|
67
|
+
it "should find the Jasmine example files" do
|
68
|
+
File.exists?("public/javascripts/Player.js").should == true
|
69
|
+
File.exists?("public/javascripts/Song.js").should == true
|
70
|
+
|
71
|
+
File.exists?("spec/javascripts/PlayerSpec.js").should == true
|
72
|
+
File.exists?("spec/javascripts/helpers/SpecHelper.js").should == true
|
73
|
+
|
74
|
+
File.exists?("spec/javascripts/support/jasmine.yml").should == true
|
75
|
+
end
|
76
|
+
|
77
|
+
it "should show jasmine rake task" do
|
78
|
+
output = `rake -T`
|
79
|
+
output.should include("jasmine ")
|
80
|
+
end
|
81
|
+
|
82
|
+
it "should show jasmine:ci rake task" do
|
83
|
+
output = `rake -T`
|
84
|
+
output.should include("jasmine:ci")
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|