Sha256: edc7b82d92b45f531431eb2f1a0681dc4f5f1727da7c3dc5ada8561e0de91297

Contents?: true

Size: 1.01 KB

Versions: 5

Compression:

Stored size: 1.01 KB

Contents

require 'rspec'
$:.unshift File.expand_path('../../', __FILE__)
require 'active_mocker'
require_relative '../../unit_logger'

describe ActiveMocker::Generate do

  let(:app_root){ File.expand_path('../../../../', __FILE__)}
  let(:mock_dir){ File.join(app_root, 'sample_app_rails_4/spec/mocks')}

  before(:each) do
    ActiveMocker.config do |config|
      config.schema_file = File.join(app_root, 'sample_app_rails_4/db/schema.rb')
      config.model_dir   = File.join(app_root, 'sample_app_rails_4/app/models')
      config.mock_dir    = mock_dir
      config.logger      = UnitLogger
    end

    FileUtils.rm_rf mock_dir

  end

  subject{described_class.new}

  describe 'new' do

    before(:each) do
      subject
    end

    it 'generates all mocks files' do
      expect(File.exist? File.join(mock_dir, 'user_mock.rb')        ).to eq true
      expect(File.exist? File.join(mock_dir, 'micropost_mock.rb')   ).to eq true
      expect(File.exist? File.join(mock_dir, 'relationship_mock.rb')).to eq true
    end

  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
active_mocker-1.4.2 spec/lib/active_mocker/generate_spec.rb
active_mocker-1.4.1 spec/lib/active_mocker/generate_spec.rb
active_mocker-1.3.2 spec/lib/active_mocker/generate_spec.rb
active_mocker-1.3.1 spec/lib/active_mocker/generate_spec.rb
active_mocker-1.3 spec/lib/active_mocker/generate_spec.rb