jasmine-parser 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. data/.gitignore +1 -0
  2. data/Gemfile +37 -0
  3. data/LICENSE.txt +29 -0
  4. data/README.md +118 -0
  5. data/Rakefile +43 -0
  6. data/jasmine-parser.gemspec +50 -0
  7. data/lib/jasmine-parser/announcer.rb +55 -0
  8. data/lib/jasmine-parser/config.rb +57 -0
  9. data/lib/jasmine-parser/exceptions.rb +46 -0
  10. data/lib/jasmine-parser/file_parser.rb +62 -0
  11. data/lib/jasmine-parser/jasmine_suite.rb +69 -0
  12. data/lib/jasmine-parser/javascript_object_wrapper.rb +136 -0
  13. data/lib/jasmine-parser/location_finder.rb +100 -0
  14. data/lib/jasmine-parser/node_collector.rb +88 -0
  15. data/lib/jasmine-parser/node_factory.rb +121 -0
  16. data/lib/jasmine-parser/nodes/example_node.rb +40 -0
  17. data/lib/jasmine-parser/nodes/function_invocation_node.rb +70 -0
  18. data/lib/jasmine-parser/nodes/group_node.rb +40 -0
  19. data/lib/jasmine-parser/nodes/node.rb +120 -0
  20. data/lib/jasmine-parser/nodes/root_node.rb +40 -0
  21. data/lib/jasmine-parser/nodes/shared_behavior_decl_node.rb +54 -0
  22. data/lib/jasmine-parser/nodes/shared_behavior_invoc_node.rb +80 -0
  23. data/lib/jasmine-parser.rb +53 -0
  24. data/spec/end_to_end_suite_parser_spec.rb +100 -0
  25. data/spec/file_parser_spec.rb +68 -0
  26. data/spec/fixture/spec/call_to_shared_example_in_other_file_spec.js +38 -0
  27. data/spec/fixture/spec/empty_shared_examples_spec.js +21 -0
  28. data/spec/fixture/spec/example_spec.js +48 -0
  29. data/spec/fixture/spec/example_spec_with_strange_spacing.js +48 -0
  30. data/spec/fixture/spec/multi_declaration_shared_spec.js +26 -0
  31. data/spec/fixture/spec/not_properly_formatted.js +24 -0
  32. data/spec/fixture/spec/shared_examples_function_declaration_spec.js +49 -0
  33. data/spec/fixture/spec/shared_examples_spec.js +43 -0
  34. data/spec/fixture/spec/small_file.js +5 -0
  35. data/spec/location_finder_spec.rb +263 -0
  36. data/spec/node_cloning_spec.rb +123 -0
  37. data/spec/node_collector_spec.rb +87 -0
  38. data/spec/node_spec.rb +102 -0
  39. data/spec/shared_behavior_decl_node_spec.rb +59 -0
  40. data/spec/shared_behavior_invoc_node_spec.rb +129 -0
  41. data/spec/shared_examples_for_end_to_end.rb +239 -0
  42. data/spec/shared_examples_in_new_function_spec.rb +74 -0
  43. data/spec/shared_examples_spec.rb +71 -0
  44. data/spec/spec_helper.rb +54 -0
  45. data/spec/suite_spec.rb +70 -0
  46. metadata +128 -0
