Skip to content
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

questions on panda for now, will finish rest too #4

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

mikeadeleke
Copy link

I will do Tiger and Eagle after Panda.

Cannot see why why features 7 and 8 will not pass!

it "should view average grade for the class" do
class_total = ClassTotal.new
class_grade = ClassGrade.new
average_grade = @class_grade / @class_total
Copy link
Member

Choose a reason for hiding this comment

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

There's no assertion here, right? What are you testing here?

Copy link
Author

Choose a reason for hiding this comment

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

Just put in an assertion

end

def average_grade
average_grade = AverageGrade.new
Copy link
Member

Choose a reason for hiding this comment

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

Where is your "AverageGrade" class defined?

@jwo
Copy link
Member

jwo commented Dec 13, 2013

both your RSpec and cucumbers fail with these two errors:

  1. undefined local variable or method `class_total'
  2. undefined local variable or method `average_grade'

I recommend you get your rspec passing first, and then look at cucumber.

Final suggestion: you are submitting many, many episodes at once. That can't be easy to keep straight in your head. Skills build on each other. I recommend you pick one to get working, then choose another.

@mikeadeleke
Copy link
Author

Right on.

@mikeadeleke
Copy link
Author

The only thing not passing in my Rspec is the average_grade method that is clearly defined.

P.S. From now on I will look to complete one assignment at a time. Good call.

@jwo
Copy link
Member

jwo commented Dec 16, 2013

The only thing not passing in my Rspec is the average_grade method that is clearly defined.

OK, so there are a couple of problems in your code. Let's start with the exception:

1) AverageGrade should view average grade for the class
     Failure/Error: average_grade.average.should eq(class_grade/class_total)
     NameError:
       undefined local variable or method `average_grade'
     # ./spec/teacher_spec.rb:25

It's saying we are calling average_grade when it hasn't been defined. It also tells us that teacher_spec line 25 is the offending line. Let's take a look:

describe AverageGrade do
  it "should view average grade for the class" do
    average_grade.average.should eq(class_grade/class_total)
  end
end

Here you are calling average on an object named average_grade, but average_grade does not exist yet. Looking at the code, you either needed to do one of these:

describe AverageGrade do
  let(:average_grade) { AverageGrade.new }
  it "should view average grade for the class" do
    average_grade.average.should eq(class_grade/class_total)
  end
end

describe AverageGrade do
  it "should view average grade for the class" do
    AverageGrade.new.average.should eq(class_grade/class_total)
  end
end

@jwo
Copy link
Member

jwo commented Dec 16, 2013

OK, so let's say you do that... Then it will fail because the AverageGrade class is not setup correctly. Let's look at it

class AverageGrade
  def initialize 
    @average_grade = average_grade
    @class_total = class_total
    @class_grade = class_grade
  end
  #...
end

After you do AverageGrade.new, this class will have 3 variables all set to nil: @average_grade, @class_total, @class_grade

You probably wanted those as inputs to the class, but you're missing the parameters on your initialize method.

@mikeadeleke
Copy link
Author

Hmmm. Now I am getting

wrong number of arguments (0 for 3)

So now I think I should be making a method housing AverageGrade.new

@jwo
Copy link
Member

jwo commented Dec 17, 2013

yeah, check out my comments here: #4 (comment)

@jwo
Copy link
Member

jwo commented Dec 17, 2013

And more specifically, if you have a method with (average_grade, class_total, class_grade), you need to pass in the average_grade, class_total, and class_grade

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.

2 participants