Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Ruby Ruby Foundations Testing Test Driven Development

Have copied code correctly yet ruby tells me there is a name error

here is the code i have written after following the Test Driven Development video precisely:

require 'minitest/autorun' require 'minitest/spec'

$:.unshift File.expand_path(File.dirname(File) + '/..')

require 'lib/bank_account'

describe BankAccount do subject { BankAccount.new("Nick") }

it "should be a bank account instance" do subject.must_be_instance_of BankAccount end

it "should have a name" do subject.must_respond_to 'name' end

it "should initialize with a name" do bank_account = BankAccount.new("Nick") bank_account.name.must_equal 'Nick' end

it "should have transactions" do subject.must_respond_to 'transactions' end end

the error it gives out is:

MadelynsMiniMac-2:bank_account madelynpapineau$ ruby spec/bank_account_spec.rb spec/bank_account_spec.rb:4:in <main>': undefined local variable or methodFile' for main:Object (NameError)

can someone explain what I'm doing wrong please? THank You

1 Answer

Maciej Czuchnowski
Maciej Czuchnowski
36,440 Points

Not precisely. You have File, it should be FILE. In programming lower case and upper case letters are completely different symbols.

Worked like a charm, its hard getting used to these minor typos/errors. Thank You

Maciej Czuchnowski
Maciej Czuchnowski
36,440 Points

Get used to it :). It will all be in the minor details form now on ;)