Sha256: ba81f2ca82287292505beb2232f996e63859c1e517e3b1e7c3f082c2ae9025bd

Contents?: true

Size: 855 Bytes

Versions: 4

Compression:

Stored size: 855 Bytes

Contents

RSpec.describe Aldous::Respondable::Shared::Flash do
  let(:flash) {described_class.new(result, flash_container)}

  let(:controller) {double 'controller', flash: flash_container}
  let(:result) {double 'result', errors: errors}
  let(:errors) {['1', '2']}
  let(:flash_container) {double 'flash container', now: flash_now}
  let(:flash_now) { {} }

  describe "#set_error" do
    context "when errors exist" do
      let(:flash_container) { {} }

      it "sets the error on the flash container" do
        flash.set_error
        expect(flash_container[:error]).to eq '1'
      end
    end

    context "when errors don't exist" do
      let(:errors) {[]}
      let(:flash_container) { {} }

      it "doesn't set the error on the flash container" do
        flash.set_error
        expect(flash_container[:error]).to eq nil
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
aldous-1.1.3 spec/aldous/respondable/shared/flash_spec.rb
aldous-1.1.2 spec/aldous/respondable/shared/flash_spec.rb
aldous-1.0.1 spec/aldous/respondable/shared/flash_spec.rb
aldous-1.0.0 spec/aldous/respondable/shared/flash_spec.rb