Sha256: 6ad63b9f9c97d9b2414bfb5401fdbcebf9ce7045e24660085fb21fee901ef831
Contents?: true
Size: 1.38 KB
Versions: 9
Compression:
Stored size: 1.38 KB
Contents
# frozen_string_literal: true require "spec_helper" module Decidim module Proposals class OrderableFakeController < ApplicationController include Orderable end describe OrderableFakeController, type: :controller do before do allow(controller).to receive(:current_settings).and_return(current_settings) end let(:view) { controller.view_context } describe "#available_orders" do context "with votes enabled" do context "with votes hidden" do let(:current_settings) { double(:current_settings, votes_enabled?: true, votes_hidden?: true) } it "does not show most_voted option to sort" do expect(view.available_orders).not_to include("most_voted") end end context "with votes not hidden" do let(:current_settings) { double(:current_settings, votes_enabled?: true, votes_hidden?: false) } it "shows most_voted option to sort" do expect(view.available_orders).to include("most_voted") end end end context "with votes disabled" do let(:current_settings) { double(:current_settings, votes_enabled?: false) } it "doesn't show most_voted option to sort" do expect(view.available_orders).not_to include("most_voted") end end end end end end
Version data entries
9 entries across 9 versions & 1 rubygems