-
-
Notifications
You must be signed in to change notification settings - Fork 161
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add fixtures to aruba #224
Conversation
Any comments about this one @jarl-dk ? |
@jarl-dk ping... 😄 |
This PR has been opened for a while. @aslakhellesoy @mattwynne @jarl-dk Is there anyone willing to review this? I'm a bit frustrated waiting so long for feedback. |
I don't understand what a fixture is in this context. Is there an example somewhere of how this feature would be used in practice? Maybe add something to the README? |
This PR is a result of the discussion in #219. I added an example to the readme. Though I must admit, that this PR only adds some more basic stuff which will become really useful when #219 (Add copy method) is finished and makes use of this. Until then the example in the readme feels a little bit unfinished. |
I'll take a look soon. |
@mattwynne : In this context a fixture is a constant byte sequence (stored as a file). Such fixture files are sometimes used to compare binary data against. It could be images or other binary static data that you verify against in a test. e.g. |
OK, understood. Thanks for the explanation.
|
@mattwynne : As you can imagine the example |
Actually I have often used fixtures (images) to test web-applications using cucumber. So in some sense I see the fixture expansion feature (the purpose of this PR) to be more generally useful than just for CLI testing. So someday I see this feature being implemented in a more general ruby gem (cucumber or even better: mini-test). But maybe we should just start here in Aruba to demonstrate proof-of-concept. |
DEFAULT_ROOT_DIRECTORY = Dir.getwd | ||
|
||
# The root directory of aruba | ||
def root_directory |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Making aruba root directory configurable is not related to this PR (as I see it). I suggest you take that out in a seperate PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, but it makes the configuration of the fixtures more cleaner. I added a new PR for this. Would you mind to merge it first, then?
I was a bit fast on criticising I am glad that you take the time to rename it and make |
def absolute_path(*args) | ||
in_current_dir { File.expand_path File.join(*args) } | ||
warn('The use of "chmod" is deprecated. Use "filesystem_permissions" instead') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like copy paste code from chmod
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ups again. Will be fixed...
@jarl-dk Fixed. |
rebased with |
@jarl-dk @mattwynne Anything missing here? Would love to see this merged soon. Please be aware that this PR includes code from #232. So it makes sense to merge #232 first. |
I have rework abit, @dg-ratiodata Please review my rework. Still I think this feature is not exploited in feature tests where I think it belongs most. Basically the new |
This PR adds the basics to support fixtures in
aruba
. Also see #219.Things to discuss:
Use of
OpenStruct
I used
OpenStruct
here to make both paths of a fixture available: The relative one which is used to find a fixture and the absolute one, which can be used by aconsumer
of the api likecopy_file
. I can replace this by aHash
if this is preferred. ThoughOpenStruct
is part ofruby core distribution
.Use of
Pathname
I like the
relative_path_from
-functionality ofPathname
. It makes the intention of the author clear and is quite easy to use to build relative paths.Use of
%/
as fixture path prefixIt does not have a special meaning in ruby so far - besides percent classes which are not followed by
/
.Order of directories to be searched
I use "my" preferred order here, but I'm open to change it.
Commit Style
I will refactor the "commits" after all things above are discussed to make sure that there's one commit for the tests and one commit for the implementation.
Rubocop
I think we will need to "guard" this line and that line here because of
===
(3x=
). But===
returnstrue'/
falsefor both
StringAND
Regexpand thus is more flexible than
==`