Sha256: 8031730aa2992463f8d31fcb324e6584bf4008ac229524234adbd7d583952577

Contents?: true

Size: 971 Bytes

Versions: 11

Compression:

Stored size: 971 Bytes

Contents

# frozen_string_literal: true

require "spec_helper"

module Decidim
  module Results
    describe ResultsController, type: :controller do
      routes { Decidim::Results::Engine.routes }

      before do
        @request.env["decidim.current_organization"] = feature.organization
        @request.env["decidim.current_feature"] = feature
      end

      describe "results" do
        let(:titles) { %w(Biure Atque Delectus Quia Fuga) }
        let(:feature) { create(:result_feature) }
        let(:results_count) { titles.size }

        it "returns a collection of results ordered by title" do
          Array.new(results_count) do |n|
            title = {}
            title[I18n.locale.to_s] = titles[n]
            create(:result, title: title, feature: feature)
          end

          results = controller.send(:results)
          expect(results.pluck(:title).map { |title| title[I18n.locale.to_s] }).to eq(titles.sort)
        end
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
decidim-0.6.8 decidim-results/spec/controllers/results_controller_spec.rb
decidim-0.6.7 decidim-results/spec/controllers/results_controller_spec.rb
decidim-0.6.6 decidim-results/spec/controllers/results_controller_spec.rb
decidim-0.6.5 decidim-results/spec/controllers/results_controller_spec.rb
decidim-0.6.4 decidim-results/spec/controllers/results_controller_spec.rb
decidim-0.6.3 decidim-results/spec/controllers/results_controller_spec.rb
decidim-0.6.2 decidim-results/spec/controllers/results_controller_spec.rb
decidim-0.6.1 decidim-results/spec/controllers/results_controller_spec.rb
decidim-0.6.0 decidim-results/spec/controllers/results_controller_spec.rb
decidim-0.5.1 decidim-results/spec/controllers/results_controller_spec.rb
decidim-0.5.0 decidim-results/spec/controllers/results_controller_spec.rb