From bfc32ee0ef35a7953ba872cf38c986d2decba840 Mon Sep 17 00:00:00 2001 From: Thomas Reynolds Date: Tue, 20 Sep 2011 10:21:38 -0700 Subject: [PATCH] fix relative assets test --- features/fonts.feature | 16 +++++----------- features/relative_assets.feature | 10 ++++++++-- features/step_definitions/middleman_steps.rb | 13 ++++++++++--- fixtures/fonts-app/config.rb | 0 .../source/fonts/StMarie-Thin.otf | Bin .../source/stylesheets/fonts.css.sass | 0 6 files changed, 23 insertions(+), 16 deletions(-) create mode 100644 fixtures/fonts-app/config.rb rename fixtures/{test-app => fonts-app}/source/fonts/StMarie-Thin.otf (100%) rename fixtures/{test-app => fonts-app}/source/stylesheets/fonts.css.sass (100%) diff --git a/features/fonts.feature b/features/fonts.feature index 098c1960..4050386d 100644 --- a/features/fonts.feature +++ b/features/fonts.feature @@ -1,17 +1,11 @@ Feature: Web Fonts Scenario: Checking built folder for content - Given a built app at "test-app" - Then "stylesheets/fonts.css" should exist at "test-app" and include "/fonts/StMarie-Thin.otf" - And cleanup built app at "test-app" + Given a built app at "fonts-app" + Then "stylesheets/fonts.css" should exist at "fonts-app" and include "/fonts/StMarie-Thin.otf" + And cleanup built app at "fonts-app" Scenario: Rendering scss - Given the Server is running at "test-app" + Given the Server is running at "fonts-app" When I go to "/stylesheets/fonts.css" - Then I should see "/fonts/StMarie-Thin.otf" - - Scenario: Rendering scss with the feature enabled - Given "relative_assets" feature is "enabled" - And the Server is running at "test-app" - When I go to "/stylesheets/fonts.css" - Then I should see "url('../fonts/StMarie" \ No newline at end of file + Then I should see "/fonts/StMarie-Thin.otf" \ No newline at end of file diff --git a/features/relative_assets.feature b/features/relative_assets.feature index 62334f26..92348b71 100644 --- a/features/relative_assets.feature +++ b/features/relative_assets.feature @@ -20,7 +20,7 @@ Feature: Relative Assets When I go to "/stylesheets/relative_assets.css" Then I should see "url('../images/blank.gif" - Scenario: Rendering html with the feature disabled + Scenario: Rendering html with the feature enabled Given "relative_assets" feature is "enabled" And the Server is running at "test-app" When I go to "/relative_image.html" @@ -41,4 +41,10 @@ Feature: Relative Assets When I go to "/relative_image.html" Then I should not see "/images/blank.gif" Then I should not see "/img/blank.gif" - And I should see "img/blank.gif" \ No newline at end of file + And I should see "img/blank.gif" + + Scenario: Rendering scss with the feature enabled + Given "relative_assets" feature is "enabled" + And the Server is running at "fonts-app" + When I go to "/stylesheets/fonts.css" + Then I should see "url('../fonts/StMarie" \ No newline at end of file diff --git a/features/step_definitions/middleman_steps.rb b/features/step_definitions/middleman_steps.rb index e1f8a994..c97b746a 100644 --- a/features/step_definitions/middleman_steps.rb +++ b/features/step_definitions/middleman_steps.rb @@ -1,9 +1,16 @@ -Given /^"([^\"]*)" feature is "([^\"]*)"$/ do |feature, state| - @server ||= Middleman.server +Given /^a clean server$/ do + @server = Middleman.server @server.set :show_exceptions, false +end + +Given /^"([^\"]*)" feature is "([^\"]*)"$/ do |feature, state| + @server = Middleman.server + @server.set :show_exceptions, false + if state == "enabled" @server.activate(feature.to_sym) - end + end + @server.set :environment, @current_env || :development end diff --git a/fixtures/fonts-app/config.rb b/fixtures/fonts-app/config.rb new file mode 100644 index 00000000..e69de29b diff --git a/fixtures/test-app/source/fonts/StMarie-Thin.otf b/fixtures/fonts-app/source/fonts/StMarie-Thin.otf similarity index 100% rename from fixtures/test-app/source/fonts/StMarie-Thin.otf rename to fixtures/fonts-app/source/fonts/StMarie-Thin.otf diff --git a/fixtures/test-app/source/stylesheets/fonts.css.sass b/fixtures/fonts-app/source/stylesheets/fonts.css.sass similarity index 100% rename from fixtures/test-app/source/stylesheets/fonts.css.sass rename to fixtures/fonts-app/source/stylesheets/fonts.css.sass