Sha256: 83f49e1ddbf24a8624d6adb33b65a0ecb81bf9144dcda9dd12acdcf2431ff05f

Contents?: true

Size: 587 Bytes

Versions: 5

Compression:

Stored size: 587 Bytes

Contents

require 'spec_helper'
require 'shoulda/matchers'

describe Intro::TourHistory, type: :model do
  let(:history) { create(:intro_tour_history) }

  context 'associations' do
    it { should belong_to :user }

    it { should belong_to :tour }
  end

  context 'validations' do
    it { should validate_presence_of(:user) }

    it { should validate_presence_of(:tour) }
  end

  context 'create' do
    it 'increment count after touching tour' do
      expect(history.touch_count).to eq 0

      history.increment!(:touch_count)

      expect(history.touch_count).to eq 1
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
intro-0.4.1 spec/models/intro_tour_history_spec.rb
intro-0.4.0 spec/models/intro_tour_history_spec.rb
intro-0.3.0 spec/models/intro_tour_history_spec.rb
intro-0.2.0 spec/models/intro_tour_history_spec.rb
intro-0.1.0 spec/models/intro_tour_history_spec.rb