specterjs 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (28) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +7 -0
  3. data/lib/javascript/assertions/assert.coffee +4 -0
  4. data/lib/javascript/specter.js +79 -0
  5. data/lib/rails/specter.rb +8 -0
  6. data/lib/rails/specter/application/app/assets/javascripts/exec.js +32 -0
  7. data/lib/rails/specter/application/app/assets/javascripts/runner.js +65 -0
  8. data/lib/rails/specter/application/app/assets/javascripts/test.js +104 -0
  9. data/lib/rails/specter/application/app/assets/javascripts/vendors/prism.js +724 -0
  10. data/lib/rails/specter/application/app/assets/stylesheets/application.scss +89 -0
  11. data/lib/rails/specter/application/app/assets/stylesheets/test.scss +37 -0
  12. data/lib/rails/specter/application/app/assets/stylesheets/tests.scss +76 -0
  13. data/lib/rails/specter/application/app/assets/stylesheets/variables.scss +11 -0
  14. data/lib/rails/specter/application/app/assets/stylesheets/vendors/prism.css +197 -0
  15. data/lib/rails/specter/application/app/controllers/application_controller.rb +2 -0
  16. data/lib/rails/specter/application/app/controllers/tests_controller.rb +29 -0
  17. data/lib/rails/specter/application/app/models/specter/test.rb +26 -0
  18. data/lib/rails/specter/application/app/views/layouts/application.html.erb +24 -0
  19. data/lib/rails/specter/application/app/views/tests/index.html.erb +19 -0
  20. data/lib/rails/specter/application/app/views/tests/run.html.erb +20 -0
  21. data/lib/rails/specter/application/app/views/tests/show.html.erb +14 -0
  22. data/lib/rails/specter/application/application.rb +13 -0
  23. data/lib/rails/specter/application/config.ru +12 -0
  24. data/lib/rails/specter/engine.rb +14 -0
  25. data/lib/rails/specter/tasks/specter.rake +47 -0
  26. data/lib/rails/version.rb +3 -0
  27. data/specter.gemspec +28 -0
  28. metadata +97 -0
