Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

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,441 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,441 Points

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