Sha256: 76ff86dba41c5a731b480581fc63d60c2dcebb91e1f8ed46705b4bffce69f755

Contents?: true

Size: 897 Bytes

Versions: 56

Compression:

Stored size: 897 Bytes

Contents

require 'spec_helper'

describe Tenon::Redirect do
  describe '.active' do
    it 'should find redirects that are active' do
      expect(Tenon::Redirect).to receive(:where).with(active: true)
      Tenon::Redirect.active
    end
  end

  describe '#toggle_active!' do
    let(:redirect) { Tenon::Redirect.new(active: active) }
    context 'when active is true' do
      let(:active) { true }
      it 'should set active to false and save the redirect' do
        expect(redirect).to receive(:active=).with(false)
        expect(redirect).to receive(:save)
        redirect.toggle_active!
      end
    end

    context 'when active is false' do
      let(:active) { false }
      it 'should set active to true and save the redirect' do
        expect(redirect).to receive(:active=).with(true)
        expect(redirect).to receive(:save)
        redirect.toggle_active!
      end
    end
  end
end

Version data entries

56 entries across 56 versions & 1 rubygems

Version Path
tenon-1.1.8 spec/models/tenon/redirect_spec.rb
tenon-1.1.7 spec/models/tenon/redirect_spec.rb
tenon-1.1.6 spec/models/tenon/redirect_spec.rb
tenon-1.1.5 spec/models/tenon/redirect_spec.rb
tenon-1.1.4 spec/models/tenon/redirect_spec.rb
tenon-1.1.3 spec/models/tenon/redirect_spec.rb
tenon-1.1.2 spec/models/tenon/redirect_spec.rb
tenon-1.1.1 spec/models/tenon/redirect_spec.rb
tenon-1.0.76 spec/models/tenon/redirect_spec.rb
tenon-1.0.75 spec/models/tenon/redirect_spec.rb
tenon-1.0.74 spec/models/tenon/redirect_spec.rb
tenon-1.0.73 spec/models/tenon/redirect_spec.rb
tenon-1.0.72 spec/models/tenon/redirect_spec.rb
tenon-1.0.71 spec/models/tenon/redirect_spec.rb
tenon-1.0.70 spec/models/tenon/redirect_spec.rb
tenon-1.0.69 spec/models/tenon/redirect_spec.rb
tenon-1.0.68 spec/models/tenon/redirect_spec.rb
tenon-1.0.67 spec/models/tenon/redirect_spec.rb
tenon-1.0.66 spec/models/tenon/redirect_spec.rb
tenon-1.0.65 spec/models/tenon/redirect_spec.rb