screw_server 0.1.7 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. data/Gemfile.run.lock +2 -2
  2. data/assets/vendor/jslint/jslint.js +1 -1
  3. data/assets/vendor/screw-unit/EXAMPLE.html +4 -4
  4. data/assets/vendor/screw-unit/example/models/man.js +1 -1
  5. data/assets/vendor/screw-unit/example/spec/models/cat_spec.js +5 -5
  6. data/assets/vendor/screw-unit/example/spec/models/man_spec.js +4 -4
  7. data/assets/vendor/screw-unit/example/spec/suite.html +4 -4
  8. data/assets/vendor/screw-unit/lib/jquery-1.2.6.js +4 -4
  9. data/assets/vendor/screw-unit/lib/jquery.print.js +1 -1
  10. data/assets/vendor/screw-unit/lib/screw.behaviors.js +12 -12
  11. data/assets/vendor/screw-unit/lib/screw.builder.js +1 -1
  12. data/assets/vendor/screw-unit/lib/screw.css +2 -2
  13. data/assets/vendor/screw-unit/lib/screw.events.js +2 -2
  14. data/assets/vendor/screw-unit/lib/screw.matchers.js +5 -5
  15. data/assets/vendor/screw-unit/spec/behaviors_spec.js +18 -18
  16. data/assets/vendor/screw-unit/spec/matchers_spec.js +20 -20
  17. data/assets/vendor/screw-unit/spec/print_spec.js +16 -16
  18. data/assets/vendor/smoke/lib/smoke.core.js +7 -7
  19. data/assets/vendor/smoke/lib/smoke.mock.js +6 -6
  20. data/assets/vendor/smoke/lib/smoke.stub.js +1 -1
  21. data/assets/vendor/smoke/spec/core_spec.js +14 -14
  22. data/assets/vendor/smoke/spec/mock_spec.js +46 -46
  23. data/assets/vendor/smoke/spec/screw_integration_spec.js +2 -2
  24. data/assets/vendor/smoke/spec/stub_spec.js +2 -2
  25. data/assets/vendor/smoke/spec/su/jquery-1.2.3.js +203 -203
  26. data/assets/vendor/smoke/spec/su/jquery.print.js +3 -3
  27. data/assets/vendor/smoke/spec/su/screw.behaviors.js +12 -12
  28. data/assets/vendor/smoke/spec/su/screw.events.js +1 -1
  29. data/assets/vendor/smoke/spec/su/screw.matchers.js +9 -9
  30. data/assets/vendor/smoke/spec/suite.html +1 -1
  31. data/bin/screw_server +3 -1
  32. data/bundler_version.rb +1 -0
  33. data/lib/screw_server/app.rb +12 -8
  34. data/lib/screw_server/base.rb +3 -3
  35. data/lib/screw_server/spec_file.rb +7 -4
  36. data/screw_server.gemspec +11 -3
  37. data/views/run_spec.haml +3 -2
  38. metadata +9 -8
@@ -21,7 +21,7 @@
21
21
  'form': ['method', 'action']
22
22
  };
23
23
  $.each(properties.concat(extra[obj.tagName.toLowerCase()] || []), function() {
24
- if (obj[this])
24
+ if (obj[this])
25
25
  result.push(' ' + this.replace('className', 'class') + "=" + $.print(obj[this]))
26
26
  });
27
27
  return "<" + obj.tagName.toLowerCase()
@@ -59,7 +59,7 @@
59
59
  '\\': '\\\\'
60
60
  };
61
61
  var r = /["\\\x00-\x1f\x7f-\x9f]/g;
62
-
62
+
63
63
  var str = r.test(value)
64
64
  ? '"' + value.replace(r, function (a) {
65
65
  var c = character_substitutions[a];
@@ -104,5 +104,5 @@
104
104
  else
105
105
  return obj.toString().replace(/\n\s*/g, '');
106
106
  }
107
-
107
+
108
108
  })(jQuery);
@@ -12,37 +12,37 @@
12
12
  parent: function() {
13
13
  return $(this).parent('.describes').parent('.describe');
14
14
  },
15
-
15
+
16
16
  run_befores: function() {
17
17
  $(this).fn('parent').fn('run_befores');
18
18
  $(this).children('.befores').children('.before').fn('run');
19
19
  },
20
-
20
+
21
21
  run_afters: function() {
22
22
  $(this).fn('parent').fn('run_afters');
23
23
  $(this).children('.afters').children('.after').fn('run');
24
24
  },
