Sha256: 6fcdd8c7b38156f668a0fb9455ea6f2010a02a5e1e450652d6affc6d9da99111

Contents?: true

Size: 1.17 KB

Versions: 15

Compression:

Stored size: 1.17 KB

Contents

# frozen_string_literal: true

require "spec_helper"

module Decidim
  module Meetings
    describe Meeting do
      let(:address) { ::Faker::Lorem.sentence(3) }
      let(:meeting) { build :meeting, address: address }

      subject { meeting }

      it { is_expected.to be_valid }

      include_examples "has feature"
      include_examples "has scope"
      include_examples "has category"
      include_examples "has reference"

      context "without a title" do
        let(:meeting) { build :meeting, title: nil }

        it { is_expected.not_to be_valid }
      end

      context "when geocoding is enabled" do
        let(:address) { "Carrer del Pare Llaurador, 113" }
        let(:latitude) { 40.1234 }
        let(:longitude) { 2.1234 }

        before do
          Geocoder::Lookup::Test.add_stub(
            address,
            [{
              "latitude" => latitude,
              "longitude" => longitude
            }]
          )
        end

        it "geocodes address and find latitude and longitude" do
          subject.geocode
          expect(subject.latitude).to eq(latitude)
          expect(subject.longitude).to eq(longitude)
        end
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
decidim-0.5.1 decidim-meetings/spec/models/meeting_spec.rb
decidim-0.5.0 decidim-meetings/spec/models/meeting_spec.rb
decidim-0.4.4 decidim-meetings/spec/models/meeting_spec.rb
decidim-0.4.3 decidim-meetings/spec/models/meeting_spec.rb
decidim-0.4.2 decidim-meetings/spec/models/meeting_spec.rb
decidim-0.4.1 decidim-meetings/spec/models/meeting_spec.rb
decidim-0.4.0 decidim-meetings/spec/models/meeting_spec.rb
decidim-0.3.2 decidim-meetings/spec/models/meeting_spec.rb
decidim-0.3.1 decidim-meetings/spec/models/meeting_spec.rb
decidim-0.3.0 decidim-meetings/spec/models/meeting_spec.rb
decidim-0.2.0 decidim-meetings/spec/models/meeting_spec.rb
decidim-0.1.0 decidim-meetings/spec/models/meeting_spec.rb
decidim-0.0.8.1 decidim-meetings/spec/models/meeting_spec.rb
decidim-0.0.7 decidim-meetings/spec/models/meeting_spec.rb
decidim-0.0.6 decidim-meetings/spec/models/meeting_spec.rb