mirror of
https://github.com/middleman/middleman.git
synced 2022-11-09 12:20:27 -05:00
Move some tests around
This commit is contained in:
parent
801a83f7cb
commit
65aebc1887
21 changed files with 25 additions and 9 deletions
|
@ -65,10 +65,7 @@ Feature: Middleman CLI
|
|||
|
||||
Scenario: Create an invalid project using Middleman directory
|
||||
When I run `middleman init MY_PROJECT -T does-not-exist-for-reals`
|
||||
Then a directory named "MY_PROJECT" should exist
|
||||
When I cd to "MY_PROJECT"
|
||||
And the file "Gemfile" should contain "middleman-blog"
|
||||
And the file ".gitignore" should exist
|
||||
Then the exit status should be 1
|
||||
|
||||
Scenario: Create a new project using github(user/repository)
|
||||
When I run `middleman init MY_PROJECT -T middleman/middleman-templates-default` interactively
|
19
middleman-cli/features/support/env.rb
Normal file
19
middleman-cli/features/support/env.rb
Normal file
|
@ -0,0 +1,19 @@
|
|||
ENV["TEST"] = "true"
|
||||
|
||||
require 'sassc'
|
||||
|
||||
require 'simplecov'
|
||||
SimpleCov.root(File.expand_path(File.dirname(__FILE__) + '/../..'))
|
||||
|
||||
require 'phantomjs/poltergeist'
|
||||
Capybara.javascript_driver = :poltergeist
|
||||
|
||||
require 'coveralls'
|
||||
Coveralls.wear!
|
||||
|
||||
require 'codeclimate-test-reporter'
|
||||
CodeClimate::TestReporter.start
|
||||
|
||||
PROJECT_ROOT_PATH = File.dirname(File.dirname(File.dirname(__FILE__)))
|
||||
require File.join(PROJECT_ROOT_PATH, 'lib', 'middleman-cli')
|
||||
require File.join(File.dirname(PROJECT_ROOT_PATH), 'middleman-core', 'lib', 'middleman-core', 'step_definitions')
|
|
@ -4,7 +4,7 @@ module Middleman::Cli
|
|||
class Init < Thor::Group
|
||||
include Thor::Actions
|
||||
|
||||
GIT_CMD = 'git'
|
||||
GIT_CMD = 'git'.freeze
|
||||
|
||||
check_unknown_options!
|
||||
|
||||
|
@ -27,8 +27,8 @@ module Middleman::Cli
|
|||
require 'fileutils'
|
||||
require 'tmpdir'
|
||||
|
||||
if !git_present?
|
||||
msg = "You need to install the git command line tool to initialize a new project. "
|
||||
unless git_present?
|
||||
msg = 'You need to install the git command line tool to initialize a new project. '
|
||||
msg << "For help installing git, please refer to GitHub's tutorial at https://help.github.com/articles/set-up-git"
|
||||
say msg, :red
|
||||
exit 1
|
||||
|
@ -63,7 +63,7 @@ module Middleman::Cli
|
|||
git_path = "#{branch_cmd}#{repo_path}"
|
||||
run("#{GIT_CMD} clone --depth 1 #{branch_cmd}#{repo_path} #{dir}")
|
||||
|
||||
if !$?.success?
|
||||
unless $?.success?
|
||||
say "Git clone command failed. Make sure git repository exists: #{git_path}", :red
|
||||
exit 1
|
||||
end
|
||||
|
@ -92,7 +92,7 @@ module Middleman::Cli
|
|||
# Copied from Bundler
|
||||
def git_present?
|
||||
return @git_present if defined?(@git_present)
|
||||
@git_present = which(GIT_CMD) || which("git.exe")
|
||||
@git_present = which(GIT_CMD) || which('git.exe')
|
||||
end
|
||||
|
||||
# Copied from Bundler
|
||||
|
|
Loading…
Reference in a new issue