Carlos, thanks! I'm off to read.... Leam
On Wednesday, June 3, 2015 at 8:07:45 AM UTC-4, Carlos Figueiredo wrote: > > You are doing a nice job on > https://github.com/LeamHall/CT_Character_Generator/blob/master/spec/lib/character_spec.rb > > . The tests look like as telling a history about character.rb, and what to > expect from that class. There are some mistakes on using RSpec and ruby at > all, but in essence they are really nice. > > Firstly mistake I noticed, are not related with RSpec, but how you are > writing Ruby. And I think you must read more how attr_writter, > attr_accessor, attr_reader works and when use them... > A good start can be > http://ruby-doc.com/docs/ProgrammingRuby/html/tut_classes.html#S2 and > http://ruby-doc.com/docs/ProgrammingRuby/html/ref_c_module.html#Module.attr_accessor > > On your test, the first thing I noticed, was that you need to use the > RSpec expectations syntax to test. Actually, I noticed that some tests are > using its syntax (at least its old syntax... 'should') but the beginning of > your tests are using nothing but '=='. > > You can read more about here: > http://www.relishapp.com/rspec/rspec-expectations/docs > or even the README on its source code here > https://github.com/rspec/rspec-expectations > > There are more issues, but I think that a good start would be invest a > time reading more about how define attributes on your class, and about > rspec-expectations. Then, I'm sure you can figure out more improvements, > they are mostly related to ruby best practices. > > Talking about best-practices... on http://betterspecs.org you can get a > bunch of advices about best practices on testing with RSpec, and on > https://github.com/bbatsov/ruby-style-guide or you can get some advices > concerning about best practices on writing Ruby code. > > I hope that these advices can help you! > Best wishes, > > Carlos Figueiredo > > On Tue, Jun 2, 2015 at 4:12 PM, leam hall <[email protected] <javascript:> > > wrote: > >> I'm slowly learning OOP and testing. Trying to figure out where to put >> tests in a small program I'm writing and could use your advice. >> >> https://github.com/LeamHall/CT_Character_Generator >> >> For anyone familiar with the Traveller RPG, this generates NPCs for a >> variety of career types. I want to add more but would like to get some >> rspec and maybe cucumber in before it gets too big. >> >> Thanks! >> >> Leam >> >> -- >> You received this message because you are subscribed to the Google Groups >> "rspec" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> To post to this group, send email to [email protected] <javascript:> >> . >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/rspec/d3c5d686-7045-42c9-9707-706716c5511f%40googlegroups.com >> >> <https://groups.google.com/d/msgid/rspec/d3c5d686-7045-42c9-9707-706716c5511f%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> > > -- You received this message because you are subscribed to the Google Groups "rspec" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/rspec/4f86b14b-7987-4cb0-a170-957573aa7c8a%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
