Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Rename spec to test.

  • Loading branch information...
commit 4335d3aac912c4258a57736ea35a17ba12d71606 1 parent 4480be4
@airhorns authored
Showing with 231 additions and 314 deletions.
  1. +1 −0  Gemfile
  2. +1 −0  everblue.gemspec
  3. +0 −37 example/spec/javascripts/foo_spec.js
  4. +35 −0 example/test/javascripts/foo_test.js
  5. +4 −4 lib/everblue.rb
  6. +8 −12 lib/everblue/application.rb
  7. 0  lib/everblue/resources/{evergreen.css → everblue.css}
  8. +5 −5 lib/everblue/resources/list.js
  9. +3 −21 lib/everblue/resources/run.js
  10. +13 −13 lib/everblue/runner.rb
  11. +2 −0  lib/everblue/server.rb
  12. +5 −5 lib/everblue/suite.rb
  13. +3 −3 lib/everblue/{spec.rb → test.rb}
  14. +0 −5 lib/everblue/views/_spec_error.erb
  15. +4 −0 lib/everblue/views/_test_error.erb
  16. +4 −4 lib/everblue/views/list.erb
  17. +7 −7 lib/everblue/views/run.erb
  18. +14 −14 spec/everblue_spec.rb
  19. +14 −14 spec/meta_spec.rb
  20. +3 −3 spec/runner_spec.rb
  21. +3 −3 spec/spec_helper.rb
  22. +0 −27 spec/spec_spec.rb
  23. +0 −7 spec/suite1/spec/javascripts/coffeescript_spec.coffee
  24. +0 −12 spec/suite1/spec/javascripts/failing_spec.js
  25. +0 −8 spec/suite1/spec/javascripts/slow_spec.coffee
  26. +0 −1  spec/suite1/spec/javascripts/spec_helper.coffee
  27. +0 −1  spec/suite1/spec/javascripts/spec_helper.js
  28. +0 −52 spec/suite1/spec/javascripts/templates_spec.js
  29. +0 −11 spec/suite1/spec/javascripts/testing_spec.js
  30. +0 −14 spec/suite1/spec/javascripts/transactions_spec.js
  31. +0 −9 spec/suite1/spec/javascripts/with_helper_spec.js
  32. 0  spec/suite1/{spec/javascripts/models/game_spec.js → test/javascripts/bar_test.js}
  33. +7 −0 spec/suite1/test/javascripts/coffeescript_test.coffee
  34. +9 −0 spec/suite1/test/javascripts/failing_spec.js
  35. 0  spec/suite1/{spec/javascripts/libs/lucid_spec.js → test/javascripts/foo_test.js}
  36. 0  spec/suite1/{spec/javascripts/invalid_coffee_spec.coffee → test/javascripts/invalid_coffee_test.coffee}
  37. 0  spec/suite1/{spec/javascripts/foo_spec.js → test/javascripts/libs/lucid_test.js}
  38. 0  spec/suite1/{spec/javascripts/bar_spec.js → test/javascripts/models/game_test.js}
  39. +7 −0 spec/suite1/test/javascripts/slow_test.coffee
  40. 0  spec/suite1/{spec → test}/javascripts/templates/another_template.html
  41. 0  spec/suite1/{spec → test}/javascripts/templates/escape.html
  42. 0  spec/suite1/{spec → test}/javascripts/templates/one_template.html
  43. 0  spec/suite1/{spec → test}/javascripts/templates/script_tags.html
  44. +1 −0  spec/suite1/test/javascripts/test_helper.coffee
  45. +1 −0  spec/suite1/test/javascripts/test_helper.js
  46. +9 −0 spec/suite1/test/javascripts/testing_spec.js
  47. +12 −0 spec/suite1/test/javascripts/transactions_spec.js
  48. +8 −0 spec/suite1/test/javascripts/with_helper_test.js
  49. +0 −12 spec/suite2/spec/awesome_spec.js
  50. +11 −0 spec/suite2/test/awesome_test.js
  51. 0  spec/suite2/{spec/failing_spec.js → test/failing_test.js}
  52. +7 −7 spec/suite_spec.rb
  53. +3 −3 spec/template_spec.rb
  54. +27 −0 spec/test_spec.rb
