Sha256: 8d1cf1c7e783f65d29419a203d7c87498c006963523f15b82167304baac631ef

Contents?: true

Size: 1 KB

Versions: 2

Compression:

Stored size: 1 KB

Contents

require 'spec_helper'

module Pose
  describe Word do

    describe 'class methods' do

      describe '::remove_unused_words' do

        shared_examples 'it properly removes unused words' do
          it 'removes unused words' do
            FactoryGirl.create :word
            Word.remove_unused_words
            expect(Word.count).to eql 0
          end

          it 'does not remove used words' do
            FactoryGirl.create :posable_one
            Word.remove_unused_words
            expect(Word.count).to be > 0
          end
        end
      end

      context 'with a SQL database' do
        before :each do
          Helpers.should_receive(:is_sql_database?).and_return(true)
        end

        it_should_behave_like 'it properly removes unused words'
      end

      context 'without a SQL database' do
        before :each do
          Helpers.should_receive(:is_sql_database?).and_return(false)
        end

        it_should_behave_like 'it properly removes unused words'
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pose-2.0.1 spec/models/word_spec.rb
pose-2.0.0 spec/models/word_spec.rb