25
-
25
+
26
26
  enqueue: function() {
27
27
  $(this).children('.its').children('.it').fn('enqueue');
28
28
  $(this).children('.describes').children('.describe').fn('enqueue');
29
29
  },
30
-
30
+
31
31
  selector: function() {
32
32
  return $(this).fn('parent').fn('selector')
33
33
  + ' > .describes > .describe:eq(' + $(this).parent('.describes').children('.describe').index(this) + ')';
34
34
  }
35
35
  });
36
-
36
+
37
37
  $('body > .describe').fn({
38
38
  selector: function() { return 'body > .describe' }
39
39
  });
40
-
40
+
41
41
  $('.it').fn({
42
42
  parent: function() {
43
43
  return $(this).parent('.its').parent('.describe');
44
44
  },
45
-
45
+
46
46
  run: function() {
47
47
  try {
48
48
  try {
@@ -56,7 +56,7 @@
56
56
  $(this).trigger('failed', [e]);
57
57
  }
58
58
  },
59
-
59
+
60
60
  enqueue: function() {
61
61
  var self = $(this).trigger('enqueued');
62
62
  $(Screw)
@@ -65,17 +65,17 @@
65
65
  setTimeout(function() { $(Screw).dequeue() }, 0);
66
66
  });
67
67
  },
68
-
68
+
69
69
  selector: function() {
70
70
  return $(this).fn('parent').fn('selector')
71
71
  + ' > .its > .it:eq(' + $(this).parent('.its').children('.it').index(this) + ')';
72
72
  }
73
73
  });
74
-
74
+
75
75
  $('.before').fn({
76
76
  run: function() { $(this).data('screwunit.run')() }
77
- });
78
-
77
+ });
78
+
79
79
  $('.after').fn({
80
80
  run: function() { $(this).data('screwunit.run')() }
81
81
  });
