jasmine 1.3.2 → 2.0.0.rc2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +7 -0
  2. data/.travis.yml +3 -37
  3. data/Gemfile +11 -2
  4. data/HOW_TO_TEST.markdown +1 -1
  5. data/README.markdown +10 -10
  6. data/Rakefile +18 -29
  7. data/generators/jasmine/templates/jasmine-example/spec/PlayerSpec.js +2 -2
  8. data/generators/jasmine/templates/jasmine-example/spec/SpecHelper.js +14 -8
  9. data/generators/jasmine/templates/spec/javascripts/support/jasmine.yml +3 -3
  10. data/generators/jasmine/templates/spec/javascripts/support/jasmine_helper.rb +1 -0
  11. data/jasmine.gemspec +11 -41
  12. data/lib/generators/jasmine/examples/templates/spec/javascripts/helpers/SpecHelper.js +15 -9
  13. data/lib/generators/jasmine/examples/templates/spec/javascripts/jasmine_examples/PlayerSpec.js +1 -1
  14. data/lib/jasmine.rb +10 -7
  15. data/lib/jasmine/asset_bundle.rb +69 -0
  16. data/lib/jasmine/asset_expander.rb +7 -7
  17. data/lib/jasmine/command_line_tool.rb +18 -0
  18. data/lib/jasmine/config.rb +23 -15
  19. data/lib/jasmine/configuration.rb +14 -8
  20. data/lib/jasmine/core_configuration.rb +7 -4
  21. data/lib/jasmine/dependencies.rb +14 -18
  22. data/lib/jasmine/formatters/base.rb +9 -0
  23. data/lib/jasmine/formatters/console.rb +45 -0
  24. data/lib/jasmine/formatters/junit_xml.rb +47 -0
  25. data/lib/jasmine/path_expander.rb +1 -1
  26. data/lib/jasmine/railtie.rb +7 -6
  27. data/lib/jasmine/reporters/api_reporter.rb +38 -0
  28. data/lib/jasmine/results.rb +28 -9
  29. data/lib/jasmine/results_processor.rb +1 -1
  30. data/lib/jasmine/run.html.erb +1 -1
  31. data/lib/jasmine/run_specs.rb +12 -15
  32. data/lib/jasmine/runners/http.rb +11 -49
  33. data/lib/jasmine/selenium_driver.rb +17 -14
  34. data/lib/jasmine/tasks/jasmine.rake +21 -30
  35. data/lib/jasmine/tasks/{jasmine_rails3.rake → jasmine_rails.rake} +0 -0
  36. data/lib/jasmine/version.rb +1 -1
  37. data/lib/jasmine/yaml_config_parser.rb +9 -0
  38. data/release_notes/v2.0.0.rc2.md +44 -0
  39. data/spec/application_spec.rb +33 -38
  40. data/spec/asset_expander_spec.rb +4 -32
  41. data/spec/configuration_spec.rb +95 -35
  42. data/spec/jasmine_command_line_tool_spec.rb +63 -11
  43. data/spec/jasmine_rails_spec.rb +94 -0
  44. data/spec/lib/jasmine/formatters/base_spec.rb +9 -0
  45. data/spec/lib/jasmine/formatters/console_spec.rb +92 -0
  46. data/spec/lib/jasmine/formatters/junit_xml_spec.rb +55 -0
  47. data/spec/lib/jasmine/reporters/api_reporter_spec.rb +53 -0
  48. data/spec/lib/jasmine/runners/http_spec.rb +21 -0
  49. data/spec/path_expander_spec.rb +25 -0
  50. data/spec/results_spec.rb +59 -17
  51. data/spec/spec_helper.rb +36 -18
  52. data/spec/support/fake_selenium_driver.rb +35 -0
  53. data/spec/yaml_config_parser_spec.rb +37 -0
  54. metadata +65 -103
  55. data/generators/jasmine/templates/jasmine-example/SpecRunner.html +0 -54
  56. data/lib/jasmine/asset_pipeline_utility.rb +0 -19
  57. data/lib/jasmine/javascripts/boot.js +0 -28
  58. data/lib/jasmine/rspec_formatter.rb +0 -92
  59. data/spec/dependencies_spec.rb +0 -315
  60. data/spec/jasmine_rails2_spec.rb +0 -89
  61. data/spec/jasmine_rails3_spec.rb +0 -69
  62. data/spec/jasmine_self_test_spec.rb +0 -29
  63. data/spec/rspec_formatter_spec.rb +0 -88
