Skip to content

Conversation

robwise
Copy link
Contributor

@robwise robwise commented Oct 21, 2015

No description provided.

@robwise
Copy link
Contributor Author

robwise commented Oct 21, 2015

I just thought they might be less confusing this way because before there were examples hidden inside of shared_contexts that a reader would have no idea were in there based on the name. They also hurt reusability since the examples make assumptions about what you want to test instead of just focusing on the context in which you want to do it. Therefore, I made it so that shared examples may call shared contexts, but not the other way around.

I also split the different features into different files so that it would be easier to find the specific feature tests you wanted to look at.

In the process, I noticed that some of the failure conditions were not being covered, specifically updating with bad parameters, so I wrote tests for them and realized that they were not performing as one would expect (they were successfully updating despite the bad params). Therefore, I added validation logic to pass those tests. While this is additional application logic, I think it's important that users are aware that they cannot rely on JavaScript front-end form validations only.


feature "Destroy a comment" do
include_context "Existing Comment"
context "from classic page" do
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes we want to add a delete feature on the react side! 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@justin808 Hey, don't look at me that was already in there!

@justin808
Copy link
Member

I like this. It takes a bit of getting used to the shared_context and include_context syntax. I've often used shared_examples, and now I'm going to consider using shared_context.

@robwise
Copy link
Contributor Author

robwise commented Oct 21, 2015

@justin808 It definitely does take some getting used to as well as understanding how their DSL is working under the hood. This is why Minitest appeals to some developers because it just uses plain Ruby methods instead of making its own DSL so WYSIWYG (yay acronyms!). Sometimes I just write my own plain methods even in RSpec for this reason. But, the tests were already using shared_context and shared_examples before I refactored, so I just changed them around a little.

@josiasds
Copy link
Member

@robwise This is good!

justin808 added a commit that referenced this pull request Oct 22, 2015
Refactor Feature Tests and Increase Coverage
@justin808 justin808 merged commit 8c37108 into shakacode:master Oct 22, 2015
@justin808
Copy link
Member

Thanks @robwise! LGTM!

@robwise robwise deleted the increase-coverage branch October 22, 2015 04:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants