-
Notifications
You must be signed in to change notification settings - Fork 59
Expand file tree
/
Copy pathRSpec.sublime-syntax
More file actions
88 lines (82 loc) · 2.72 KB
/
RSpec.sublime-syntax
File metadata and controls
88 lines (82 loc) · 2.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
%YAML 1.2
---
# Originally imported from https://github.com/themilkman/sublime-rspec-syntax under MIT
# http://www.sublimetext.com/docs/syntax.html
name: RSpec
file_extensions:
- spec.rb
scope: source.ruby.rspec
extends: Packages/Ruby/Ruby.sublime-syntax
variables:
# Updated list as of rspec-expectations@3.13.5
matchers: (?:contain|include|be)_?[^\s\(]*|eql?|(?:have|yield)_[^\s\(]*|raise_error|render_template|redirect_to|match_array|send_email|change|match|start_with|end_with|respond_to|exist|throw_symbol|cover|satisfy|output
contexts:
main:
- match: '(?<!\.)\b(before|after|around|shared_examples|shared_context|it_behaves_like|include_examples|it_should_behave_like|it_has_behavior)\b(?![?!])'
scope: keyword.other.rspec
- include: behaviour
- include: single-line-example
- include: pending
- include: example
- include: other
- include: expectation
- include: subject
- include: subject-variable
# include from Ruby.sublime-syntax:
- include: expressions
behaviour:
- match: ^\s*(describe|context|feature)\b
captures:
1: keyword.other.rspec.behaviour
push: behaviour-body
- match: ^\s*(RSpec)(\.)(describe)\b
captures:
1: support.module.rspec
2: punctuation.accessor.dot.ruby
3: keyword.other.rspec.behaviour
push: behaviour-body
example:
- match: ^\s*(it|its|specify|scenario|example|xit)\b
captures:
1: keyword.other.rspec.example
push:
- meta_scope: meta.rspec.example
- match: \b(do)[ \t]*$
captures:
1: keyword.control.ruby.start-block
pop: true
- include: expressions
behaviour-body:
- meta_scope: meta.rspec.behaviour
- match: '\b(do)[ \t]*$'
captures:
1: keyword.control.ruby.start-block
pop: true
- include: expressions
expectation:
- match: '\.(to|not_to)\s*({{matchers}})'
captures:
1: keyword.other.rspec.expectation
2: keyword.other.rspec.expectation
other:
- match: \b(expect|double|allow|let|expect_any_instance_of|allow_any_instance_of|is_expected|create|build)\b
captures:
1: keyword.other.rspec
pending:
- match: ^\s*(it|its|specify|scenario|example|include_context)\s+(.*\S)(?<!do)\s*$
scope: meta.rspec.pending
captures:
1: keyword.other.rspec.pending
2: string.ruby
single-line-example:
- match: '^\s*(it|its|specify|scenario|example)\s*{'
captures:
1: keyword.other.rspec.example
subject:
- match: '\b(subject!?)(?:\s*[({])'
captures:
1: keyword.other.rspec
subject-variable:
- match: '\b(subject|described_class)(?!\s*[{(])\b'
captures:
1: variable.other.rspec