Sha256: 6359f9031f2a44839a5c27c3111d93c2db67bf57d84806eb677722f9a1cfe9e2

Contents?: true

Size: 1.53 KB

Versions: 6

Compression:

Stored size: 1.53 KB

Contents

# -*- encoding : utf-8 -*-

describe Card::Set::Self::Admin do
  it "renders a table" do
    Card::Auth.as_bot do
      @core = render_card :core, name: :admin
    end
    assert_view_select @core, "table"
  end

  context "#update" do
    before do
      @admin = Card[:admin]
    end

    it "triggers empty trash (with right params)" do
      Card::Auth.as_bot do
        Card["A"].delete!
        expect(Card.where(trash: true)).not_to be_empty
        Card::Env.params[:task] = :empty_trash
        @admin.update_attributes({})
        expect(Card.where(trash: true)).to be_empty
      end
    end

    # NOTE: I removed this functionality for now, because I don't think we
    # should have web access to admin functions that can incur actual data loss.

    # it "triggers deleting old revisions (with right params)" do
    #   Card::Auth.as_bot do
    #     a = Card["A"]
    #     a.update_attributes! content: "a new day"
    #     a.update_attributes! content: "another day"
    #     expect(a.actions.count).to eq(3)
    #     Card::Env.params[:task] = :delete_old_revisions
    #     @admin.update_attributes({})
    #     expect(a.actions.count).to eq(1)
    #   end
    # end

    #     it 'is trigger reference repair' do
    #       Card::Auth.as_bot do
    #         a = Card['A']
    #         puts a.references_out.count
    #         Card::Env.params[:task] = :repair_references
    #         puts a.references_out.count
    #         @all.update_attributes({})
    #         puts a.references_out.count
    #
    #       end
    #     end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
card-1.91 mod/admin/spec/set/self/admin_spec.rb
card-1.21.0 mod/admin/spec/set/self/admin_spec.rb
card-1.20.4 mod/admin/spec/set/self/admin_spec.rb
card-1.20.3 mod/admin/spec/set/self/admin_spec.rb
card-1.20.2 mod/admin/spec/set/self/admin_spec.rb
card-1.20.1 mod/admin/spec/set/self/admin_spec.rb