From 190c96872bc87be746db0921a9db18b7fb389b4a Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Fri, 16 Oct 2009 17:36:29 -0700 Subject: [PATCH] more project creation scenarios. --- features/command_line.feature | 42 ++++++++++++++++++- .../step_definitions/command_line_steps.rb | 14 ++++--- 2 files changed, 50 insertions(+), 6 deletions(-) diff --git a/features/command_line.feature b/features/command_line.feature index d02de470..bed6a532 100644 --- a/features/command_line.feature +++ b/features/command_line.feature @@ -18,4 +18,44 @@ Feature: Command Line 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" + 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" + diff --git a/features/step_definitions/command_line_steps.rb b/features/step_definitions/command_line_steps.rb index 96086c48..36f941a4 100644 --- a/features/step_definitions/command_line_steps.rb +++ b/features/step_definitions/command_line_steps.rb @@ -28,15 +28,19 @@ end # end -Then /a directory ([^ ]+) is created/ do |directory| - File.directory?(directory).should == true +Then /a directory ([^ ]+) is (not )?created/ do |directory, negated| + File.directory?(directory).should == !negated end -Then /a \w+ file ([^ ]+) is created/ do |filename| +Then /an? \w+ file ([^ ]+) is created/ do |filename| File.exists?(filename).should == true 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)}/ end @@ -44,6 +48,6 @@ Then /I am told how to link to ([^ ]+) for media "([^"]+)"/ do |stylesheet, medi @last_result.should =~ %r{} 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{}mi end