@@ -0,0 +1,54 @@
1
+ # Copyright (c) 2013, Groupon, Inc.
2
+ # All rights reserved.
3
+ #
4
+ # Redistribution and use in source and binary forms, with or without
5
+ # modification, are permitted provided that the following conditions
6
+ # are met:
7
+ #
8
+ # Redistributions of source code must retain the above copyright notice,
9
+ # this list of conditions and the following disclaimer.
10
+ #
11
+ # Redistributions in binary form must reproduce the above copyright
12
+ # notice, this list of conditions and the following disclaimer in the
13
+ # documentation and/or other materials provided with the distribution.
14
+ #
15
+ # Neither the name of GROUPON nor the names of its contributors may be
16
+ # used to endorse or promote products derived from this software without
17
+ # specific prior written permission.
18
+ #
19
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
20
+ # IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21
+ # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
22
+ # PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
+ # HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
+ # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
25
+ # TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
26
+ # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27
+ # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28
+ # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29
+ # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+
31
+ require "rubygems"
32
+ require "bundler"
33
+ require 'rspec'
34
+ require 'jasmine-parser'
35
+
36
+ envs = [:default, :development]
37
+ envs << :debug if ENV["DEBUG"]
38
+ Bundler.setup(*envs)
39
+
40
+ JasmineParser::Config.logging = [:nil]
41
+
42
+
43
+
44
+
45
+ module Kernel
46
+ def capture_stdout
47
+ out = StringIO.new
48
+ $stdout = out
49
+ yield
50
+ return out.string
51
+ ensure
52
+ $stdout = STDOUT
53
+ end
54
+ end
@@ -0,0 +1,70 @@
1
+ # Copyright (c) 2013, Groupon, Inc.
2
+ # All rights reserved.
3
+ #
4
+ # Redistribution and use in source and binary forms, with or without
5
+ # modification, are permitted provided that the following conditions
6
+ # are met:
7
+ #
8
+ # Redistributions of source code must retain the above copyright notice,
9
+ # this list of conditions and the following disclaimer.
10
+ #
11
+ # Redistributions in binary form must reproduce the above copyright
12
+ # notice, this list of conditions and the following disclaimer in the
13
+ # documentation and/or other materials provided with the distribution.
14
+ #
15
+ # Neither the name of GROUPON nor the names of its contributors may be
16
+ # used to endorse or promote products derived from this software without
17
+ # specific prior written permission.
18
+ #
19
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
20
+ # IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21
+ # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
22
+ # PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
+ # HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
+ # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
25
+ # TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
26
+ # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27
+ # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28
+ # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29
+ # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+
31
+ require 'spec_helper'
32
+
33
+ describe JasmineParser::JasmineSuite do
34
+
35
+ before(:each) do
36
+ @suite = JasmineParser::JasmineSuite.new
37
+ end
38
+
39
+
40
+ describe "populating suite object" do
41
+ it "should have no spec files when new" do
42
+ @suite.spec_files.empty?.should == true
43
+ end
44
+
45
+ it "should be possible to add new spec files" do
46
+ @suite.add_spec_file("test")
47
+ @suite.spec_files.should == ["test"]
48
+ end
49
+ end
50
+
51
+ describe "location finder api" do
52
+ it "should have find_spec_location method" do
53
+ @suite.respond_to?('find_spec_location').should == true
54
+ end
55
+
56
+ it "should have the [] method" do
57
+ @suite.respond_to?('[]').should == true
58
+ end
59
+
60
+ it "should have example_count method" do
61
+ @suite.respond_to?('example_count').should == true
62
+ end
63
+
64
+ it "should have test_names method" do
65
+ @suite.respond_to?('example_names').should == true
66
+ end
67
+ end
68
+
69
+
70
+ end
metadata ADDED
@@ -0,0 +1,128 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jasmine-parser
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Dima Kovalenko
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-12-03 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rkelly
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ description: Parser for Jasmine Spec Files
31
+ email: dima.kovalenko@gmail.com
32
+ executables: []
33
+ extensions: []
34
+ extra_rdoc_files: []
35
+ files:
36
+ - .gitignore
37
+ - Gemfile
38
+ - LICENSE.txt
39
+ - README.md
40
+ - Rakefile
41
+ - jasmine-parser.gemspec
42
+ - lib/jasmine-parser.rb
43
+ - lib/jasmine-parser/announcer.rb
44
+ - lib/jasmine-parser/config.rb
45
+ - lib/jasmine-parser/exceptions.rb
46
+ - lib/jasmine-parser/file_parser.rb
47
+ - lib/jasmine-parser/jasmine_suite.rb
48
+ - lib/jasmine-parser/javascript_object_wrapper.rb
49
+ - lib/jasmine-parser/location_finder.rb
50
+ - lib/jasmine-parser/node_collector.rb
51
+ - lib/jasmine-parser/node_factory.rb
52
+ - lib/jasmine-parser/nodes/example_node.rb
53
+ - lib/jasmine-parser/nodes/function_invocation_node.rb
54
+ - lib/jasmine-parser/nodes/group_node.rb
55
+ - lib/jasmine-parser/nodes/node.rb
56
+ - lib/jasmine-parser/nodes/root_node.rb
57
+ - lib/jasmine-parser/nodes/shared_behavior_decl_node.rb
58
+ - lib/jasmine-parser/nodes/shared_behavior_invoc_node.rb
59
+ - spec/end_to_end_suite_parser_spec.rb
60
+ - spec/file_parser_spec.rb
61
+ - spec/fixture/spec/call_to_shared_example_in_other_file_spec.js
62
+ - spec/fixture/spec/empty_shared_examples_spec.js
63
+ - spec/fixture/spec/example_spec.js
64
+ - spec/fixture/spec/example_spec_with_strange_spacing.js
65
+ - spec/fixture/spec/multi_declaration_shared_spec.js
66
+ - spec/fixture/spec/not_properly_formatted.js
67
+ - spec/fixture/spec/shared_examples_function_declaration_spec.js
68
+ - spec/fixture/spec/shared_examples_spec.js
69
+ - spec/fixture/spec/small_file.js
70
+ - spec/location_finder_spec.rb
71
+ - spec/node_cloning_spec.rb
72
+ - spec/node_collector_spec.rb
73
+ - spec/node_spec.rb
74
+ - spec/shared_behavior_decl_node_spec.rb
75
+ - spec/shared_behavior_invoc_node_spec.rb
76
+ - spec/shared_examples_for_end_to_end.rb
77
+ - spec/shared_examples_in_new_function_spec.rb
78
+ - spec/shared_examples_spec.rb
79
+ - spec/spec_helper.rb
80
+ - spec/suite_spec.rb
81
+ homepage: https://github.com/groupon/jasmine-parser
82
+ licenses: []
83
+ post_install_message:
84
+ rdoc_options: []
85
+ require_paths:
86
+ - lib
87
+ required_ruby_version: !ruby/object:Gem::Requirement
88
+ none: false
89
+ requirements:
90
+ - - ! '>='
91
+ - !ruby/object:Gem::Version
92
+ version: '0'
93
+ required_rubygems_version: !ruby/object:Gem::Requirement
94
+ none: false
95
+ requirements:
96
+ - - ! '>='
97
+ - !ruby/object:Gem::Version
98
+ version: '0'
99
+ requirements: []
100
+ rubyforge_project:
101
+ rubygems_version: 1.8.24
102
+ signing_key:
103
+ specification_version: 3
104
+ summary: Gem to help to parse all of the jasmine spec files, and create usable stack
105
+ traces for any given test.
106
+ test_files:
107
+ - spec/end_to_end_suite_parser_spec.rb
108
+ - spec/file_parser_spec.rb
109
+ - spec/fixture/spec/call_to_shared_example_in_other_file_spec.js
110
+ - spec/fixture/spec/empty_shared_examples_spec.js
111
+ - spec/fixture/spec/example_spec.js
112
+ - spec/fixture/spec/example_spec_with_strange_spacing.js
113
+ - spec/fixture/spec/multi_declaration_shared_spec.js
114
+ - spec/fixture/spec/not_properly_formatted.js
115
+ - spec/fixture/spec/shared_examples_function_declaration_spec.js
116
+ - spec/fixture/spec/shared_examples_spec.js
117
+ - spec/fixture/spec/small_file.js
118
+ - spec/location_finder_spec.rb
119
+ - spec/node_cloning_spec.rb
120
+ - spec/node_collector_spec.rb
121
+ - spec/node_spec.rb
122
+ - spec/shared_behavior_decl_node_spec.rb
123
+ - spec/shared_behavior_invoc_node_spec.rb
124
+ - spec/shared_examples_for_end_to_end.rb
125
+ - spec/shared_examples_in_new_function_spec.rb
126
+ - spec/shared_examples_spec.rb
127
+ - spec/spec_helper.rb
128
+ - spec/suite_spec.rb