Sha256: cdb25b2a339c7c6a49ad35a822b4e9ec47ab4ebbcf0f35ccf84344da700789f5
Contents?: true
Size: 1.54 KB
Versions: 24
Compression:
Stored size: 1.54 KB
Contents
require 'pliny/commands/creator' require 'spec_helper' describe Pliny::Commands::Creator do before do @gen = Pliny::Commands::Creator.new(["foobar"], {}, StringIO.new) end describe "#run!" do before do FileUtils.rm_rf("/tmp/plinytest") FileUtils.mkdir_p("/tmp/plinytest") Dir.chdir("/tmp/plinytest") end it "copies the template app over" do @gen.run! assert File.exists?("./foobar") assert File.exists?("./foobar/Gemfile") end it "deletes the .git from it" do @gen.run! refute File.exists?("./foobar/.git") end it "deletes the .erb files from it" do @gen.run! assert_equal 0, Dir.glob("./foobar/**/{*,.*}.erb").length end it "changes DATABASE_URL in .env.sample to use the app name" do @gen.run! db_url = File.read("./foobar/.env.sample").split("\n").detect do |line| line.include?("DATABASE_URL=") end assert_equal "DATABASE_URL=postgres:///foobar-development", db_url end it "changes DATABASE_URL in .env.test to use the app name" do @gen.run! db_url = File.read("./foobar/.env.test").split("\n").detect do |line| line.include?("DATABASE_URL=") end assert_equal "DATABASE_URL=postgres:///foobar-test", db_url end it "changes APP_NAME in app.json to use the app name" do @gen.run! db_url = File.read("./foobar/app.json").split("\n").detect do |line| line.include?("\"name\":") end assert_equal " \"name\": \"foobar\",", db_url end end end
Version data entries
24 entries across 24 versions & 1 rubygems