View
1  Gemfile
@@ -3,3 +3,4 @@ source :gemcutter
gemspec
gem 'pry'
+gem 'sprockets'
View
1  everblue.gemspec
@@ -28,6 +28,7 @@ Gem::Specification.new do |s|
s.add_runtime_dependency("sinatra", ["~> 1.1"])
s.add_runtime_dependency("json_pure")
s.add_runtime_dependency("coffee-script")
+ s.add_runtime_dependency("sprockets", ["~> 2.0"])
s.add_development_dependency('rspec', ['~> 2.0'])
s.add_development_dependency('capybara-webkit', ['~>0.7'])
View
37 example/spec/javascripts/foo_spec.js
@@ -1,37 +0,0 @@
-require('/implementation.js')
-
-describe('with no tokens', function () {
- it("should return an empty string if an empty string is given", function() {
- expect(foo).toEqual('foo');
- })
-
- it("should return a string unchanged", function() {
- expect(foo).toEqual('foo');
- })
-})
-
-describe('with one token', function () {
- it("should replace the token with an empty string if no value is passed in", function() {
- expect(foo).toEqual('foo');
- })
-
- it("should replace the token with a given value", function() {
- })
-
- it("should not replace partial token matches", function() {
- })
-
- it("should work when calling replace twice on the same string template", function() {
- })
-})
-
-describe('with two tokens (OMG!?)', function () {
- it("should replace all tokens with their values", function() {
- })
-
- it("should not do anything about tokens not present in the string template", function() {
- })
-
- it("should replace tokens without value with the empty string", function() {
- })
-})
View
35 example/test/javascripts/foo_test.js
@@ -0,0 +1,35 @@
+//= require implementation
+
+QUnit.module('with no tokens');
+
+test("should return an empty string if an empty string is given", function() {
+ expect(foo).toEqual('foo');
+});
+
+test("should return a string unchanged", function() {
+ expect(foo).toEqual('foo');
+});
+
+QUnit.module('with one token');
+test("should replace the token with an empty string if no value is passed in", function() {
+ expect(foo).toEqual('foo');
+})
+
+test("should replace the token with a given value", function() {
+})
+
+test("should not replace partial token matches", function() {
+})
+
+test("should work when calling replace twice on the same string template", function() {
+})
+
+QUnit.module('with two tokens (OMG!?)');
+test("should replace all tokens with their values", function() {
+})
+
+test("should not do anything about tokens not present in the string template", function() {
+})
+
+test("should replace tokens without value with the empty string", function() {
+})
View
8 lib/everblue.rb
@@ -11,11 +11,11 @@ module Everblue
autoload :Server, 'everblue/server'
autoload :Runner, 'everblue/runner'
autoload :Suite, 'everblue/suite'
- autoload :Spec, 'everblue/spec'
+ autoload :Test, 'everblue/test'
autoload :Template, 'everblue/template'
class << self
- attr_accessor :driver, :public_dir, :template_dir, :spec_dir, :root, :mounted_at, :application
+ attr_accessor :driver, :public_dir, :template_dir, :test_dir, :root, :mounted_at, :application
def configure
yield self
@@ -26,8 +26,8 @@ def use_defaults!
config.application = Everblue::Application
config.driver = :selenium
config.public_dir = 'public'
- config.spec_dir = 'spec/javascripts'
- config.template_dir = 'spec/javascripts/templates'
+ config.test_dir = 'test/javascripts'
+ config.template_dir = 'test/javascripts/templates'
config.mounted_at = ""
end
end
View
20 lib/everblue/application.rb
@@ -8,10 +8,10 @@ def url(path)
Everblue.mounted_at.to_s + path.to_s
end
- def render_spec(spec)
- spec.read if spec
+ def render_test(test)
+ test.read if test
rescue StandardError => error
- erb :_spec_error, :locals => { :error => error }
+ erb :_test_error, :locals => { :error => error }
end
end
@@ -22,23 +22,19 @@ def render_spec(spec)
get '/run/all' do
@suite = Everblue::Suite.new
- @js_spec_helper = @suite.get_spec('spec_helper.js')
- @coffee_spec_helper = @suite.get_spec('spec_helper.coffee')
+ @js_test_helper = @suite.get_test('test_helper.js')
+ @coffee_test_helper = @suite.get_test('test_helper.coffee')
erb :run
end
get '/run/*' do |name|
@suite = Everblue::Suite.new
- @spec = @suite.get_spec(name)
- @js_spec_helper = @suite.get_spec('spec_helper.js')
- @coffee_spec_helper = @suite.get_spec('spec_helper.coffee')
+ @test = @suite.get_test(name)
+ @js_test_helper = @suite.get_test('test_helper.js')
+ @coffee_test_helper = @suite.get_test('test_helper.coffee')
erb :run
end
- get "/jasmine/*" do |path|
- send_file File.expand_path(File.join('../jasmine/lib/jasmine-core', path), File.dirname(__FILE__))
- end
-
get "/resources/*" do |path|
send_file File.expand_path(File.join('resources', path), File.dirname(__FILE__))
end
View
0  lib/everblue/resources/evergreen.css → lib/everblue/resources/everblue.css
File renamed without changes
View
10 lib/everblue/resources/list.js
@@ -1,6 +1,6 @@
var Everblue = {};
-Everblue.Spec = function(element) {
+Everblue.Test = function(element) {
var self = this;
this.element = $(element);
this.runLink = this.element.find('.run');
@@ -10,7 +10,7 @@ Everblue.Spec = function(element) {
});
}
-Everblue.Spec.prototype.run = function() {
+Everblue.Test.prototype.run = function() {
var self = this
this.iframe = $('<iframe></iframe>').attr('src', this.runLink.attr('href')).appendTo(this.element)
this.iframe.css({ position: 'absolute', left: '-20000px' });
@@ -28,7 +28,7 @@ Everblue.Spec.prototype.run = function() {
});
}
-Everblue.Spec.prototype.done = function(results) {
+Everblue.Test.prototype.done = function(results) {
var failed = []
$.each(results, function() {
if(!this.passed) { failed.push(this); }
@@ -45,7 +45,7 @@ Everblue.Spec.prototype.done = function(results) {
}
$(function() {
- $('#specs li, #all').each(function() {
- new Everblue.Spec(this)
+ $('#tests li, #all').each(function() {
+ new Everblue.Test(this)
});
});
View
24 lib/everblue/resources/run.js
@@ -8,11 +8,11 @@ Everblue.ReflectiveReporter = function() {
this.reportRunnerStarting = function(runner) {
Everblue.results = [];
};
- this.reportSpecResults = function(spec) {
- var results = spec.results();
+ this.reportTestResults = function(test) {
+ var results = test.results();
var item = results.getItems()[0] || {};
Everblue.results.push({
- name: spec.getFullName(),
+ name: test.getFullName(),
passed: results.failedCount === 0,
message: item.message,
trace: item.trace
@@ -30,21 +30,3 @@ Everblue.templates = {};
Everblue.getResults = function() {
return JSON.stringify(Everblue.results);
};
-
-beforeEach(function() {
- document.getElementById('test').innerHTML = "";
-});
-
-var template = function(name) {
- beforeEach(function() {
- document.getElementById('test').innerHTML = Everblue.templates[name]
- });
-};
-
-var require = function(file) {
- document.write('<script type="text/javascript" src="' + file + '"></script>');
-};
-
-var stylesheet = function(file) {
- document.write('<link rel="stylesheet" type="text/css" href="' + file + '"/>');
-};
View
26 lib/everblue/runner.rb
@@ -20,12 +20,12 @@ def failure_message
end
end
- class SpecRunner
- attr_reader :runner, :spec
+ class TestRunner
+ attr_reader :runner, :test
- def initialize(runner, spec)
+ def initialize(runner, test)
@runner = runner
- @spec = spec
+ @test = test
end
def session
@@ -45,7 +45,7 @@ def run
def examples
@results ||= begin
- session.visit(spec.url)
+ session.visit(test.url)
previous_results = ""
@@ -91,8 +91,8 @@ def initialize(io=STDOUT)
@io = io
end
- def spec_runner(spec)
- SpecRunner.new(self, spec)
+ def test_runner(test)
+ TestRunner.new(self, test)
end
def run
@@ -113,7 +113,7 @@ def run
end
def examples
- spec_runners.map { |spec_runner| spec_runner.examples }.flatten
+ test_runners.map { |test_runner| test_runner.examples }.flatten
end
def failed_examples
@@ -121,16 +121,16 @@ def failed_examples
end
def passed?
- spec_runners.all? { |spec_runner| spec_runner.passed? }
+ test_runners.all? { |test_runner| test_runner.passed? }
end
def dots
- spec_runners.map { |spec_runner| spec_runner.dots }.join
+ test_runners.map { |test_runner| test_runner.dots }.join
end
def failure_messages
unless passed?
- spec_runners.map { |spec_runner| spec_runner.failure_messages }.compact.join("\n\n")
+ test_runners.map { |test_runner| test_runner.failure_messages }.compact.join("\n\n")
end
end
@@ -144,8 +144,8 @@ def suite
protected
- def spec_runners
- @spec_runners ||= suite.specs.map { |spec| SpecRunner.new(self, spec) }
+ def test_runners
+ @test_runners ||= suite.tests.map { |test| TestRunner.new(self, test) }
end
end
end
View
2  lib/everblue/server.rb
@@ -1,3 +1,5 @@
+require 'coffee_script'
+
module Everblue
class Server
attr_reader :suite
View
10 lib/everblue/suite.rb
@@ -19,13 +19,13 @@ def mounted_at
Everblue.mounted_at
end
- def get_spec(name)
- Spec.new(self, name)
+ def get_test(name)
+ Test.new(self, name)
end
- def specs
- Dir.glob(File.join(root, Everblue.spec_dir, '**/*_spec.{js,coffee}')).map do |path|
- Spec.new(self, path.gsub(File.join(root, Everblue.spec_dir, ''), ''))
+ def tests
+ Dir.glob(File.join(root, Everblue.test_dir, '**/*_test.{js,coffee}')).map do |path|
+ Test.new(self, path.gsub(File.join(root, Everblue.test_dir, ''), ''))
end
end
View
6 lib/everblue/spec.rb → lib/everblue/test.rb
@@ -1,7 +1,7 @@
require 'open3'
module Everblue
- class Spec
+ class Test
attr_reader :name, :suite
def initialize(suite, name)
@@ -14,7 +14,7 @@ def root
end
def full_path
- File.join(root, Everblue.spec_dir, name)
+ File.join(root, Everblue.test_dir, name)
end
def read
@@ -46,7 +46,7 @@ def exist?
protected
def runner
- @runner ||= suite.runner.spec_runner(self)
+ @runner ||= suite.runner.test_runner(self)
end
end
end
View
5 lib/everblue/views/_spec_error.erb
@@ -1,5 +0,0 @@
-describe("failure", function() {
- it("should not fail", function() {
- throw(<%= "#{error.class}: #{error.message}".to_json %>);
- });
-});
View
4 lib/everblue/views/_test_error.erb
@@ -0,0 +1,4 @@
+QUnit.module("failure");
+test("should not fail", function() {
+ throw(<%= "#{error.class}: #{error.message}".to_json %>);
+});
View
8 lib/everblue/views/list.erb
@@ -8,11 +8,11 @@
<a class="run" href="<%= url('/run/all') %>">Run</a>
</div>
- <ul id="specs">
- <% @suite.specs.each do |spec| %>
+ <ul id="tests">
+ <% @suite.tests.each do |test| %>
<li>
- <a href="<%= spec.url %>"><%= spec.name %></a>
- <a class="run" href="<%= spec.url %>">Run</a>
+ <a href="<%= test.url %>"><%= test.name %></a>
+ <a class="run" href="<%= test.url %>">Run</a>
</li>
<% end %>
</ul>
View
14 lib/everblue/views/run.erb
@@ -4,14 +4,14 @@
<script type="text/javascript" src="<%= url("/resources/run.js") %>"></script>
<script type="text/javascript">
// <![CDATA[
- <%= render_spec(@coffee_spec_helper) if @coffee_spec_helper.exist? %>;
- <%= render_spec(@js_spec_helper) if @js_spec_helper.exist? %>;
- <% if @spec %>
- <%= render_spec(@spec) %>
+ <%= render_test(@coffee_test_helper) if @coffee_test_helper.exist? %>;
+ <%= render_test(@js_test_helper) if @js_test_helper.exist? %>;
+ <% if @test %>
+ <%= render_test(@test) %>
<% else %>
- <% @suite.specs.each do |spec| %>
- describe("<%= spec.name %>", function() {
- <%= render_spec(spec) %>;
+ <% @suite.tests.each do |test| %>
+ describe("<%= test.name %>", function() {
+ <%= render_test(test) %>;
});
<% end %>
<% end %>
View
28 spec/everblue_spec.rb
@@ -5,41 +5,41 @@
it "should show a successful test run" do
visit("/")
- click_link("testing_spec.js")
- page.should have_content("2 specs, 0 failures")
+ click_link("testing_test.js")
+ page.should have_content("2 tests, 0 failures")
end
- it "should show a successful test run for a coffeescript spec" do
+ it "should show a successful test run for a coffeescript test" do
visit("/")
- click_link("coffeescript_spec.coffee")
- page.should have_content("2 specs, 0 failures")
+ click_link("coffeescript_test.coffee")
+ page.should have_content("2 tests, 0 failures")
end
- it "should show errors for a failing spec" do
+ it "should show errors for a failing test" do
visit("/")
- click_link("failing_spec.js")
- page.should have_content("2 specs, 1 failure")
+ click_link("failing_test.js")
+ page.should have_content("2 tests, 1 failure")
page.should have_content("Expected 'bar' to equal 'noooooo'.")
end
- it "should run all specs" do
+ it "should run all tests" do
visit("/")
click_link("All")
- page.should have_content("18 specs, 3 failures")
+ page.should have_content("18 tests, 3 failures")
page.should have_content("Expected 'bar' to equal 'noooooo'.")
end
- it "should run a spec inline" do
+ it "should run a test inline" do
visit("/")
- within('li', :text => 'testing_spec.js') do
+ within('li', :text => 'testing_test.js') do
click_link("Run")
page.should have_content('Pass')
end
end
- it "should run a failing spec inline" do
+ it "should run a failing test inline" do
visit("/")
- within('li', :text => 'failing_spec.js') do
+ within('li', :text => 'failing_test.js') do
click_link("Run")
begin
page.should have_content('Fail')
View
28 spec/meta_spec.rb
@@ -2,33 +2,33 @@
describe Everblue::Runner do
let(:suite) { Everblue::Suite.new }
- subject { Everblue::Spec.new(suite, template) }
+ subject { Everblue::Test.new(suite, template) }
context "with standard setup" do
before { Everblue.root = File.expand_path('suite1', File.dirname(__FILE__)) }
- context "with transactions spec" do
- let(:template) { 'transactions_spec.js' }
+ context "with transactions test" do
+ let(:template) { 'transactions_test.js' }
it { should pass }
end
- context "with spec helper" do
- let(:template) { 'with_helper_spec.js' }
+ context "with test helper" do
+ let(:template) { 'with_helper_test.js' }
it { should pass }
end
- context "with template spec" do
- let(:template) { 'templates_spec.js' }
+ context "with template test" do
+ let(:template) { 'templates_test.js' }
it { should pass }
end
context "invalid coffee" do
- let(:template) { 'invalid_coffee_spec.coffee' }
+ let(:template) { 'invalid_coffee_test.coffee' }
it { should_not pass }
end
- context "with slow failing spec" do
- let(:template) { 'slow_spec.coffee' }
+ context "with slow failing test" do
+ let(:template) { 'slow_test.coffee' }
it { should_not pass }
end
end
@@ -36,13 +36,13 @@
context "with modified setup" do
before { Everblue.root = File.expand_path('suite2', File.dirname(__FILE__)) }
- context "with awesome spec" do
- let(:template) { 'awesome_spec.js' }
+ context "with awesome test" do
+ let(:template) { 'awesome_test.js' }
it { should pass }
end
- context "with failing spec" do
- let(:template) { 'failing_spec.js' }
+ context "with failing test" do
+ let(:template) { 'failing_test.js' }
it { should_not pass }
end
end
View
6 spec/runner_spec.rb
@@ -17,9 +17,9 @@
end
end
- describe '#run_spec' do
- let(:spec) { suite.get_spec('failing_spec.js') }
- before { runner.spec_runner(spec).run }
+ describe '#run_test' do
+ let(:test) { suite.get_test('failing_test.js') }
+ before { runner.test_runner(test).run }
describe 'the buffer' do
subject { buffer.rewind; buffer.read }
View
6 spec/spec_helper.rb
@@ -17,10 +17,10 @@
Capybara.default_driver = TEST_DRIVER
module EverblueMatchers
- class PassSpec # :nodoc:
+ class PassTest # :nodoc:
def matches?(actual)
@actual = actual
- @runner = Everblue::Runner.new(StringIO.new).spec_runner(@actual)
+ @runner = Everblue::Runner.new(StringIO.new).test_runner(@actual)
@runner.passed?
end
@@ -34,7 +34,7 @@ def negative_failure_message
end
def pass
- PassSpec.new
+ PassTest.new
end
end
View
27 spec/spec_spec.rb
@@ -1,27 +0,0 @@
-require 'spec_helper'
-
-describe Everblue::Spec do
- let(:suite) { Everblue::Suite.new }
- subject { Everblue::Spec.new(suite, 'testing_spec.js') }
-
- its(:name) { should == 'testing_spec.js' }
- its(:root) { should == File.expand_path('suite1', File.dirname(__FILE__)) }
- its(:full_path) { should == File.expand_path("spec/javascripts/testing_spec.js", Everblue.root) }
- its(:url) { should == "/run/testing_spec.js" }
- its(:contents) { should =~ /describe\('testing'/ }
-
- context "with coffeescript" do
- subject { Everblue::Spec.new(suite, 'coffeescript_spec.coffee') }
- its(:contents) { should =~ /describe\('coffeescript', function/ }
- end
-
- context "with existing spec file" do
- it { should exist }
- end
-
- context "with missing spec file" do
- subject { Everblue::Spec.new(suite, 'does_not_exist.js') }
- it { should_not exist }
- end
-
-end
View
7 spec/suite1/spec/javascripts/coffeescript_spec.coffee
@@ -1,7 +0,0 @@
-describe 'coffeescript', ->
-
- it "should pass", ->
- expect('foo').toEqual('foo')
-
- it "should also pass", ->
- expect('bar').toEqual('bar')
View
12 spec/suite1/spec/javascripts/failing_spec.js
@@ -1,12 +0,0 @@
-describe('failing spec', function() {
-
- it("should pass", function() {
- expect('foo').toEqual('foo');
- });
-
- it("should fail", function() {
- expect('bar').toEqual('noooooo');
- });
-
-});
-
View
8 spec/suite1/spec/javascripts/slow_spec.coffee
@@ -1,8 +0,0 @@
-describe 'slow specs', ->
-
- it "should wait for results to show", ->
- runs ->
- expect('foo').toEqual('foo')
- waits 1000
- runs ->
- expect('bar').toEqual('baz')
View
1  spec/suite1/spec/javascripts/spec_helper.coffee
@@ -1 +0,0 @@
-window.CoffeeSpecHelper = { coffee: 'script' }
View
1  spec/suite1/spec/javascripts/spec_helper.js
@@ -1 +0,0 @@
-var SpecHelper = { spec: 'helper' };
View
52 spec/suite1/spec/javascripts/templates_spec.js
@@ -1,52 +0,0 @@
-require('/jquery.js');
-stylesheet('/styles.css')
-
-describe('templates', function() {
-
- describe('with template', function() {
- template('one_template.html')
-
- it("should append the template to the test div", function() {
- expect($('#test h1#from-template').length).toEqual(1);
- });
-
- it("should change stuff in one test...", function() {
- expect($('#test h1#from-template').length).toEqual(1);
-
- $('#test h1#from-template').attr('id', 'changed');
-
- expect($('#test h1#changed').length).toEqual(1);
- expect($('#test h1#from-template').length).toEqual(0);
- });
-
- it("... should have been removed before the next starts", function() {
- expect($('#test h1#changed').length).toEqual(0);
- expect($('#test h1#from-template').length).toEqual(1);
- });
- });
-
- describe('with another template', function() {
- template('another_template.html')
-
- it("should append the template to the test div", function() {
- expect($('#test h1#another-template').length).toEqual(1);
- });
- });
-
- describe('with template with script tags', function() {
- template('script_tags.html')
-
- it("should append the template to the test div", function() {
- expect($('#test h1#script-tags').length).toEqual(1);
- });
- });
-
-});
-
-describe('stylesheet', function() {
- template('one_template.html')
-
- it("should style the template", function() {
- expect($('#from-template').css('width')).toEqual('300px')
- });
-});
View
11 spec/suite1/spec/javascripts/testing_spec.js
@@ -1,11 +0,0 @@
-describe('testing', function() {
-
- it("should pass", function() {
- expect('foo').toEqual('foo');
- });
-
- it("should also pass", function() {
- expect('bar').toEqual('bar');
- });
-
-});
View
14 spec/suite1/spec/javascripts/transactions_spec.js
@@ -1,14 +0,0 @@
-require('/jquery.js');
-
-describe('transactions', function() {
-
- it("should add stuff in one test...", function() {
- $('#test').append('<h1 id="added">New Stuff</h1>');
- expect($('#test h1#added').length).toEqual(1);
- });
-
- it("... should have been removed before the next starts", function() {
- expect($('#test h1#added').length).toEqual(0);
- });
-
-});
View
9 spec/suite1/spec/javascripts/with_helper_spec.js
@@ -1,9 +0,0 @@
-describe('the spec helper', function() {
- it("should load js file", function() {
- expect(SpecHelper.spec).toEqual('helper');
- });
-
- it("should load coffee file", function() {
- expect(CoffeeSpecHelper.coffee).toEqual('script');
- });
-});
View
0  ...ite1/spec/javascripts/models/game_spec.js → spec/suite1/test/javascripts/bar_test.js
File renamed without changes
View
7 spec/suite1/test/javascripts/coffeescript_test.coffee
@@ -0,0 +1,7 @@
+QUnit.module 'coffeescript'
+
+test "should pass", ->
+ equal 'foo', 'foo'
+
+test "should also pass", ->
+ equal 'bar', 'bar'
View
9 spec/suite1/test/javascripts/failing_spec.js
@@ -0,0 +1,9 @@
+QUnit.module('failing spec');
+
+test("should pass", function() {
+ equal('foo', 'foo');
+});
+
+test("should fail", function() {
+ equal('bar', 'noooooo');
+});
View
0  ...uite1/spec/javascripts/libs/lucid_spec.js → spec/suite1/test/javascripts/foo_test.js
File renamed without changes
View
0  ...ec/javascripts/invalid_coffee_spec.coffee → ...st/javascripts/invalid_coffee_test.coffee
File renamed without changes
View
0  spec/suite1/spec/javascripts/foo_spec.js → ...uite1/test/javascripts/libs/lucid_test.js
File renamed without changes
View
0  spec/suite1/spec/javascripts/bar_spec.js → ...ite1/test/javascripts/models/game_test.js
File renamed without changes
View
7 spec/suite1/test/javascripts/slow_test.coffee
@@ -0,0 +1,7 @@
+QUnit.module 'slow specs'
+
+asyncTest "should wait for results to show", ->
+ equal('foo', 'foo')
+ setTimeout ->
+ equal('bar', 'baz')
+ , 1000
View
0  ...vascripts/templates/another_template.html → ...vascripts/templates/another_template.html
File renamed without changes
View
0  ...e1/spec/javascripts/templates/escape.html → ...e1/test/javascripts/templates/escape.html
File renamed without changes
View
0  ...c/javascripts/templates/one_template.html → ...t/javascripts/templates/one_template.html
File renamed without changes
View
0  ...ec/javascripts/templates/script_tags.html → ...st/javascripts/templates/script_tags.html
File renamed without changes
View
1  spec/suite1/test/javascripts/test_helper.coffee
@@ -0,0 +1 @@
+window.CoffeeTestHelper = { coffee: 'script' }
View
1  spec/suite1/test/javascripts/test_helper.js
@@ -0,0 +1 @@
+var TestHelper = { test: 'helper' };
View
9 spec/suite1/test/javascripts/testing_spec.js
@@ -0,0 +1,9 @@
+QUnit.module('testing');
+
+test("should pass", function() {
+ equal('foo', 'foo');
+});
+
+test("should also pass", function() {
+ equal('bar', 'bar');
+});
View
12 spec/suite1/test/javascripts/transactions_spec.js
@@ -0,0 +1,12 @@
+//= require jquery
+
+QUnit.module('transactions');
+
+test("should add stuff in one test...", function() {
+ $('#test').append('<h1 id="added">New Stuff</h1>');
+ equal($('#test h1#added').length, 1);
+});
+
+test("... should have been removed before the next starts", function() {
+ equal($('#test h1#added').length, 0);
+});
View
8 spec/suite1/test/javascripts/with_helper_test.js
@@ -0,0 +1,8 @@
+QUnit.module('the spec helper');
+test("should load js file", function() {
+ equal(TestHelper.test, 'helper');
+});
+
+test("should load coffee file", function() {
+ equal(CoffeeTestHelper.coffee, 'script');
+});
View
12 spec/suite2/spec/awesome_spec.js
@@ -1,12 +0,0 @@
-require('/foo.js')
-
-describe('awesome', function() {
- template('foo.html');
-
- it('requires public files', function() {
- expect(something).toEqual('The Foo');
- });
- it('loads templates', function() {
- expect(document.getElementById('foo').innerHTML).toEqual('The foo template');
- });
-});
View
11 spec/suite2/test/awesome_test.js
@@ -0,0 +1,11 @@
+//= require foo
+
+QUnit.module('awesome');
+//template('foo.html');
+
+test('requires public files', function() {
+ equal(something, 'The Foo');
+});
+//test('loads templates', function() {
+ //equal(document.getElementById('foo').innerHTML, 'The foo template');
+//});
View
0  spec/suite2/spec/failing_spec.js → spec/suite2/test/failing_test.js
File renamed without changes
View
14 spec/suite_spec.rb
@@ -5,20 +5,20 @@
its(:root) { should == File.expand_path('suite1', File.dirname(__FILE__)) }
- describe '#get_spec' do
- subject { Everblue::Suite.new.get_spec('testing_spec.js') }
- its(:name) { should == 'testing_spec.js' }
+ describe '#get_test' do
+ subject { Everblue::Suite.new.get_test('testing_test.js') }
+ its(:name) { should == 'testing_test.js' }
its(:root) { should == File.expand_path('suite1', File.dirname(__FILE__)) }
end
- describe '#specs' do
- it "should find all specs recursively in the given root directory" do
- subject.specs.map(&:name).should include('testing_spec.js', 'foo_spec.js', 'bar_spec.js', 'libs/lucid_spec.js', 'models/game_spec.js')
+ describe '#tests' do
+ it "should find all tests recursively in the given root directory" do
+ subject.tests.map(&:name).should include('testing_test.js', 'foo_test.js', 'bar_test.js', 'libs/lucid_test.js', 'models/game_test.js')
end
end
describe '#templates' do
- it "should find all specs in the given root directory" do
+ it "should find all tests in the given root directory" do
subject.templates.map(&:name).should include('one_template.html', 'another_template.html')
end
end
View
6 spec/template_spec.rb
@@ -6,14 +6,14 @@
its(:name) { should == 'one_template.html' }
its(:root) { should == File.expand_path('suite1', File.dirname(__FILE__)) }
- its(:full_path) { should == File.expand_path("spec/javascripts/templates/one_template.html", Everblue.root) }
+ its(:full_path) { should == File.expand_path("test/javascripts/templates/one_template.html", Everblue.root) }
its(:contents) { should =~ %r(<h1 id="from\-template">This is from the template</h1>) }
- context "with existing spec file" do
+ context "with existing test file" do
it { should exist }
end
- context "with missing spec file" do
+ context "with missing test file" do
subject { Everblue::Template.new(suite, 'does_not_exist.html') }
it { should_not exist }
end
View
27 spec/test_spec.rb
@@ -0,0 +1,27 @@
+require 'spec_helper'
+
+describe Everblue::Test do
+ let(:suite) { Everblue::Suite.new }
+ subject { Everblue::Test.new(suite, 'testing_test.js') }
+
+ its(:name) { should == 'testing_test.js' }
+ its(:root) { should == File.expand_path('suite1', File.dirname(__FILE__)) }
+ its(:full_path) { should == File.expand_path("test/javascripts/testing_test.js", Everblue.root) }
+ its(:url) { should == "/run/testing_test.js" }
+ its(:contents) { should =~ /describe\('testing'/ }
+
+ context "with coffeescript" do
+ subject { Everblue::Test.new(suite, 'coffeescript_test.coffee') }
+ its(:contents) { should =~ /describe\('coffeescript', function/ }
+ end
+
+ context "with existing test file" do
+ it { should exist }
+ end
+
+ context "with missing test file" do
+ subject { Everblue::Test.new(suite, 'does_not_exist.js') }
+ it { should_not exist }
+ end
+
+end
Please sign in to comment.
Something went wrong with that request. Please try again.