@@ -1,89 +0,0 @@
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
@@ -1,69 +0,0 @@
1
- require 'spec_helper'
2
-
3
- if Jasmine::Dependencies.rails3?
4
-
5
- describe "A Rails 3 app" do
6
-
7
- before :each do
8
- temp_dir_before
9
- Dir::chdir @tmp
10
-
11
- create_rails 'rails-example'
12
- Dir::chdir 'rails-example'
13
- open('Gemfile', 'a') { |f| f.puts "gem \"jasmine\", \"#{Jasmine::VERSION}\"" }
14
- end
15
-
16
- after :each do
17
- temp_dir_after
18
- end
19
-
20
- context "when Jasmine has been required" do
21
- it "should show the Jasmine generators" do
22
- output = `rails g`
23
- output.should include("jasmine:install")
24
- output.should include("jasmine:examples")
25
- end
26
-
27
- it "should show jasmine:install help" do
28
- output = `rails g jasmine:install --help`
29
- output.should include("rails generate jasmine:install")
30
- end
31
-
32
- it "should have the jasmine rake task" do
33
- output = `rake -T`
34
- output.should include("jasmine ")
35
- end
36
-
37
- it "should have the jasmine:ci rake task" do
38
- output = `rake -T`
39
- output.should include("jasmine:ci")
40
- end
41
-
42
- context "and then installed" do
43
- before :each do
44
- @output = `rails g jasmine:install`
45
- end
46
-
47
- it "should have the Jasmine config files" do
48
- @output.should include("create")
49
-
50
- File.exists?("spec/javascripts/helpers/.gitkeep").should == true
51
- File.exists?("spec/javascripts/support/jasmine.yml").should == true
52
- end
53
- end
54
-
55
- context "and the jasmine examples have been installed" do
56
- it "should find the Jasmine example files" do
57
- output = `rails g jasmine:examples`
58
- output.should include("create")
59
-
60
- File.exists?("app/assets/javascripts/jasmine_examples/Player.js").should == true
61
- File.exists?("app/assets/javascripts/jasmine_examples/Song.js").should == true
62
-
63
- File.exists?("spec/javascripts/jasmine_examples/PlayerSpec.js").should == true
64
- File.exists?("spec/javascripts/helpers/SpecHelper.js").should == true
65
- end
66
- end
67
- end
68
- end
69
- end
@@ -1,29 +0,0 @@
1
- require 'spec_helper'
2
-
3
- Jasmine.configure do |config|
4
- root = File.expand_path(File.join(File.dirname(__FILE__), ".."))
5
- config.src_dir = File.join(root, 'src')
6
- config.spec_dir = Jasmine::Core.path
7
- config.spec_files = lambda { (Jasmine::Core.html_spec_files + Jasmine::Core.core_spec_files).map {|f| File.join(config.spec_dir, f) } }
8
- end
9
-
10
- config = Jasmine.config
11
-
12
- server = Jasmine::Server.new(config.port, Jasmine::Application.app(config))
13
- driver = Jasmine::SeleniumDriver.new(config.browser, "#{config.host}:#{config.port}/")
14
-
15
- t = Thread.new do
16
- begin
17
- server.start
18
- rescue ChildProcess::TimeoutError
19
- end
20
- # # ignore bad exits
21
- end
22
- t.abort_on_exception = true
23
- Jasmine::wait_for_listener(config.port, "jasmine server")
24
- puts "jasmine server started."
25
-
26
- results_processor = Jasmine::ResultsProcessor.new(config)
27
- results = Jasmine::Runners::HTTP.new(driver, results_processor, config.result_batch_size).run
28
- formatter = Jasmine::RspecFormatter.new
29
- formatter.format_results(results)
@@ -1,88 +0,0 @@
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