Sha256: 870b0c1f9d06dc0ba0a8ef094905ca0d179bd56d469c5bb26e7ec1ae5cf1cbf3
Contents?: true
Size: 893 Bytes
Versions: 8
Compression:
Stored size: 893 Bytes
Contents
require 'spec_helper' RSpec.describe Sufia::Admin::StrategiesController do describe "#update" do before do sign_in user end let(:user) { create(:user) } let(:strategy) { Flipflop::Strategies::ActiveRecordStrategy.new(class: Sufia::Feature).key } context "when not authorized" do it "redirects away" do patch :update, params: { feature_id: '123', id: strategy } expect(response).to redirect_to root_path end end context "when authorized" do before do allow(controller).to receive_messages(current_user: user) expect(user).to receive(:groups).and_return(['admin', 'registered']) end it "is successful" do patch :update, params: { feature_id: '123', id: strategy } expect(response).to redirect_to Sufia::Engine.routes.url_helpers.admin_features_path end end end end
Version data entries
8 entries across 8 versions & 1 rubygems