@@ -1,6 +1,6 @@
1
1
  (function($) {
2
2
  $(Screw)
3
- .bind('loaded', function() {
3
+ .bind('loaded', function() {
4
4
  $('.describe, .it')
5
5
  .click(function() {
6
6
  document.location = location.href.split('?')[0] + '?' + $(this).fn('selector');
@@ -1,5 +1,5 @@
1
1
  Screw.Matchers = (function($) {
2
- return matchers = {
2
+ return matchers = {
3
3
  expect: function(actual) {
4
4
  return {
5
5
  to: function(matcher, expected, not) {
@@ -8,13 +8,13 @@ Screw.Matchers = (function($) {
8
8
  throw(matcher.failure_message(expected, actual, not));
9
9
  }
10
10
  },
11
-
11
+
12
12
  to_not: function(matcher, expected) {
13
13
  this.to(matcher, expected, true);
14
14
  }
15
15
  }
16
16
  },
17
-
17
+
18
18
  equal: {
19
19
  match: function(expected, actual) {
20
20
  if (expected instanceof Array) {
@@ -31,12 +31,12 @@ Screw.Matchers = (function($) {
31
31
  return expected == actual;
32
32
  }
33
33
  },
34
-
34
+
35
35
  failure_message: function(expected, actual, not) {
36
36
  return 'expected ' + $.print(actual) + (not ? ' to not equal ' : ' to equal ') + $.print(expected);
37
37
  }
38
38
  },
39
-
39
+
40
40
  match: {
41
41
  match: function(expected, actual) {
42
42
  if (expected.constructor == RegExp)
@@ -44,19 +44,19 @@ Screw.Matchers = (function($) {
44
44
  else
45
45
  return actual.indexOf(expected) > -1;
46
46
  },
47
-
47
+
48
48
  failure_message: function(expected, actual, not) {
49
49
  return 'expected ' + $.print(actual) + (not ? ' to not match ' : ' to match ') + $.print(expected);
50
50
  }
51
51
  },
52
-
52
+
53
53
  be_empty: {
54
54
  match: function(expected, actual) {
55
55
  if (actual.length == undefined) throw(actual.toString() + " does not respond to length");
56
-
56
+
57
57
  return actual.length == 0;
58
58
  },
59
-
59
+
60
60
  failure_message: function(expected, actual, not) {
61
61
  return 'expected ' + $.print(actual) + (not ? ' to not be empty' : ' to be empty');
62
62
  }
@@ -8,7 +8,7 @@
8
8
  <script src="su/screw.matchers.js"></script>
9
9
  <script src="su/screw.events.js"></script>
10
10
  <script src="su/screw.behaviors.js"></script>
11
-
11
+
12
12
  <!-- require smoke -->
13
13
  <script src="../lib/smoke.core.js"></script>
14
14
  <script src="../lib/smoke.mock.js"></script>
data/bin/screw_server CHANGED
@@ -8,8 +8,10 @@ if Object.const_defined?("Bundler")
8
8
  Kernel.exec(__FILE__)
9
9
  end
10
10
 
11
+ require File.expand_path("../../bundler_version", __FILE__)
12
+
11
13
  require "rubygems"
12
- gem "bundler", "= 1.0.21"
14
+ gem "bundler", SCREW_SERVER_BUNDLER_VERSION
13
15
  require "bundler"
14
16
  ENV["BUNDLE_GEMFILE"] = File.expand_path("../../Gemfile.run", __FILE__)
15
17
  Bundler.require
@@ -0,0 +1 @@
1
+ SCREW_SERVER_BUNDLER_VERSION = "1.1.3"
@@ -142,6 +142,10 @@ module ScrewServer
142
142
  }
143
143
  end
144
144
 
145
+ def spec_helpers
146
+ SpecFile.spec_helper_files
147
+ end
148
+
145
149
  def sample_spec_file
146
150
  "\n"+File.read(File.join(VIEW_PATH, "sample_spec.js"))
147
151
  end
@@ -159,8 +163,8 @@ module ScrewServer
159
163
  private
160
164
 
161
165
  def file_from_base_dir(base_dir, file)
162
- File.expand_path(File.join(base_dir, file)).tap do |result|
163
- unless result.start_with?(base_dir)
166
+ File.expand_path(File.join(base_dir.to_s, file)).tap do |result|
167
+ unless result.start_with?(base_dir.to_s)
164
168
  raise Sinatra::NotFound, "Forbidden Access out of base directory"
165
169
  end
166
170
  end
@@ -168,17 +172,17 @@ module ScrewServer
168
172
 
169
173
  def url_for_source_file(filename)
170
174
  file = File.expand_path(filename)
171
- if file.start_with?(Base.code_base_dir)
172
- file[Base.code_base_dir.length..-1]
173
- elsif file.start_with?(Base.spec_base_dir)
174
- url_for_spec(file[(Base.spec_base_dir.length + 1)..-1])
175
+ if file.start_with?(Base.code_base_dir.to_s)
176
+ file[Base.code_base_dir.to_s.length..-1]
177
+ elsif file.start_with?(Base.spec_base_dir.to_s)
178
+ url_for_spec(file[(Base.spec_base_dir.to_s.length + 1)..-1])
175
179
  else
176
- raise "file #{file} cannot be checked by jslint since it it not inside the spec or code path"
180
+ raise "file #{file} cannot be checked by jslint since it it not inside the spec or code path: #{Base.code_base_dir} or #{Base.spec_base_dir}"
177
181
  end
178
182
  end
179
183
 
180
184
  def run_specs(specs)
181
- if File.exists?(SpecFile.spec_helper_file)
185
+ if SpecFile.spec_helper_files.length > 0
182
186
  @specs = specs
183
187
  haml :run_spec
184
188
  else
@@ -2,7 +2,7 @@ module ScrewServer
2
2
  module Base
3
3
  def self.spec_base_dir=(d)
4
4
  raise "expected a directory with javascript specs under #{d}" unless File.exists?(d)
5
- @spec_base_dir = d
5
+ @spec_base_dir = Pathname(d)
6
6
  end
7
7
 
8
8
  def self.spec_base_dir
@@ -11,11 +11,11 @@ module ScrewServer
11
11
 
12
12
  def self.code_base_dir=(d)
13
13
  raise "expected a directory with javascript code under #{d}" unless File.exists?(d)
14
- @code_base_dir = d
14
+ @code_base_dir = Pathname(d)
15
15
  end
16
16
 
17
17
  def self.code_base_dir
18
18
  @code_base_dir
19
19
  end
20
20
  end
21
- end
21
+ end
@@ -39,7 +39,8 @@ module ScrewServer
39
39
  end
40
40
 
41
41
  def required_scripts
42
- required_files_in(SpecFile.spec_helper_file) + required_files_in(filename)
42
+ SpecFile.spec_helper_files.map { |file| required_files_in(file) }.flatten +
43
+ required_files_in(filename)
43
44
  end
44
45
 
45
46
  def last_dependency_change
@@ -53,13 +54,15 @@ module ScrewServer
53
54
  end
54
55
 
55
56
  def used_files
56
- [filename, SpecFile.spec_helper_file] +
57
+ [filename] +
58
+ SpecFile.spec_helper_files +
57
59
  used_fixtures.map(&:filename) +
58
60
  required_scripts.map {|script| File.join(Base.code_base_dir, script)}
59
61
  end
60
62
 
61
- def self.spec_helper_file
62
- File.join(Base.spec_base_dir, "spec_helper.js")
63
+ def self.spec_helper_files
64
+ Dir.glob(Base.spec_base_dir + "spec_helper.js") +
65
+ Dir.glob(Base.spec_base_dir + "support/**/*.js")
63
66
  end
64
67
 
65
68
  protected
data/screw_server.gemspec CHANGED
@@ -1,17 +1,25 @@
1
+ require File.expand_path("../bundler_version", __FILE__)
2
+
1
3
  Gem::Specification.new do |s|
2
4
  s.name = %q{screw_server}
3
- s.version = "0.1.7"
5
+ s.version = "0.1.8"
4
6
  s.authors = ["Kristian Hanekamp", "Infopark AG"]
5
7
  s.description = %q{Screw Server - easy javascript unit tests}
6
8
  s.email = %q{kristian.hanekamp@infopark.de}
7
9
  s.files =
8
10
  Dir.glob("{lib,assets,views}/**/*") +
9
- ["bin/screw_server", "Gemfile.run", "Gemfile.run.lock", "screw_server.gemspec"]
11
+ [
12
+ "bin/screw_server",
13
+ "Gemfile.run",
14
+ "Gemfile.run.lock",
15
+ "screw_server.gemspec",
16
+ "bundler_version.rb"
17
+ ]
10
18
  s.summary = %q{Screw Server}
11
19
 
12
20
  s.add_dependency("json", "=1.6.5")
13
21
  s.add_dependency("haml", "= 3.0.13")
14
- s.add_dependency("bundler", "= 1.0.21")
22
+ s.add_dependency("bundler", SCREW_SERVER_BUNDLER_VERSION)
15
23
 
16
24
  # sinatra and dependencies
17
25
  s.add_dependency("rack", "= 1.1.0")
data/views/run_spec.haml CHANGED
@@ -9,7 +9,8 @@
9
9
  - screw_assets.each do |asset|
10
10
  %script{:type => "text/javascript", :src => url_for_screw_asset(asset)}
11
11
 
12
- %script{:type => "text/javascript", :src => url_for_spec("spec_helper.js")}
12
+ - spec_helpers.each do |asset|
13
+ %script{:type => "text/javascript", :src => url_for_source_file(asset)}
13
14
 
14
15
  %script{:type => "text/javascript"}
15
16
  = "fixture_container = #{fixture_html.to_json}"
@@ -28,4 +29,4 @@
28
29
 
29
30
  - if @include_monitor_code
30
31
  %script{:type => "text/javascript"}
31
- = monitor_code
32
+ = monitor_code
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: screw_server
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 11
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 7
10
- version: 0.1.7
9
+ - 8
10
+ version: 0.1.8
11
11
  platform: ruby
12
12
  authors:
13
13
  - Kristian Hanekamp
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2012-02-21 00:00:00 +01:00
19
+ date: 2012-05-24 00:00:00 +02:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
@@ -59,12 +59,12 @@ dependencies:
59
59
  requirements:
60
60
  - - "="
61
61
  - !ruby/object:Gem::Version
62
- hash: 61
62
+ hash: 21
63
63
  segments:
64
64
  - 1
65
- - 0
66
- - 21
67
- version: 1.0.21
65
+ - 1
66
+ - 3
67
+ version: 1.1.3
68
68
  type: :runtime
69
69
  version_requirements: *id003
70
70
  - !ruby/object:Gem::Dependency
@@ -224,6 +224,7 @@ files:
224
224
  - Gemfile.run
225
225
  - Gemfile.run.lock
226
226
  - screw_server.gemspec
227
+ - bundler_version.rb
227
228
  has_rdoc: true
228
229
  homepage:
229
230
  licenses: []