Sha256: 71e4745a3bb506f5116717fdefb052ef970919bf5881bdeae975a0fbcaacfe55

Contents?: true

Size: 1.2 KB

Versions: 12

Compression:

Stored size: 1.2 KB

Contents

require 'spec_helper'

module Calagator

describe ApplicationController, :type => :controller do
  describe "#append_flash" do
    before :each do
      flash.clear
    end

    it "should set flash message if one isn't set already" do
      controller.send(:append_flash, :failure, "Hello.")
      expect(flash[:failure]).to eq "Hello."
    end

    it "should append flash message if one is already set" do
      controller.send(:append_flash, :failure, "Hello.")
      controller.send(:append_flash, :failure, "World.")
      expect(flash[:failure]).to eq "Hello. World."
    end
  end

  describe "#help" do
    it "should respond to a view helper method" do
      expect(controller.send(:help)).to respond_to :link_to
    end

    it "should not respond to an invalid method" do
      expect(controller.send(:help)).not_to respond_to :no_such_method
    end
  end

  describe "#escape_once" do
    let(:raw) { "this & that" }
    let(:escaped) { "this & that" }

    it "should escape raw string" do
      expect(controller.send(:escape_once, raw)).to eq escaped
    end

    it "should not escape an already escaped string" do
      expect(controller.send(:escape_once, escaped)).to eq escaped
    end
  end
end

end

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
grokus-1.0.0.9 spec/controllers/calagator/application_controller_spec.rb
grokus-1.0.0.8 spec/controllers/calagator/application_controller_spec.rb
grokus-1.0.0.7 spec/controllers/calagator/application_controller_spec.rb
grokus-1.0.0.6 spec/controllers/calagator/application_controller_spec.rb
grokus-1.0.0.5 spec/controllers/calagator/application_controller_spec.rb
grokus-1.0.0.3 spec/controllers/calagator/application_controller_spec.rb
grokus-1.0.0.2 spec/controllers/calagator/application_controller_spec.rb
grokus-1.0.0.1 spec/controllers/calagator/application_controller_spec.rb
calagator-1.0.0.rc3 spec/controllers/calagator/application_controller_spec.rb
calagator-1.0.0.rc2 spec/controllers/calagator/application_controller_spec.rb
calagator-1.0.0.rc1 spec/controllers/calagator/application_controller_spec.rb
calagator-0.0.1.pre1 spec/controllers/calagator/application_controller_spec.rb