[rspec-users] Getting Desired behaviour when I run the program, but spec still fails.

Ash Moran ash.moran at patchspace.co.uk
Wed Aug 31 07:09:21 EDT 2011


On 31 Aug 2011, at 09:22, GB Hoyt wrote:

> I'm not doing something right with the following spec and code:
> https://gist.github.com/1183066
> 
> My problem lies in the last Spec:
> 
> it "should load the contents of the text file into the action list" do
> @menu.action_list.empty?.should == false
> @menu.display_menu(@messenger)
> end My currently pain rattled body and mind is not processing the
> problem very well. I suspect I'm not writing the spec right, any help?

From just a quick skim over, these two examples look contradictory:

  it "should throw an error if asked to display a menu that does not exist" 
    @menu.display_menu(@messenger).should == "#{@menu.txtfile} does not exist!"
  end

  #Here's my problem child
  it "should load the contents of the text file into the action list" do
    @menu.action_list.empty?.should == false
    @menu.display_menu(@messenger)
  end

Do you need two separate contexts, one with `Menu.new("Title_test_real.txt")`?

BTW… s/\t/  /g ;) (Conventional Ruby indents are 2 spaces, tabs make it harder to read for people used to that)

HTH, if not, maybe someone else can see the bug.

Ash


-- 
http://www.patchspace.co.uk/
http://www.linkedin.com/in/ashmoran



More information about the rspec-users mailing list