Sha256: 98e933b9c02fd9803c14a547f86babc29a31139eed0f289e263644380ed14314

Contents?: true

Size: 706 Bytes

Versions: 5

Compression:

Stored size: 706 Bytes

Contents

require "spec_helper"

describe SimpleAuth::Helper do
  before do
    @helper = Object.new
    @helper.class_eval { attr_accessor :output_buffer }
    @helper.extend(SimpleAuth::Helper)
    @helper.extend(ActionView::Helpers::CaptureHelper)
  end

  it "includes module" do
    ApplicationController.included_modules.include?(SimpleAuth::Helper)
  end

  it "renders block when user is logged" do
    expect(@helper).to receive(:logged_in?).and_return(true)
    expect(@helper.when_logged { "logged" }).to eq("logged")
  end

  it "doesn't render block when user is unlogged" do
    expect(@helper).to receive(:logged_in?).and_return(false)
    expect(@helper.when_logged { "logged" }).to be_nil
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
simple_auth-2.0.4 spec/simple_auth/helper_spec.rb
simple_auth-2.0.3 spec/simple_auth/helper_spec.rb
simple_auth-2.0.2 spec/simple_auth/helper_spec.rb
simple_auth-2.0.1 spec/simple_auth/helper_spec.rb
simple_auth-2.0.0 spec/simple_auth/helper_spec.rb