jasmine-sauce 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2011 Sauce Labs Inc
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1 @@
1
+ Glue for running your Jasmine tests in Sauce OnDemand
data/Rakefile ADDED
@@ -0,0 +1,19 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+ require 'rake/testtask'
4
+
5
+ Rake::TestTask.new(:test) do |test|
6
+ test.libs << 'lib'
7
+ test.pattern = 'test/test_*.rb'
8
+ test.verbose = true
9
+ end
10
+
11
+ task :build do
12
+ system "gem build jasmine-sauce.gemspec"
13
+ end
14
+
15
+ task :push => :build do
16
+ system "gem push `ls *.gem | sort | tail -n 1`"
17
+ end
18
+
19
+ task :default => :test
@@ -0,0 +1,18 @@
1
+ require 'rails/generators'
2
+
3
+ module Sauce
4
+ module Generators
5
+ class JasmineGenerator < ::Rails::Generators::Base
6
+ desc "Augment Jasmine to optionally use Sauce OnDemand"
7
+
8
+ def self.source_root
9
+ @source_root ||= File.expand_path(File.join(File.dirname(__FILE__), 'templates'))
10
+ end
11
+
12
+ def copy
13
+ directory "spec"
14
+ directory "lib"
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1 @@
1
+ load 'sauce/jasmine/jasmine-sauce.rake'
@@ -0,0 +1,19 @@
1
+ require 'rubygems'
2
+ require 'jasmine'
3
+ require 'sauce/jasmine'
4
+
5
+ jasmine_config_overrides = File.expand_path(File.join(File.dirname(__FILE__), 'jasmine_config.rb'))
6
+ require jasmine_config_overrides if File.exist?(jasmine_config_overrides)
7
+
8
+ jasmine_config = Sauce::Jasmine::Config.new
9
+ spec_builder = Jasmine::SpecBuilder.new(jasmine_config)
10
+
11
+ should_stop = false
12
+
13
+ RSpec.configuration.after(:suite) do
14
+ spec_builder.stop if should_stop
15
+ end
16
+
17
+ spec_builder.start
18
+ should_stop = true
19
+ spec_builder.declare_suites
@@ -0,0 +1 @@
1
+ require 'sauce/jasmine/config'
@@ -0,0 +1,14 @@
1
+ require 'jasmine/config'
2
+ require 'sauce/jasmine/selenium_driver'
3
+
4
+ module Sauce
5
+ module Jasmine
6
+ class Config < ::Jasmine::Config
7
+ def start
8
+ start_jasmine_server
9
+ @client = Sauce::Jasmine::SeleniumDriver.new(browser, jasmine_host, @jasmine_server_port)
10
+ @client.connect
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,13 @@
1
+ require 'rspec'
2
+ require 'rspec/core/rake_task'
3
+
4
+ namespace :jasmine do
5
+ namespace :ci do
6
+ desc 'Run Jasmine tests in the cloud'
7
+ RSpec::Core::RakeTask.new(:sauce) do |t|
8
+ t.rspec_opts = ["--colour", "--format", "progress"]
9
+ t.verbose = true
10
+ t.pattern = ['spec/javascripts/support/jasmine_sauce_runner.rb']
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,35 @@
1
+ require 'sauce'
2
+ require 'jasmine/selenium_driver'
3
+ module Sauce
4
+ module Jasmine
5
+ class SeleniumDriver < ::Jasmine::SeleniumDriver
6
+ def initialize(browser, host, port)
7
+ host = host[7..-1] if host =~ /^http:\/\//
8
+ @host = host
9
+ @port = port
10
+ @tunnel_domain = "#{rand(10000)}.jasmine.test"
11
+ @driver = Sauce::Selenium.new(:browser => browser,
12
+ :browser_url => "http://#{@tunnel_domain}",
13
+ :job_name => "Jasmine",
14
+ :'record-video' => false,
15
+ :'record-screenshots' => false)
16
+ end
17
+
18
+ def connect
19
+ puts "Setting up Sauce Connect..."
20
+ @connection = Sauce::Connect.new(:domain => @tunnel_domain,
21
+ :host => @host,
22
+ :port => @port,
23
+ :quiet => true)
24
+ @connection.wait_until_ready
25
+ puts "Sauce Connect ready."
26
+ super
27
+ end
28
+
29
+ def disconnect
30
+ @driver.stop
31
+ @connection.disconnect if @connection
32
+ end
33
+ end
34
+ end
35
+ end
metadata ADDED
@@ -0,0 +1,108 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jasmine-sauce
3
+ version: !ruby/object:Gem::Version
4
+ hash: 27
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 0
10
+ version: 0.1.0
11
+ platform: ruby
12
+ authors:
13
+ - Eric Allen
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-02-17 00:00:00 -08:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: sauce
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 91
30
+ segments:
31
+ - 0
32
+ - 16
33
+ - 2
34
+ version: 0.16.2
35
+ type: :runtime
36
+ version_requirements: *id001
37
+ - !ruby/object:Gem::Dependency
38
+ name: jasmine
39
+ prerelease: false
40
+ requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ hash: 89
46
+ segments:
47
+ - 1
48
+ - 0
49
+ - 1
50
+ - 1
51
+ version: 1.0.1.1
52
+ type: :runtime
53
+ version_requirements: *id002
54
+ description: Adapter to run Jasmine tests using browsers in Sauce OnDemand
55
+ email: eric@hackerengineer.net
56
+ executables: []
57
+
58
+ extensions: []
59
+
60
+ extra_rdoc_files: []
61
+
62
+ files:
63
+ - LICENSE
64
+ - README.md
65
+ - Rakefile
66
+ - lib/generators/sauce/jasmine/jasmine_generator.rb
67
+ - lib/generators/sauce/jasmine/templates/lib/tasks/jasmine-sauce.rake
68
+ - lib/generators/sauce/jasmine/templates/spec/javascripts/support/jasmine_sauce_runner.rb
69
+ - lib/sauce/jasmine/config.rb
70
+ - lib/sauce/jasmine/jasmine-sauce.rake
71
+ - lib/sauce/jasmine/selenium_driver.rb
72
+ - lib/sauce/jasmine.rb
73
+ has_rdoc: true
74
+ homepage: http://github.com/saucelabs/jasmine-sauce
75
+ licenses: []
76
+
77
+ post_install_message:
78
+ rdoc_options: []
79
+
80
+ require_paths:
81
+ - lib
82
+ required_ruby_version: !ruby/object:Gem::Requirement
83
+ none: false
84
+ requirements:
85
+ - - ">="
86
+ - !ruby/object:Gem::Version
87
+ hash: 3
88
+ segments:
89
+ - 0
90
+ version: "0"
91
+ required_rubygems_version: !ruby/object:Gem::Requirement
92
+ none: false
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ hash: 3
97
+ segments:
98
+ - 0
99
+ version: "0"
100
+ requirements: []
101
+
102
+ rubyforge_project:
103
+ rubygems_version: 1.4.2
104
+ signing_key:
105
+ specification_version: 3
106
+ summary: Jasmine + Sauce OnDemand
107
+ test_files: []
108
+