This repository has been archived by the owner on Feb 13, 2020. It is now read-only.
/
raketasks.rb
111 lines (95 loc) · 3.09 KB
/
raketasks.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
require 'sauce'
spec_prereq = File.exist?(File.join(::Rails.root.to_s, 'config', 'database.yml')) ? "db:test:prepare" : :noop
task :noop do
end
class Rake::Task
def abandon
@actions.clear
end
end
include Sauce::Utilities
if defined?(Spec::Rake::SpecTask)
namespace :spec do
namespace :selenium do
desc "Run the Selenium acceptance tests in spec/selenium using Sauce OnDemand"
task :sauce => spec_prereq do
with_rails_server do
Rake::Task["spec:selenium:runtests"].invoke
end
end
desc "Run the Selenium acceptance tests in spec/selenium using a local Selenium server"
task :local => spec_prereq do
with_rails_server do
with_selenium_rc do
Rake::Task["spec:selenium:runtests"].invoke
end
end
end
desc "" # Hide it from rake -T
Spec::Rake::SpecTask.new :runtests do |t|
t.spec_opts = ['--options', "\"#{Rails.root.join('spec', 'spec.opts')}\""]
t.spec_files = FileList["spec/selenium/**/*_spec.rb"]
end
end
task :selenium => "selenium:sauce"
end
Rake::Task[:spec].abandon
desc "Run all specs in spec directory (excluding plugin specs)"
Spec::Rake::SpecTask.new(:spec => spec_prereq) do |t|
t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
t.spec_files = FileList['spec/**/*_spec.rb'].exclude('spec/selenium/*')
end
end
if defined?(RSpec::Core::RakeTask)
namespace :spec do
namespace :selenium do
desc "Run the Selenium acceptance tests in spec/selenium using Sauce OnDemand"
task :sauce => spec_prereq do
with_rails_server do
Rake::Task["spec:selenium:runtests"].invoke
end
end
desc "Run the Selenium acceptance tests in spec/selenium using a local Selenium server"
task :local => spec_prereq do
with_rails_server do
with_selenium_rc do
Rake::Task["spec:selenium:runtests"].invoke
end
end
end
desc "" # Hide it from rake -T
RSpec::Core::RakeTask.new :runtests do |t|
t.pattern = "spec/selenium/**/*_spec.rb"
end
end
task :selenium => "selenium:sauce"
end
end
namespace :test do
namespace :selenium do
desc "Run the Selenium acceptance tests in test/selenium using Sauce OnDemand"
task :sauce do
with_rails_server do
Rake::Task["test:selenium:runtests"].invoke
end
end
desc "Run the Selenium acceptance tests in spec/selenium using a local Selenium server"
task :local do
with_rails_server do
with_selenium_rc do
Rake::Task["test:selenium:runtests"].invoke
end
end
end
Rake::TestTask.new(:runtests) do |t|
t.libs << "test"
t.pattern = 'test/selenium/**/*_test.rb'
t.verbose = true
end
# Hide it from rake -T
Rake::Task['test:selenium:runtests'].instance_variable_set(:@full_comment, nil)
Rake::Task['test:selenium:runtests'].instance_variable_set(:@comment, nil)
Rake::Task['test:selenium:runtests'].enhance(["db:test:prepare"])
end
task :selenium => "selenium:sauce"
end