Sha256: e44809c9ba5cfb6f9be8a007557e7e3deb0a139afeca2b21ff64945d27dce694

Contents?: true

Size: 1.29 KB

Versions: 8

Compression:

Stored size: 1.29 KB

Contents

require 'rails_helper'

# Specs in this file have access to a helper object that includes
# the ApplicationHelper. For example:
#
# describe ApplicationHelper do
#   describe "string concat" do
#     it "concats two strings with spaces" do
#       expect(helper.concat_strings("this","that")).to eq("this that")
#     end
#   end
# end
module Pwb
  RSpec.describe ApplicationHelper, type: :helper do
    describe "#localized_link_to" do
      context 'for devise controller' do
        it "returns correct link" do
          # helper.stub(:params).and_return({controller: "devise/sessions",locale: "en"})
          allow(helper).to receive(:params).and_return({"controller" => "devise/sessions", "locale" => "en"}.with_indifferent_access)
          # before(:all) { helper.stub!(:params).and_return(id: 1) }
          # assign(:title, "My Title")
          result = helper.localized_link_to "", {"locale" => "en"}
          expect(result).to have_link '', href: '/en'
        end
      end
      # context 'for non devise controller' do
      #   it "returns correct link" do
      #     allow(helper).to receive(:params).and_return({"locale" => "en"})
      #     result = helper.localized_link_to "",{"locale" => "en"}
      #     expect(result).to have_link '', href: '/en'
      #   end
      # end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
pwb-1.4.0 spec/helpers/pwb/application_helper_spec.rb
pwb-1.3.0 spec/helpers/pwb/application_helper_spec.rb
pwb-1.2.0 spec/helpers/pwb/application_helper_spec.rb
pwb-1.1.1 spec/helpers/pwb/application_helper_spec.rb
pwb-1.0.0 spec/helpers/pwb/application_helper_spec.rb
pwb-0.1.1 spec/helpers/pwb/application_helper_spec.rb
pwb-0.1.0 spec/helpers/pwb/application_helper_spec.rb
pwb-0.0.2 spec/helpers/pwb/application_helper_spec.rb