Sha256: 5c0a5f935f7ca5232a4abf75eef420c30ded06980873b0be7529aff8ee43979a

Contents?: true

Size: 1.22 KB

Versions: 19

Compression:

Stored size: 1.22 KB

Contents

require 'spec_helper'
require_relative '../../../app/helpers/riveter/enquiry_form_helper'

describe Riveter::EnquiryFormHelper do
  subject {
    Class.new().tap do |klass|
      klass.send :include, Riveter::EnquiryFormHelper
    end.new()
  }

  describe "#enquiry_form_for" do
    it "delegates to default form_for" do
      enquiry = TestEnquiry.new()
      expect(subject).to receive(:form_for).with(enquiry.query_filter, :as => 'test', :url => 'test', :method => :get)

      subject.enquiry_form_for(enquiry)
    end

    it "delegates to simple form if available" do
      enquiry = TestEnquiry.new()
      expect(subject).to receive(:simple_form_for).with(enquiry.query_filter, :as => 'test', :url => 'test', :method => :get)

      subject.enquiry_form_for(enquiry)
    end
  end

  describe "#paginate_enquiry" do
    it "delegates to paginate if available" do
      enquiry = TestEnquiry.new()
      allow(enquiry).to receive(:query) { :query }

      expect(subject).to receive(:paginate).with(:query, {:a => :b})
      subject.paginate_enquiry(enquiry, {:a => :b})
    end

    it "does nothing unless paginate method exists" do
      enquiry = TestEnquiry.new()

      subject.paginate_enquiry(enquiry).should be_nil
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
riveter-0.8.3 spec/helpers/riveter/enquiry_form_helper_spec.rb
riveter-0.8.2 spec/helpers/riveter/enquiry_form_helper_spec.rb
riveter-0.8.1 spec/helpers/riveter/enquiry_form_helper_spec.rb
riveter-0.8.0 spec/helpers/riveter/enquiry_form_helper_spec.rb
riveter-0.7.0 spec/helpers/riveter/enquiry_form_helper_spec.rb
riveter-0.6.0 spec/helpers/riveter/enquiry_form_helper_spec.rb
riveter-0.3.0 spec/helpers/riveter/enquiry_form_helper_spec.rb
riveter-0.2.1 spec/helpers/riveter/enquiry_form_helper_spec.rb
riveter-0.2.0 spec/helpers/riveter/enquiry_form_helper_spec.rb
riveter-0.1.1 spec/helpers/riveter/enquiry_form_helper_spec.rb
riveter-0.0.15 spec/helpers/riveter/enquiry_form_helper_spec.rb
riveter-0.0.14 spec/helpers/riveter/enquiry_form_helper_spec.rb
riveter-0.0.13 spec/helpers/riveter/enquiry_form_helper_spec.rb
riveter-0.0.12 spec/helpers/riveter/enquiry_form_helper_spec.rb
riveter-0.0.11 spec/helpers/riveter/enquiry_form_helper_spec.rb
riveter-0.0.10 spec/helpers/riveter/enquiry_form_helper_spec.rb
riveter-0.0.9 spec/helpers/riveter/enquiry_form_helper_spec.rb
riveter-0.0.8 spec/helpers/riveter/enquiry_form_helper_spec.rb
riveter-0.0.7 spec/helpers/riveter/enquiry_form_helper_spec.rb