-
Notifications
You must be signed in to change notification settings - Fork 7
My panda level - add average grade feature #5
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
base: master
Are you sure you want to change the base?
Conversation
spec/teacher_spec.rb
Outdated
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.
If you wanted to clean these assignments up, you could:
assignment1 = double("assignment 1", {:grade= => nil, :grade => 95})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.
On a more fundamental level, you were right on when you said that you felt this was a tad messy. You're having to set up many things beforehand to setup a test.
describe "should provide an average grade for the class" do
it "should provide an average grade" do
assignment_doubles = [
double(grade:95),
double(grade:50),
double(grade:85)
]
subject.stub(:assignments, assignment_doubles)
subject.average_grade.should eq(75)
end
endThere 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.
So subject.stub(:assignments, assignment_doubles) takes the place of the instance variable @assignments?
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.
That's the design. You will need to access 'assignments' instead of '@assignments' for this to work.
|
Excellent job! Your specs and cukes both read well, yay! My comments are advanced and mostly stylistic --- let me know what you think! |
|
This is exactly what I was missing. Quick relevant feedback! I spend time looking through the Ruby Docs for appropriate methods but having someone provide some input on code I've already been thinking about is a more meaningful way to go about it. Thanks for the feedback Jesse! When I change this should I resubmit or just make the changes? I'm going to do the other levels on this one so I'm going to refactor it before I do. Should I make the changes and just submit a pull request with the Tiger level features? |
Thanks! That's so awesome --- are you OK if I use that in a testimonial?
This pull request will stay open -- so if you make changes and push to your github repo, this pull will stay open and automatically update itself. You'll need to notify me of the changes in a comment on the pull -- just a simple "ping @jwo updated pull" will work. |
Of course. Go for it. Would you mind linking back to my blog in the testimonial? Actually can you wait until next week as I've changed the look and I have a new article I'm posting on Tuesday. It's at perezish.com |
|
Sure, I absolutely will link to you. Do you have a photo you'd like me to use? |
|
Here's a gravatar link: |
|
Awesome 🤘 |
Well here's my first one. I can't sort out a cleaner way to set up the average grade unit test.