File tree 1 file changed +17
-1
lines changed
1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,11 @@ module Matcher
4
4
# https://github.com/carlhuda/beard
5
5
6
6
class File
7
+
8
+ def description
9
+ 'file attributes and content'
10
+ end
11
+
7
12
def initialize ( name , &block )
8
13
@contents = [ ]
9
14
@name = name
@@ -39,6 +44,10 @@ def check_contents(file)
39
44
end
40
45
41
46
class Migration < File
47
+ def description
48
+ 'valid migration file'
49
+ end
50
+
42
51
def matches? ( root )
43
52
file_name = migration_file_name ( root , @name )
44
53
@@ -61,6 +70,10 @@ def migration_file_name(root, name) #:nodoc:
61
70
class Directory
62
71
attr_reader :tree
63
72
73
+ def description
74
+ 'has directory structure'
75
+ end
76
+
64
77
def initialize ( root = nil , &block )
65
78
@tree = { }
66
79
@negative_tree = [ ]
@@ -110,6 +123,10 @@ def matches?(root)
110
123
end
111
124
112
125
class Root < Directory
126
+ def description
127
+ 'have specified directory structure'
128
+ end
129
+
113
130
def failure_message
114
131
if @failure . is_a? ( Array ) && @failure [ 0 ] == :not
115
132
"Structure should not have had #{ @failure [ 1 ] } , but it did"
@@ -131,7 +148,6 @@ def matches?(root)
131
148
end
132
149
133
150
def have_structure ( &block )
134
- description = "File and directory structure"
135
151
error = 'You must pass a block to have_structure (Use {} instead of do/end!)'
136
152
raise RuntimeError , error unless block_given?
137
153
Root . new ( &block )
You can’t perform that action at this time.
0 commit comments