Sha256: 54fc1579beab388b81a4ffa11285fc7c8d0860b64a4ec41670ed85aa224ec340

Contents?: true

Size: 1.21 KB

Versions: 8

Compression:

Stored size: 1.21 KB

Contents

# frozen_string_literal: true

require "spec_helper"

module Decidim
  module Admin
    describe FeatureSettingsHelper do
      let(:options) { double }
      let(:attribute) { double(type: type) }
      let(:type) { :boolean }
      let(:name) { :test }

      let(:form) do
        double
      end

      def render_input
        helper.settings_attribute_input(form, attribute, name, options)
      end

      describe "booleans" do
        let(:type) { :boolean }

        it "is supported" do
          expect(form).to receive(:check_box).with(:test, options)
          render_input
        end
      end

      describe "numbers" do
        let(:type) { :integer }

        it "is supported" do
          expect(form).to receive(:number_field).with(:test, options)
          render_input
        end
      end

      describe "strings" do
        let(:type) { :string }

        it "is supported" do
          expect(form).to receive(:text_field).with(:test, options)
          render_input
        end
      end

      describe "texts" do
        let(:type) { :text }

        it "is supported" do
          expect(form).to receive(:text_area).with(:test, options)
          render_input
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
decidim-0.4.3 decidim-admin/spec/helpers/feature_settings_helper_spec.rb
decidim-0.4.2 decidim-admin/spec/helpers/feature_settings_helper_spec.rb
decidim-0.4.1 decidim-admin/spec/helpers/feature_settings_helper_spec.rb
decidim-0.4.0 decidim-admin/spec/helpers/feature_settings_helper_spec.rb
decidim-0.3.2 decidim-admin/spec/helpers/feature_settings_helper_spec.rb
decidim-0.3.1 decidim-admin/spec/helpers/feature_settings_helper_spec.rb
decidim-0.3.0 decidim-admin/spec/helpers/feature_settings_helper_spec.rb
decidim-0.2.0 decidim-admin/spec/helpers/feature_settings_helper_spec.rb