Sha256: db4a00e0f37037228230d578c5d5672402acb4a4649e52666254e607d8ef443a

Contents?: true

Size: 1.54 KB

Versions: 1

Compression:

Stored size: 1.54 KB

Contents

require "spec_helper"
require "rubocop"

RSpec.describe "A new project" do
  before(:all) do
    drop_dummy_database
    remove_project_directory
    create_dummy_project
  end

  it "is correctly bundled" do
    expect { on_project { `bundle exec rails -v` } }.to_not output.to_stderr
  end

  # it "is a valid rubocop project" do
    # on_project do
    #   expect(run_rubocop).to eq(true)
    # end
  # end

  it "configures postgresql" do
    database_config_file = IO.read("#{project_path}/config/database.yml")
    gemfile = IO.read("#{project_path}/Gemfile")

    expect(database_config_file).to include(%{adapter: postgresql})
    expect(gemfile).to include %{gem 'pg'}
  end

  it "configures the correct ruby version" do
    ruby_version_file = IO.read("#{project_path}/.ruby-version")

    expect(ruby_version_file).to eq("2.5")
  end

  it "setup ssl" do
    content = IO.read("#{project_path}/config/environments/production.rb")

    expect(content).to include %{force_ssl = true}
  end

  context "seeds related issues" do
    it "creates fake data loader module" do
      content = IO.read("#{project_path}/lib/fake_data_loader.rb")

      expect(content).to include %{module FakeDataLoader}
    end

    it "creates load fake data task" do
      content = IO.read("#{project_path}/lib/tasks/db/fake_data.rake")

      expect(content).to include %{FakeDataLoader.load}
    end

    it "overrides default seed file" do
      content = IO.read("#{project_path}/db/seeds.rb")

      expect(content).to include %{without duplicating the information}
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
potassium-5.2.3 spec/features/new_project_spec.rb