Permalink
Browse files

Merge pull request #174 from wanelo/master

Support Jasmine 1.3.2
  • Loading branch information...
2 parents 264180c + 36e140c commit 5f0c709b1f2047eb6d582142b1c62f3a3b5b27dd @DylanLacey DylanLacey committed Nov 19, 2013
View
@@ -8,7 +8,7 @@ gem 'pry'
group :test do
gem 'cucumber'
- gem 'jasmine', '~> 1.2.0.0'
+ gem 'jasmine', '~> 1.3'
gem 'sauce-connect', :path => './gems/sauce-connect'
gem 'simplecov'
end
@@ -1,37 +1,28 @@
require 'jasmine'
-module Sauce
- module Jasmine
- class Driver < ::Jasmine::SeleniumDriver
- attr_reader :http_address, :driver, :browser
+module Jasmine
+ class SeleniumDriver
+ attr_reader :http_address, :driver, :browser
+
+ def initialize(browser, http_address)
+ @browser = browser
+ @http_address = http_address
+ name = job_name
- def initialize(browser, http_address)
- @browser = browser
- @http_address = http_address
- name = job_name
-
- @driver = Sauce::Selenium2.new(:job_name => job_name)
- puts "Starting job named: #{job_name}"
- end
+ @driver = Sauce::Selenium2.new(:browser => ENV['SAUCE_BROWSER'], :job_name => job_name)
+ puts "Starting job named: #{job_name}"
+ end
- def job_name
- "Jasmine Test Run #{Time.now.utc.to_i}"
- end
+ def job_name
+ "Jasmine Test Run #{Time.now.utc.to_i}"
end
end
end
module Jasmine
- class Config
- def jasmine_port
- '3001'
- end
-
- def start
- @client = ::Sauce::Jasmine::Driver.new(browser, "#{jasmine_host}:#{jasmine_port}/")
- @client.connect
+ class Configuration
+ def port
+ 3001
end
end
end
-
-
@@ -2,21 +2,14 @@
require 'rspec/core/rake_task'
namespace :jasmine do
- def run_jasmine_server
- ENV['JASMINE_PORT'] = '3001'
- Jasmine::Config.new.start_jasmine_server
- end
-
desc "Execute Jasmine tests in a Chrome browser on Sauce Labs"
task :sauce do
- run_jasmine_server
Rake::Task['jasmine:sauce:chrome'].execute
end
namespace :sauce do
desc "Execute Jasmine tests in Chrome, Firefox and Internet Explorer on Sauce Labs"
task :all do
- run_jasmine_server
threads = []
[:firefox, :chrome, :iexplore].each do |browser|
t = Thread.new do
@@ -1,4 +1,3 @@
require 'sauce'
require 'sauce/jasmine'
-ENV['JASMINE_PORT'] = '3001'
-require 'jasmine/runner'
+require 'jasmine/run_specs'
@@ -17,5 +17,5 @@ Gem::Specification.new do |gem|
gem.add_dependency('sauce', ">= #{Sauce::MAJOR_VERSION}.0")
- gem.add_dependency('jasmine', '~> 1.2.0.0')
+ gem.add_dependency('jasmine', '~> 1.3')
end
View
@@ -1,49 +1,30 @@
require 'spec_helper'
require 'sauce/jasmine'
-describe Sauce::Jasmine::Driver do
+describe Jasmine::SeleniumDriver do
describe '#initialize' do
let(:address) { 'http://saucelabs.com' }
let(:browser) { 'firefox' }
it 'should take set the @http_address' do
Sauce::Selenium2.stub(:new)
- d = Sauce::Jasmine::Driver.new(browser, address)
+ d = Jasmine::SeleniumDriver.new(browser, address)
d.http_address.should equal(address)
end
it 'should initialize a Sauce driver' do
Sauce::Selenium2.should_receive(:new).with(anything).and_return(true)
- d = Sauce::Jasmine::Driver.new(browser, address)
+ d = Jasmine::SeleniumDriver.new(browser, address)
d.should_not be_nil
end
end
end
-describe Jasmine::Config do
- describe '#start' do
- before :each do
- # Stub out the creation of the Selenium2 driver itself
- Sauce::Selenium2.stub(:new)
- Sauce::Jasmine::Driver.stub(:new).and_return(driver)
- end
-
- let(:driver) do
- driver = double('Sauce::Jasmine::Driver')
- driver.stub(:connect)
- driver
- end
-
- it 'should create a Sauce::Jasmine::Driver' do
- Sauce::Jasmine::Driver.should_receive(:new).and_return(driver)
- subject.start
- subject.instance_variable_get(:@client).should be driver
- end
-
- it 'should call connect on the driver' do
- driver.should_receive(:connect)
- subject.start
+describe Jasmine::Configuration do
+ describe '#port' do
+ it 'returns 3001' do
+ expect(Jasmine::Configuration.new.port).to eq(3001)
end
end
end

0 comments on commit 5f0c709

Please sign in to comment.