Sha256: 31c63079d3b5e37c5232defb3b093ccdd452917cb17cf11ffea506f199286d95

Contents?: true

Size: 1.96 KB

Versions: 11

Compression:

Stored size: 1.96 KB

Contents

require 'spec_helper'

include DynamicFieldsets

describe FieldWithFieldOptions do
  it "should not use CheckboxField to test the mixin" do
    pending "needs to use it's own class"
  end

  describe "class methods" do
    it { DynamicFieldsets::CheckboxField.should respond_to :acts_as_field_with_field_options }
  end

  describe "validations" do
    it "should call at_least_one_field_option"
  end

  describe "instance methods" do
    before do
      @field = DynamicFieldsets::CheckboxField.new
    end
    subject { @field }

    it { should respond_to :collect_field_records_by_fsa_and_fsc }
    describe "collect_field_records_by_fsa_and_fsc" do
      it "needs tests"
    end

    it { should respond_to :get_value_for_show }
    describe ".get_value_for_show" do
      it "needs tests"
    end

    it { should respond_to :uses_field_options? }
    describe ".uses_field_options?" do
      it "needs tests"
    end

    it { should respond_to :at_least_one_field_option }
    describe ".at_least_one_field_option" do
      it " needs tests"
    end

    it { should respond_to :options }
    describe ".options" do
      it "needs tests"
    end
  end


  describe "options" do
    before do
      pending "This code has been moved here from the field model"
    end

    it "should return options from the field options table if enabled" do
      field = DynamicFieldsets::Field.new
      field_option = mock_model(DynamicFieldsets::FieldOption)
      field_option.stub!(:enabled).and_return(true)
      field.should_receive(:field_options).and_return([field_option])
      field.options.should include field_option
    end
    it "should not return disabled options from the field options table" do
      field = DynamicFieldsets::Field.new
      field_option = mock_model(DynamicFieldsets::FieldOption)
      field_option.stub!(:enabled).and_return(false)
      field.should_receive(:field_options).and_return([field_option])
      field.options.should_not include field_option
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
dynamic_fieldsets-0.1.20 spec/field_with_field_options_spec.rb
dynamic_fieldsets-0.1.19 spec/field_with_field_options_spec.rb
dynamic_fieldsets-0.1.18 spec/field_with_field_options_spec.rb
dynamic_fieldsets-0.1.17 spec/field_with_field_options_spec.rb
dynamic_fieldsets-0.1.16 spec/field_with_field_options_spec.rb
dynamic_fieldsets-0.1.15 spec/field_with_field_options_spec.rb
dynamic_fieldsets-0.1.14 spec/field_with_field_options_spec.rb
dynamic_fieldsets-0.1.13 spec/field_with_field_options_spec.rb
dynamic_fieldsets-0.1.12 spec/field_with_field_options_spec.rb
dynamic_fieldsets-0.1.11 spec/field_with_field_options_spec.rb
dynamic_fieldsets-0.1.10 spec/field_with_field_options_spec.rb