require "spec_helper"

describe 'View Helpers' do

  it "should generate correct link" do
    class Testing
      include Devise::Capturable::Helpers
    end
    test = Testing.new
    link = test.link_to_capturable("Login")
    expect(link).to eq '<a href="#" class="capture_modal_open" id="capture_signin_link">Login</a>'
  end

end

require "spec_helper"

describe 'View Helpers' do

  it "should generate correct link" do
    class Testing
      include Devise::Capturable::Helpers
    end
    test = Testing.new
    link = test.link_to_capturable("Login")
    expect(link).to match(/^<a/)
    expect(link).to match(/href="#"/)
    expect(link).to match(/class="capture_modal_open"/)
    expect(link).to match(/id="capture_signin_link"/)
    expect(link).to match(/Login/)
    expect(link).to match(/<\/a>$/)
  end

end

Make view helper test more resilient to environmental differences
Make view helper test more resilient to environmental differences

The spec for the link_to_capturable view helper appears to be dependent
on some part of the Ruby development environment. On my setup and
Marcel's, the spec passes when we compare output against

    <a href="#" class="capture_modal_open" id="capture_signin_link">Login</a>

However, in Rune's environment, the passing output is

    <a class="capture_modal_open" href="#" id="capture_signin_link">Login</a>

To address this discrepancy, break down the test to look for matches
within the string, regardless of the order in which they get rendered.
