Sha256: b83dc83c533f4395dff0ad181ee2cee76db5df1b12dc0b23a4b7d9ea5e8bc8c5

Contents?: true

Size: 1.4 KB

Versions: 8

Compression:

Stored size: 1.4 KB

Contents

require 'rails_helper'

module Pwb
  RSpec.describe PropsController, type: :controller do
    routes { Pwb::Engine.routes }
    let(:prop_for_long_term_rent) {
      FactoryGirl.create(:pwb_prop, :long_term_rent,
                                                       price_rental_monthly_current_cents: 100_000)
    }
    let(:prop_for_sale) {
      FactoryGirl.create(:pwb_prop, :sale,
                                             price_sale_current_cents: 10_000_000)
    }

    describe 'GET #show_for_rent' do
      it 'renders correct template' do
        expect(get(:show_for_rent, params: {
                     id: prop_for_long_term_rent.id,
                     url_friendly_title: "tt"
        })).to render_template('pwb/props/show')
      end
    end

    describe 'GET #show_for_sale' do
      context 'with id of for sale prop' do
        it 'renders correct template' do
          expect(get(:show_for_sale, params: {
                       id: prop_for_sale.id,
                       url_friendly_title: "tt"
          })).to render_template('pwb/props/show')
        end
      end
      context 'with id of for rent prop' do
        it 'renders correct template' do
          expect(get(:show_for_sale, params: {
                       id: prop_for_long_term_rent.id,
                       url_friendly_title: "tt"
          })).to render_template('pwb/props/not_found')
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
pwb-1.4.0 spec/controllers/pwb/props_controller_spec.rb
pwb-1.3.0 spec/controllers/pwb/props_controller_spec.rb
pwb-1.2.0 spec/controllers/pwb/props_controller_spec.rb
pwb-1.1.1 spec/controllers/pwb/props_controller_spec.rb
pwb-1.0.0 spec/controllers/pwb/props_controller_spec.rb
pwb-0.1.1 spec/controllers/pwb/props_controller_spec.rb
pwb-0.1.0 spec/controllers/pwb/props_controller_spec.rb
pwb-0.0.2 spec/controllers/pwb/props_controller_spec.rb