Skip to content
This repository was archived by the owner on Jan 10, 2024. It is now read-only.

Commit 05b52cb

Browse files
committed
Rip out testbeds
No way this is just going to pass but i'm hopeful
1 parent 1a4feb5 commit 05b52cb

9 files changed

+64
-140
lines changed

.gitignore

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,11 @@ log/*.log
33
pkg/
44
*.gem
55
.DS_Store
6-
.jhw-cache
76
tmp
87
log
98
*.sqlite3
109
chromedriver.log
1110
Gemfile.lock
12-
spec/testbeds
1311
/gemfiles/*.lock
1412
/.ruby-version
13+
/example-app

.travis.yml

+25-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,31 @@
1-
rvm: 2.0.0
2-
sudo: false
1+
language: ruby
2+
rvm:
3+
- 2.0
4+
- 2.2
5+
gemfile:
6+
- gemfiles/rails-3.2
7+
- gemfiles/rails-4.0
8+
- gemfiles/rails-4.0-jasmine-2
9+
- gemfiles/rails-4.1
10+
- gemfiles/rails-5.0
311

12+
sudo: false
413
before_install:
514
- "export DISPLAY=:99.0"
615
- "sh -e /etc/init.d/xvfb start"
716

8-
install: ''
17+
script: './run-tests.rb'
18+
19+
matrix:
20+
exclude:
21+
- rvm: 2.0
22+
gemfile: gemfiles/rails-5.0
23+
- rvm: 2.2
24+
gemfile: gemfiles/rails-3.2
25+
- rvm: 2.2
26+
gemfile: gemfiles/rails-4.0
27+
- rvm: 2.2
28+
gemfile: gemfiles/rails-4.0-jasmine-2
29+
- rvm: 2.2
30+
gemfile: gemfiles/rails-4.1
931

10-
script: "./run-tests.sh"

Bedfile

-33
This file was deleted.

Rakefile

-63
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,5 @@
11
#!/usr/bin/env rake
2-
begin
3-
require 'bundler/setup'
4-
rescue LoadError
5-
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
6-
exit # bundler is required for testbeds
7-
end
82

9-
require 'testbeds/rake'
103
require 'rspec/core/rake_task'
114
Bundler::GemHelper.install_tasks
125

13-
if File.directory?(File.expand_path('spec/testbeds', File.dirname(__FILE__)))
14-
all_test_tasks = []
15-
16-
each_testbed do |testbed| # namespace 'testbed:rails-3.2'
17-
18-
desc "run specs with phantomjs in #{testbed.name}"
19-
task :run_jasmine_rake_in_dummy do
20-
p testbed.gemfile
21-
ENV['BUNDLE_GEMFILE'] = testbed.gemfile
22-
cmd = 'bundle exec rake testbed:current:spec:javascript'
23-
raise 'specs failed' unless system cmd
24-
end
25-
26-
desc "run specs with browser in #{testbed.name}"
27-
task :run_browser_spec_in_dummy do
28-
p testbed.gemfile
29-
ENV['BUNDLE_GEMFILE'] = testbed.gemfile
30-
unless Rake::Task.task_defined?('_in_browser')
31-
RSpec::Core::RakeTask.new(:_in_browser) do |t|
32-
deps = testbed.dependencies
33-
t.pattern = "spec/jasmine_spec.rb"
34-
t.rspec_opts = deps.collect { |d| [ '-r', d ] }.flatten
35-
end
36-
end
37-
Rake::Task['_in_browser'].invoke
38-
Rake::Task['_in_browser'].reenable
39-
end
40-
41-
desc "run all tests in #{testbed.name}"
42-
task :all => [
43-
"#{testbed.namespace}:run_jasmine_rake_in_dummy",
44-
"#{testbed.namespace}:run_browser_spec_in_dummy"
45-
]
46-
47-
all_test_tasks << "#{testbed.namespace}:all"
48-
end
49-
50-
desc "run all tests"
51-
task :default => all_test_tasks
52-
else
53-
desc "run all tests"
54-
task :default do
55-
puts "To run tests, you must generate testbeds:"
56-
puts
57-
puts "1. Install bundle for each file in gemfiles/*:"
58-
Dir['gemfiles/*'].each do |dir|
59-
next if dir['.lock']
60-
puts " BUNDLE_GEMFILE=#{dir} bundle install"
61-
end
62-
puts
63-
puts "2. Execute `generate-testbeds` to generate testbed apps."
64-
puts " (Don't use `bundle exec` for this.)"
65-
puts
66-
puts "3. Run `rake` again."
67-
end
68-
end

jasmine-rails.gemspec

-1
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,4 @@ Gem::Specification.new do |s|
1919
s.add_dependency "sprockets-rails"
2020
s.add_dependency "jasmine-core", [">= 1.3", "< 3.0"]
2121
s.add_dependency "phantomjs", ">= 1.9"
22-
s.add_development_dependency 'testbeds'
2322
end

run-tests.rb

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/usr/bin/env ruby
2+
3+
def run(cmd)
4+
system(cmd)
5+
raise "`#{cmd}` exited non-zero (#{$?}). Exiting." if $? != 0
6+
end
7+
8+
puts '<--- Creating app'
9+
run 'rm -rf example-app'
10+
run 'bundle exec rails new example-app --skip-gemfile --skip-bundle'
11+
Dir.chdir('example-app')
12+
13+
puts '<--- Preparing app'
14+
run 'rails g jasmine_rails:install'
15+
run 'rm "app/assets/javascripts/application.js"'
16+
run 'cp "../spec/javascripts/support/jasmine.yml" "./spec/javascripts/support"'
17+
18+
# add bootstrap code so we don't have to copy assets into each testbed
19+
# every time a change is made
20+
File.open("config/application.rb", "a+") do |f|
21+
fixtures = File.expand_path('../spec/fixtures')
22+
f.puts <<-end_bootstrap
23+
Rails.application.config.assets.paths << "#{fixtures}/app/assets/javascripts"
24+
Rails.application.config.assets.paths << "#{fixtures}/vendor/assets/javascripts"
25+
Rails.application.config.assets.paths << "#{fixtures}/app/assets/stylesheets"
26+
end_bootstrap
27+
end
28+
29+
puts '<--- Running rake spec:javascript'
30+
run 'bundle exec rake spec:javascript'
31+
32+
puts '<--- Running browser spec'
33+
run 'bundle exec rspec ../spec/jasmine_spec.rb'
34+

run-tests.sh

-33
This file was deleted.

spec/jasmine_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
ENV["RAILS_ENV"] ||= 'test'
2-
require Rails.root.join('config/environment')
2+
require_relative '../example-app/config/environment'
33
require 'rspec/rails'
44
require 'capybara/rspec'
55
require 'capybara/rails'

spec/javascripts/support/jasmine.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
src_dir: "../../fixtures/app/assets/javascripts"
2-
css_dir: "../../fixtures/app/assets/stylesheets"
1+
src_dir: "../spec/fixtures/app/assets/javascripts"
2+
css_dir: "../spec/fixtures/app/assets/stylesheets"
33

44
src_files:
55
- "application.{js,coffee}"
66

77
css_files:
88
- "support.{css,css.sass}"
99

10-
spec_dir: ../../javascripts
10+
spec_dir: ../spec/javascripts
1111

1212
helpers:
1313
- "helpers/**/*.{js,coffee}"

0 commit comments

Comments
 (0)