more project creation scenarios.

This commit is contained in:
Chris Eppstein 2009-10-16 17:36:29 -07:00
parent 8b02a65ab4
commit 190c96872b
2 changed files with 50 additions and 6 deletions

View File

@ -18,4 +18,44 @@ Feature: Command Line
And a css file my_project/stylesheets/ie.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/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 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" And I am told how to conditionally link "IE" to /stylesheets/ie.css for media "screen, projection"
Scenario: Install a project with blueprint
When I enter the command: compass create bp_project --using blueprint
Then a directory bp_project/ is created
And a configuration file bp_project/config.rb is created
And a sass file bp_project/src/screen.sass is created
And a sass file bp_project/src/print.sass is created
And a sass file bp_project/src/ie.sass is created
And a sass file bp_project/src/screen.sass is compiled
And a sass file bp_project/src/print.sass is compiled
And a sass file bp_project/src/ie.sass is compiled
And a css file bp_project/stylesheets/screen.css is created
And a css file bp_project/stylesheets/print.css is created
And a css file bp_project/stylesheets/ie.css is created
And an image file bp_project/images/grid.png 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 "lt IE 8" to /stylesheets/ie.css for media "screen, projection"
Scenario: Install a project with specific directories
When I enter the command: compass create custom_project --using blueprint --sass-dir sass --css-dir css --images-dir assets/imgs
Then a directory custom_project/ is created
And a directory custom_project/sass/ is created
And a directory custom_project/css/ is created
And a directory custom_project/assets/imgs/ is created
And a sass file custom_project/sass/screen.sass is created
And a css file custom_project/css/screen.css is created
And an image file custom_project/assets/imgs/grid.png is created
Scenario: Perform a dry run of creating a project
When I enter the command: compass create my_project --dry-run
Then a directory my_project/ is not created
But a configuration file my_project/config.rb is reported created
And a sass file my_project/src/screen.sass is reported created
And a sass file my_project/src/print.sass is reported created
And a sass file my_project/src/ie.sass is reported 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"

View File

@ -28,15 +28,19 @@ end
# end # end
Then /a directory ([^ ]+) is created/ do |directory| Then /a directory ([^ ]+) is (not )?created/ do |directory, negated|
File.directory?(directory).should == true File.directory?(directory).should == !negated
end end
Then /a \w+ file ([^ ]+) is created/ do |filename| Then /an? \w+ file ([^ ]+) is created/ do |filename|
File.exists?(filename).should == true File.exists?(filename).should == true
end end
Then /a \w+ file ([^ ]+) is compiled/ do |filename| Then /an? \w+ file ([^ ]+) is reported created/ do |filename|
@last_result.should =~ /create #{Regexp.escape(filename)}/
end
Then /a \w+ file ([^ ]+) is (?:reported )?compiled/ do |filename|
@last_result.should =~ /compile #{Regexp.escape(filename)}/ @last_result.should =~ /compile #{Regexp.escape(filename)}/
end end
@ -44,6 +48,6 @@ Then /I am told how to link to ([^ ]+) for media "([^"]+)"/ do |stylesheet, medi
@last_result.should =~ %r{<link href="#{stylesheet}" media="#{media}" rel="stylesheet" type="text/css" />} @last_result.should =~ %r{<link href="#{stylesheet}" media="#{media}" rel="stylesheet" type="text/css" />}
end end
Then /I am told how to conditionally link ([^ ]+) to ([^ ]+) for media "([^"]+)"/ do |condition, stylesheet, media| 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 @last_result.should =~ %r{<!--\[if #{condition}\]>\s+<link href="#{stylesheet}" media="#{media}" rel="stylesheet" type="text/css" />\s+<!\[endif\]-->}mi
end end