Setup Cucumber tests and wrote the first scenario for the command line.
This commit is contained in:
parent
4c4cc0e55f
commit
f6b138062f
21
features/command_line.feature
Normal file
21
features/command_line.feature
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
Feature: Command Line
|
||||||
|
In order to manage my stylesheets
|
||||||
|
As a user on the command line
|
||||||
|
I want to create a new project
|
||||||
|
|
||||||
|
Scenario: Install a project without a framework
|
||||||
|
When I enter the command: compass create my_project
|
||||||
|
Then a directory my_project/ is created
|
||||||
|
And a configuration file my_project/config.rb is created
|
||||||
|
And a sass file my_project/src/screen.sass is created
|
||||||
|
And a sass file my_project/src/print.sass is created
|
||||||
|
And a sass file my_project/src/ie.sass is created
|
||||||
|
And a sass file my_project/src/screen.sass is compiled
|
||||||
|
And a sass file my_project/src/print.sass is compiled
|
||||||
|
And a sass file my_project/src/ie.sass is compiled
|
||||||
|
And a css file my_project/stylesheets/screen.css is created
|
||||||
|
And a css file my_project/stylesheets/print.css is created
|
||||||
|
And a css file my_project/stylesheets/ie.css is created
|
||||||
|
And I am told how to link to /stylesheets/screen.css for media "screen, projection"
|
||||||
|
And I am told how to link to /stylesheets/print.css for media "print"
|
||||||
|
And I am told how to conditionally link IE to /stylesheets/ie.css for media "screen, projection"
|
49
features/step_definitions/command_line_steps.rb
Normal file
49
features/step_definitions/command_line_steps.rb
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
require 'spec/expectations'
|
||||||
|
$:.unshift(File.expand_path(File.join(File.dirname(__FILE__), '../../test')))
|
||||||
|
|
||||||
|
require 'test_helper'
|
||||||
|
|
||||||
|
require 'compass/exec'
|
||||||
|
|
||||||
|
include Compass::CommandLineHelper
|
||||||
|
include Compass::IoHelper
|
||||||
|
|
||||||
|
Before do
|
||||||
|
@cleanup_directories = []
|
||||||
|
end
|
||||||
|
|
||||||
|
After do
|
||||||
|
@cleanup_directories.each do |dir|
|
||||||
|
FileUtils.rm_rf dir
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
When /I enter the command: compass create ([^\s]+) ?(.+)?/ do |dir, args|
|
||||||
|
@cleanup_directories << dir
|
||||||
|
compass 'create', dir, *(args || '').split
|
||||||
|
end
|
||||||
|
|
||||||
|
# When /I enter the command: compass ([^\s]+) ?(.+)?/ do |command, args|
|
||||||
|
# compass command, *args.split
|
||||||
|
# end
|
||||||
|
|
||||||
|
|
||||||
|
Then /a directory ([^ ]+) is created/ do |directory|
|
||||||
|
File.directory?(directory).should == true
|
||||||
|
end
|
||||||
|
|
||||||
|
Then /a \w+ file ([^ ]+) is created/ do |filename|
|
||||||
|
File.exists?(filename).should == true
|
||||||
|
end
|
||||||
|
|
||||||
|
Then /a \w+ file ([^ ]+) is compiled/ do |filename|
|
||||||
|
@last_result.should =~ /compile #{Regexp.escape(filename)}/
|
||||||
|
end
|
||||||
|
|
||||||
|
Then /I am told how to link to ([^ ]+) for media "([^"]+)"/ do |stylesheet, media|
|
||||||
|
@last_result.should =~ %r{<link href="#{stylesheet}" media="#{media}" rel="stylesheet" type="text/css" />}
|
||||||
|
end
|
||||||
|
|
||||||
|
Then /I am told how to conditionally link ([^ ]+) to ([^ ]+) for media "([^"]+)"/ do |condition, stylesheet, media|
|
||||||
|
@last_result.should =~ %r{<!--\[if #{condition}\]>\s+<link href="#{stylesheet}" media="#{media}" rel="stylesheet" type="text/css" />\s+<!\[endif\]-->}mi
|
||||||
|
end
|
@ -91,6 +91,7 @@ module Compass::CommandLineHelper
|
|||||||
end
|
end
|
||||||
|
|
||||||
def execute(*arguments)
|
def execute(*arguments)
|
||||||
Compass::Exec::SwitchUI.new(arguments).run!
|
command_line_class = Compass::Exec::Helpers.select_appropriate_command_line_ui(arguments)
|
||||||
|
command_line_class.new(arguments).run!
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -2,6 +2,8 @@ need_gems = false
|
|||||||
|
|
||||||
lib_dir = File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib'))
|
lib_dir = File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib'))
|
||||||
$:.unshift(lib_dir) unless $:.include?(lib_dir)
|
$:.unshift(lib_dir) unless $:.include?(lib_dir)
|
||||||
|
test_dir = File.dirname(__FILE__)
|
||||||
|
$:.unshift(test_dir) unless $:.include?(test_dir)
|
||||||
|
|
||||||
# allows testing with edge Haml by creating a test/haml symlink
|
# allows testing with edge Haml by creating a test/haml symlink
|
||||||
linked_haml = File.dirname(__FILE__) + '/haml'
|
linked_haml = File.dirname(__FILE__) + '/haml'
|
||||||
@ -20,6 +22,6 @@ require 'compass'
|
|||||||
|
|
||||||
require 'test/unit'
|
require 'test/unit'
|
||||||
|
|
||||||
require File.join(File.dirname(__FILE__), 'test_case_helper')
|
require 'test_case_helper'
|
||||||
require File.join(File.dirname(__FILE__), 'io_helper')
|
require 'io_helper'
|
||||||
require File.join(File.dirname(__FILE__), 'command_line_helper')
|
require 'command_line_helper'
|
||||||
|
Loading…
Reference in New Issue
Block a user