initial tests for file change api

This commit is contained in:
Thomas Reynolds 2011-11-29 22:26:01 -08:00
parent baa3c32b45
commit 4b8beba7a3
6 changed files with 32 additions and 0 deletions

View file

@ -0,0 +1,18 @@
Feature: Preview Changes
In order to run quickly, we should update internal caches on file changes
Scenario: A template changes contents during preview
Given the Server is running at "preview-app"
And the file "source/content.html.erb" has the contents
"""
Hello World
"""
When I go to "/content.html"
Then I should see "Hello World"
And the file "source/content.html.erb" has the contents
"""
Hola Mundo
"""
When I go to "/content.html"
Then I should see "Hola Mundo"

View file

View file

@ -0,0 +1 @@
Hola Mundo

View file

@ -0,0 +1 @@
<%= yield %>

View file

@ -1,3 +1,13 @@
Given /^a project at "([^\"]*)"$/ do |dirname| Given /^a project at "([^\"]*)"$/ do |dirname|
@target = File.join(PROJECT_ROOT_PATH, "fixtures", dirname) @target = File.join(PROJECT_ROOT_PATH, "fixtures", dirname)
end
Then /^the file "([^\"]*)" has the contents$/ do |path, contents|
file_path = File.expand_path(path, @target)
File.open(file_path, 'w') { |f| f.write(contents) }
step %Q{the file "#{path}" did change}
end
Then /^the file "([^\"]*)" did change$/ do |path|
@server_inst.file_did_change(path)
end end

View file

@ -22,6 +22,8 @@ Given /^current environment is "([^\"]*)"$/ do |env|
end end
Given /^the Server is running at "([^\"]*)"$/ do |app_path| Given /^the Server is running at "([^\"]*)"$/ do |app_path|
step %Q{a project at "#{app_path}"}
initialize_commands = @initialize_commands || [] initialize_commands = @initialize_commands || []
initialize_commands.unshift lambda { initialize_commands.unshift lambda {
set :root, File.join(PROJECT_ROOT_PATH, "fixtures", app_path) set :root, File.join(PROJECT_ROOT_PATH, "fixtures", app_path)