Sha256: 1870e37120dcc051196cba53373316cac308b511bbc8985408bfc5a20952854b

Contents?: true

Size: 1.07 KB

Versions: 11

Compression:

Stored size: 1.07 KB

Contents

# frozen_string_literal: true

require "spec_helper"

describe Decidim::Proposals::FilteredProposals do
  let(:organization) { create(:organization) }
  let(:participatory_process) { create(:participatory_process, organization: organization) }
  let(:feature) { create(:proposal_feature, participatory_process: participatory_process) }
  let(:another_feature) { create(:proposal_feature, participatory_process: participatory_process) }

  let(:proposals) { create_list(:proposal, 3, feature: feature) }
  let(:old_proposals) { create_list(:proposal, 3, feature: feature, created_at: 10.days.ago) }
  let(:another_proposals) { create_list(:proposal, 3, feature: another_feature) }

  it "returns proposals included in a collection of features" do
    expect(Decidim::Proposals::FilteredProposals.for([feature, another_feature])).to match_array proposals.concat(old_proposals, another_proposals)
  end

  it "returns proposals created in a date range" do
    expect(Decidim::Proposals::FilteredProposals.for([feature, another_feature], 2.weeks.ago, 1.week.ago)).to match_array old_proposals
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
decidim-0.5.1 decidim-proposals/spec/queries/decidim/proposals/filtered_proposals_spec.rb
decidim-0.5.0 decidim-proposals/spec/queries/decidim/proposals/filtered_proposals_spec.rb
decidim-0.4.4 decidim-proposals/spec/queries/decidim/proposals/filtered_proposals_spec.rb
decidim-0.4.3 decidim-proposals/spec/queries/decidim/proposals/filtered_proposals_spec.rb
decidim-0.4.2 decidim-proposals/spec/queries/decidim/proposals/filtered_proposals_spec.rb
decidim-0.4.1 decidim-proposals/spec/queries/decidim/proposals/filtered_proposals_spec.rb
decidim-0.4.0 decidim-proposals/spec/queries/decidim/proposals/filtered_proposals_spec.rb
decidim-0.3.2 decidim-proposals/spec/queries/decidim/proposals/filtered_proposals_spec.rb
decidim-0.3.1 decidim-proposals/spec/queries/decidim/proposals/filtered_proposals_spec.rb
decidim-0.3.0 decidim-proposals/spec/queries/decidim/proposals/filtered_proposals_spec.rb
decidim-0.2.0 decidim-proposals/spec/queries/decidim/proposals/filtered_proposals_spec.rb