@@ -0,0 +1,89 @@
1
+ @import 'variables';
2
+ @import 'tests';
3
+ @import 'test';
4
+
5
+ * {
6
+ box-sizing: border-box;
7
+ }
8
+
9
+ div {
10
+ display: flex;
11
+ flex-direction: column;
12
+ }
13
+
14
+ a {
15
+ display: flex;
16
+ text-decoration: none;
17
+ outline: none;
18
+
19
+ &:visited {
20
+ color: inherit;
21
+ }
22
+ }
23
+
24
+ html {
25
+ min-height: 100%;
26
+ color: $dark-blue;
27
+ }
28
+
29
+ html, body {
30
+ display: flex;
31
+ flex: 1;
32
+ flex-direction: column;
33
+ background: $light-blue;
34
+ font-family: sans-serif;
35
+ }
36
+
37
+ h1, h2, h3, h4, h5, h6 {
38
+ display: flex;
39
+ flex-direction: column;
40
+ font-family: serif;
41
+ margin: 0;
42
+ }
43
+
44
+ body > header, body > main {
45
+ display: flex;
46
+ padding: 1vh 2vw 0 2vw;
47
+ }
48
+
49
+ body > header {
50
+ align-items: center;
51
+ flex-direction: row;
52
+ max-width: 1000px;
53
+ width: 100%;
54
+ margin: 0 auto 40px auto;
55
+
56
+ h1 {
57
+ font-size: 3em;
58
+ }
59
+ }
60
+
61
+ main {
62
+ flex: 1;
63
+ flex-direction: column;
64
+ width: 100%;
65
+ max-width: 1000px;
66
+ margin: 0 auto;
67
+ }
68
+
69
+ header #Run {
70
+ cursor: pointer;
71
+ margin-left: auto;
72
+ padding: 8px 12px;
73
+ border: 1px solid $gray-blue;
74
+ border-radius: 2px;
75
+ box-shadow: inset 0 1px 0 0 transparent;
76
+ font-size: 0.6em;
77
+ font-weight: bold;
78
+ text-transform: uppercase;
79
+
80
+ transition: box-shadow ease 0.1s;
81
+
82
+ &:hover:not(:active) {
83
+ box-shadow: inset 0 1px 0 0 $white;
84
+ }
85
+
86
+ &:active {
87
+ box-shadow: inset 0 0 0 1px lighten($gray-blue, 20%);
88
+ }
89
+ }
@@ -0,0 +1,37 @@
1
+ #Test section.result > header {
2
+ display: flex;
3
+ padding: 8px 12px;
4
+ align-items: center;
5
+
6
+ & > div.status {
7
+ margin-right: 1em;
8
+ }
9
+ }
10
+
11
+
12
+ #Test section.result > header.error {
13
+ background-color: $light-red;
14
+ color: $red;
15
+ }
16
+
17
+ #Test section.result > header.success {
18
+ background-color: $light-green;
19
+ color: $green;
20
+ }
21
+
22
+ #Test section.result pre {
23
+ position: relative;
24
+ margin: 32px 0;
25
+ }
26
+
27
+ #Test section.result pre > span.label {
28
+ position: absolute;
29
+ right: 12px;
30
+ top: 0;
31
+ font-size: 0.5em;
32
+ background: $gray-blue;
33
+ padding: 4px 8px;
34
+ text-shadow: none;
35
+ border-radius: 0 0 2px 2px;
36
+ color: $light-blue;
37
+ }
@@ -0,0 +1,76 @@
1
+ @import 'vendors/prism';
2
+
3
+ ul.tests {
4
+ flex: 1;
5
+ list-style-type: none;
6
+ padding: 0;
7
+ margin: 0;
8
+ }
9
+
10
+ ul.tests > li {
11
+ display: flex;
12
+ justify-content: center;
13
+ background: $white;
14
+ margin: 4px 0;
15
+ }
16
+
17
+ ul.tests > li a {
18
+ margin-right: auto;
19
+ align-items: center;
20
+ color: inherit;
21
+ }
22
+
23
+ ul.tests > li > div {
24
+ display: flex;
25
+ flex: 1;
26
+ justify-content: center;
27
+
28
+ & > span {
29
+ font-size: 0.7em;
30
+ }
31
+
32
+ a:hover {
33
+ text-decoration: underline;
34
+ }
35
+ }
36
+
37
+ ul.tests > li div.status {
38
+ display: flex;
39
+ align-items: center;
40
+ justify-content: center;
41
+ flex: 0 0 auto;
42
+ width: 40px;
43
+ height: 40px;
44
+ margin: 4px 8px;
45
+ font-size: 1.4em;
46
+ }
47
+
48
+ ul.tests > li[data-status="started"] div.status {
49
+ background-color: #333;
50
+ border-radius: 100%;
51
+ animation: pulse 1.0s infinite ease-in-out;
52
+
53
+ @keyframes pulse {
54
+ 0% {
55
+ transform: scale(0);
56
+ }
57
+
58
+ 100% {
59
+ transform: scale(1.0);
60
+ opacity: 0;
61
+ }
62
+ }
63
+ }
64
+
65
+ ul.tests > li[data-status="success"] {
66
+ color: $green;
67
+ }
68
+
69
+ ul.tests > li[data-status="failed"] {
70
+ color: $red;
71
+ }
72
+
73
+
74
+ #Test > iframe {
75
+ display: none;
76
+ }
@@ -0,0 +1,11 @@
1
+ $light-blue: #EBEFF3;
2
+ $gray-blue: #98A7B5;
3
+ $dark-blue: #3B4752;
4
+
5
+ $white: #FFFFFF;
6
+
7
+ $light-green: #81DE81;
8
+ $green: #006F00;
9
+
10
+ $light-red: #F7C4C4;
11
+ $red: #C30000;
@@ -0,0 +1,197 @@
1
+ /* http://prismjs.com/download.html?themes=prism&languages=markup+css+clike+javascript&plugins=line-numbers */
2
+ /**
3
+ * prism.js default theme for JavaScript, CSS and HTML
4
+ * Based on dabblet (http://dabblet.com)
5
+ * @author Lea Verou
6
+ */
7
+
8
+ code[class*="language-"],
9
+ pre[class*="language-"] {
10
+ color: black;
11
+ background: none;
12
+ font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
13
+ text-align: left;
14
+ white-space: pre;
15
+ word-spacing: normal;
16
+ word-break: normal;
17
+ word-wrap: normal;
18
+ line-height: 1.5;
19
+
20
+ -moz-tab-size: 4;
21
+ -o-tab-size: 4;
22
+ tab-size: 4;
23
+
24
+ -webkit-hyphens: none;
25
+ -moz-hyphens: none;
26
+ -ms-hyphens: none;
27
+ hyphens: none;
28
+ }
29
+
30
+ pre[class*="language-"]::-moz-selection, pre[class*="language-"] ::-moz-selection,
31
+ code[class*="language-"]::-moz-selection, code[class*="language-"] ::-moz-selection {
32
+ text-shadow: none;
33
+ background: #b3d4fc;
34
+ }
35
+
36
+ pre[class*="language-"]::selection, pre[class*="language-"] ::selection,
37
+ code[class*="language-"]::selection, code[class*="language-"] ::selection {
38
+ text-shadow: none;
39
+ background: #b3d4fc;
40
+ }
41
+
42
+ @media print {
43
+ code[class*="language-"],
44
+ pre[class*="language-"] {
45
+ text-shadow: none;
46
+ }
47
+ }
48
+
49
+ /* Code blocks */
50
+ pre[class*="language-"] {
51
+ padding: 1em;
52
+ margin: .5em 0;
53
+ overflow: auto;
54
+ }
55
+
56
+ :not(pre) > code[class*="language-"],
57
+ pre[class*="language-"] {
58
+ background: $white;
59
+ }
60
+
61
+ /* Inline code */
62
+ :not(pre) > code[class*="language-"] {
63
+ padding: .1em;
64
+ border-radius: .3em;
65
+ white-space: normal;
66
+ }
67
+
68
+ .token.comment,
69
+ .token.prolog,
70
+ .token.doctype,
71
+ .token.cdata {
72
+ color: slategray;
73
+ }
74
+
75
+ .token.punctuation {
76
+ color: #999;
77
+ }
78
+
79
+ .namespace {
80
+ opacity: .7;
81
+ }
82
+
83
+ .token.property,
84
+ .token.tag,
85
+ .token.boolean,
86
+ .token.number,
87
+ .token.constant,
88
+ .token.symbol,
89
+ .token.deleted {
90
+ color: #905;
91
+ }
92
+
93
+ .token.selector,
94
+ .token.attr-name,
95
+ .token.string,
96
+ .token.char,
97
+ .token.builtin,
98
+ .token.inserted {
99
+ color: #690;
100
+ }
101
+
102
+ .token.operator,
103
+ .token.entity,
104
+ .token.url,
105
+ .language-css .token.string,
106
+ .style .token.string {
107
+ color: #a67f59;
108
+ background: hsla(0, 0%, 100%, .5);
109
+ }
110
+
111
+ .token.atrule,
112
+ .token.attr-value,
113
+ .token.keyword {
114
+ color: #07a;
115
+ }
116
+
117
+ .token.function {
118
+ color: #DD4A68;
119
+ }
120
+
121
+ .token.regex,
122
+ .token.important,
123
+ .token.variable {
124
+ color: #e90;
125
+ }
126
+
127
+ .token.important,
128
+ .token.bold {
129
+ font-weight: bold;
130
+ }
131
+ .token.italic {
132
+ font-style: italic;
133
+ }
134
+
135
+ .token.entity {
136
+ cursor: help;
137
+ }
138
+
139
+ pre.line-numbers {
140
+ position: relative;
141
+ padding-left: 3.8em;
142
+ counter-reset: linenumber;
143
+ }
144
+
145
+ pre.line-numbers > code {
146
+ position: relative;
147
+ }
148
+
149
+ .line-numbers .line-numbers-rows {
150
+ position: absolute;
151
+ pointer-events: none;
152
+ top: 0;
153
+ font-size: 100%;
154
+ left: -3.8em;
155
+ width: 3em; /* works for line-numbers below 1000 lines */
156
+ letter-spacing: -1px;
157
+ border-right: 1px solid #999;
158
+
159
+ -webkit-user-select: none;
160
+ -moz-user-select: none;
161
+ -ms-user-select: none;
162
+ user-select: none;
163
+
164
+ line-height: 150%;
165
+ }
166
+
167
+ .line-numbers-rows > span {
168
+ position: relative;
169
+ pointer-events: none;
170
+ display: block;
171
+ counter-increment: linenumber;
172
+ height: 1.5em;
173
+ }
174
+
175
+ .line-numbers-rows > span:before {
176
+ position: absolute;
177
+ content: counter(linenumber);
178
+ color: #999;
179
+ display: block;
180
+ right: 0.8em;
181
+ text-align: right;
182
+ z-index: 1;
183
+ }
184
+
185
+ .line-numbers-rows > span.error:after {
186
+ content: '';
187
+ display: block;
188
+ border-radius: 999px;
189
+ position: absolute;
190
+ left: 1em;
191
+ top: 0.1em;
192
+ right: 0.2em;
193
+ bottom: 0.1em;
194
+
195
+ background: $light-red;
196
+ box-shadow: 0 1px 0 0 $white;
197
+ }
@@ -0,0 +1,2 @@
1
+ class ApplicationController < ActionController::Base
2
+ end
@@ -0,0 +1,29 @@
1
+ class TestsController < ApplicationController
2
+ layout false, only: [:run]
3
+
4
+ def index
5
+ @directories = Specter::Engine.paths['test/javascript'].existent.map do |dir|
6
+ Pathname.new(dir)
7
+ end.select do |dir|
8
+ test = Specter::Test.new(Pathname.new(dir))
9
+ test.valid?
10
+ end
11
+ end
12
+
13
+ def show
14
+ directory = Specter::Engine.paths['test/javascript'].existent.select do |dir|
15
+ Pathname.new(dir).basename.to_s === params[:id]
16
+ end.first
17
+
18
+ @test = Specter::Test.new(Pathname.new(directory))
19
+ end
20
+
21
+ def run
22
+ directory = Specter::Engine.paths['test/javascript'].existent.select do |dir|
23
+ Pathname.new(dir).basename.to_s === params[:id]
24
+ end.first
25
+
26
+ @test = Specter::Test.new(Pathname.new(directory))
27
+
28
+ end
29
+ end