require 'spec_helper'

describe "fetprofiles/_fetprofile", :type => :view  do
  include RSpecHtmlMatchers
include Devise::TestHelpers
include Rails.application.routes.url_helpers
  before(:each) do  
#    @fetprofile =
 #assign(:fetprofile, stub_model(Fetprofile, FactoryGirl.attributes_for(:fetprofile)))
    default_url_options[:locale] = :de
    @fetprofile =  FactoryGirl.create(:fetprofile)
#    assign(:fetprofile,@fetprofile)
#    assign(:memberships, [])
  end

  it "has access to url_helpers" do
    expect(fetprofile_path(@fetprofile,locale: "de",theme: nil)).to match /#{@fetprofile.id}/
  end

  it "has access to url_helpers without setting nil params" do
    expect(fetprofile_path(@fetprofile)).to match /#{@fetprofile.id}/
  end
  it "renders a link" do
   allow(view).to receive(:default_url_options).and_return({locale: "de"})
#   allow(view).to receive(:fetprofile_path).and_return("")

#    view.stub!(:fetprofile_path).and_return("path")
    render partial: "fetprofiles/fetprofile", locals: {fetprofile: @fetprofile}
    expect(rendered).to have_tag("a.linkbox")
  end
end
