-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathnew_project_spec.rb
54 lines (40 loc) · 1.42 KB
/
new_project_spec.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
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` } }.not_to output.to_stderr
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 %{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.7")
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