initial tests for file change api
This commit is contained in:
parent
baa3c32b45
commit
4b8beba7a3
6 changed files with 32 additions and 0 deletions
18
features/preview_changes.feature
Normal file
18
features/preview_changes.feature
Normal 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"
|
||||||
|
|
0
fixtures/preview-app/config.rb
Normal file
0
fixtures/preview-app/config.rb
Normal file
1
fixtures/preview-app/source/content.html.erb
Normal file
1
fixtures/preview-app/source/content.html.erb
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Hola Mundo
|
1
fixtures/preview-app/source/layout.erb
Normal file
1
fixtures/preview-app/source/layout.erb
Normal file
|
@ -0,0 +1 @@
|
||||||
|
<%= yield %>
|
|
@ -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
|
|
@ -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)
|
||||||
|
|
Loading…
Reference in a new issue