mercredi 26 août 2015

Writing test in Capybarra for link_to

Hello i have some code in my view template thats a HAML file.

Please refer to last line.

%section.black_background.white_foreground
  .container
    .pricing-blurb
      %h2{ style: 'margin: 30px 0 40px;' } Increase your productivity with Trigger.
      %p
        Pricing is simple:
        %strong $8
        per employee, per month. -
        %strong That's it.
      %p This means unlimited Companies, Projects and Clients, + ongoing customer support.
      = link_to 'Get Started', new_signup_path, class: 'signup-button'

How do i make a Capybarra test for this?

I did some playing around but cant get it to work. I wrote something along the lines of this.

  it 'has the correct links in the page' do
    within '.pricing-blurb' do
      expect(find_link('Get Started')[:href]).to eql(new_signup_path)
    end  
  end

But i know its wrong because my code isn't a :href

Thank you.

Aucun commentaire:

Enregistrer un commentaire