Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
heptapod
heptapod
Commits
bb46f43ce66e
Commit
bb46f43c
authored
Jul 21, 2015
by
Robert Speicher
Browse files
Move custom matchers to their own files under spec/support/matchers
parent
fa8b809a2d0f
Changes
3
Hide whitespace changes
Inline
Side-by-side
spec/support/matchers.rb
deleted
100644 → 0
View file @
fa8b809a
RSpec
::
Matchers
.
define
:include_module
do
|
expected
|
match
do
described_class
.
included_modules
.
include?
(
expected
)
end
description
do
"includes the
#{
expected
}
module"
end
failure_message
do
"expected
#{
described_class
}
to include the
#{
expected
}
module"
end
end
# Extend shoulda-matchers
module
Shoulda::Matchers::ActiveModel
class
ValidateLengthOfMatcher
# Shortcut for is_at_least and is_at_most
def
is_within
(
range
)
is_at_least
(
range
.
min
)
&&
is_at_most
(
range
.
max
)
end
end
end
spec/support/matchers/include_module.rb
0 → 100644
View file @
bb46f43c
RSpec
::
Matchers
.
define
:include_module
do
|
expected
|
match
do
described_class
.
included_modules
.
include?
(
expected
)
end
description
do
"includes the
#{
expected
}
module"
end
failure_message
do
"expected
#{
described_class
}
to include the
#{
expected
}
module"
end
end
spec/support/matchers/is_within.rb
0 → 100644
View file @
bb46f43c
# Extend shoulda-matchers
module
Shoulda::Matchers::ActiveModel
class
ValidateLengthOfMatcher
# Shortcut for is_at_least and is_at_most
def
is_within
(
range
)
is_at_least
(
range
.
min
)
&&
is_at_most
(
range
.
max
)
end
end
end
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment