diff --git a/middleman-core/features/collections.feature b/middleman-core/features/collections.feature index a745a5a1..053986fd 100644 --- a/middleman-core/features/collections.feature +++ b/middleman-core/features/collections.feature @@ -197,13 +197,16 @@ Feature: Collections Given a fixture app "collections-app" And a file named "config.rb" with: """ + Dir.chdir(ENV['MM_ROOT']) + ignore "/description_template.html" + live { Dir["descriptions/*.txt"] }.each do |description_name| base = File.basename(description_name, '.txt') proxy "#{base}.html", "/description_template.html", locals: { contents: File.read(description_name) - }, ignore: true + } end """ And a file named "source/description_template.html.erb" with: @@ -233,4 +236,4 @@ Feature: Collections When I go to "test1.html" Then I should see 'Not Found' When I go to "test2.html" - Then I should see 'Test2' \ No newline at end of file + Then I should see 'Test2' diff --git a/middleman-core/features/working_directory.feature b/middleman-core/features/working_directory.feature deleted file mode 100644 index 0ab9cf90..00000000 --- a/middleman-core/features/working_directory.feature +++ /dev/null @@ -1,33 +0,0 @@ -Feature: Honour working directory - Honour the working directory during testing - In order to support helpers which work with the current directories - - Scenario: Set working directory for helpers in tests - Given a fixture app "empty-app" - And a file named "source/index.html.erb" with: - """ - <%= Dir.getwd %> - """ - And the Server is running - When I go to "/index.html" - Then I should see: - """ - aruba - """ - - Scenario: Set working directory for config.rb in tests - Given a fixture app "empty-app" - And a file named "config.rb" with: - """ - set :my_working_directory, Dir.getwd - """ - And a file named "source/index.html.erb" with: - """ - <%= config[:my_working_directory] %> - """ - And the Server is running - When I go to "/index.html" - Then I should see: - """ - aruba - """ diff --git a/middleman-core/fixtures/collections-app/config.rb b/middleman-core/fixtures/collections-app/config.rb deleted file mode 100644 index ae9cb817..00000000 --- a/middleman-core/fixtures/collections-app/config.rb +++ /dev/null @@ -1,16 +0,0 @@ -collection :articles, - where: proc { |resource| - uri_match resource.url, 'blog/{year}-{month}-{day}-{title}.html' - } - -collection :tags, - where: proc { |resource| - resource.data.tags - }, - group_by: proc { |resource| - if resource.data.tags.is_a? String - resource.data.tags.split(',').map(&:strip) - else - resource.data.tags - end - } \ No newline at end of file diff --git a/middleman-core/fixtures/collections-app/source/index.html.erb b/middleman-core/fixtures/collections-app/source/index.html.erb deleted file mode 100644 index 0d6f2ad5..00000000 --- a/middleman-core/fixtures/collections-app/source/index.html.erb +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - -<% collected.articles.each do |article| %> -
  • - Article: <%= article.data.title %> - -
  • -<% end %> - - -<% collected[:tags].each do |k, items| %> -
  • - <%= k %> - <% items.each do |article| %> - <%= article.data.title %> - <% end %> -
  • -<% end %> - - - diff --git a/middleman-core/lib/middleman-core/step_definitions/middleman_steps.rb b/middleman-core/lib/middleman-core/step_definitions/middleman_steps.rb index ff256a94..8b2690cb 100644 --- a/middleman-core/lib/middleman-core/step_definitions/middleman_steps.rb +++ b/middleman-core/lib/middleman-core/step_definitions/middleman_steps.rb @@ -1,15 +1,11 @@ Then /^the file "([^\"]*)" has the contents$/ do |path, contents| - write_file(path, contents) + File.write(File.expand_path(path), contents) - # cd(".") do - @server_inst.files.find_new_files! - # end + @server_inst.files.find_new_files! end Then /^the file "([^\"]*)" is removed$/ do |path| - step %Q{I remove the file "#{path}"} + File.delete(File.expand_path(path)) - # cd(".") do - @server_inst.files.find_new_files! - # end + @server_inst.files.find_new_files! end diff --git a/middleman-core/lib/middleman-core/step_definitions/server_steps.rb b/middleman-core/lib/middleman-core/step_definitions/server_steps.rb index 1a80a118..9ff79474 100644 --- a/middleman-core/lib/middleman-core/step_definitions/server_steps.rb +++ b/middleman-core/lib/middleman-core/step_definitions/server_steps.rb @@ -42,18 +42,16 @@ Given /^the Server is running$/ do initialize_commands = @initialize_commands || [] - # cd(".") do - @server_inst = ::Middleman::Application.new do - config[:watcher_disable] = true - config[:show_exceptions] = false + @server_inst = ::Middleman::Application.new do + config[:watcher_disable] = true + config[:show_exceptions] = false - initialize_commands.each do |p| - instance_exec(&p) - end + initialize_commands.each do |p| + instance_exec(&p) end + end - Capybara.app = ::Middleman::Rack.new(@server_inst).to_app - # end + Capybara.app = ::Middleman::Rack.new(@server_inst).to_app end Given /^the Server is running at "([^\"]*)"$/ do |app_path| @@ -66,73 +64,49 @@ Given /^a template named "([^\"]*)" with:$/ do |name, string| end When /^I go to "([^\"]*)"$/ do |url| - # cd(".") do - visit(URI.encode(url).to_s) - # end + visit(URI.encode(url).to_s) end Then /^going to "([^\"]*)" should not raise an exception$/ do |url| - # cd(".") do - expect{ visit(URI.encode(url).to_s) }.to_not raise_exception - # end + expect{ visit(URI.encode(url).to_s) }.to_not raise_exception end Then /^the content type should be "([^\"]*)"$/ do |expected| - # cd(".") do - expect(page.response_headers['Content-Type']).to start_with expected - # end + expect(page.response_headers['Content-Type']).to start_with expected end Then /^I should see "([^\"]*)"$/ do |expected| - # cd(".") do - expect(page.body).to include expected - # end + expect(page.body).to include expected end Then /^I should see '([^\']*)'$/ do |expected| - # cd(".") do - expect(page.body).to include expected - # end + expect(page.body).to include expected end Then /^I should see:$/ do |expected| - # cd(".") do - expect(page.body).to include expected - # end + expect(page.body).to include expected end Then /^I should not see "([^\"]*)"$/ do |expected| - # cd(".") do - expect(page.body).not_to include expected - # end + expect(page.body).not_to include expected end Then /^I should see content matching %r{(.*)}$/ do |expected| - # cd(".") do - expect(page.body).to match(expected) - # end + expect(page.body).to match(expected) end Then /^I should not see content matching %r{(.*)}$/ do |expected| - # cd(".") do - expect(page.body).to_not match(expected) - # end + expect(page.body).to_not match(expected) end Then /^I should not see:$/ do |expected| - # cd(".") do - expect(page.body).not_to include expected - # end + expect(page.body).not_to include expected end Then /^the status code should be "([^\"]*)"$/ do |expected| - # cd(".") do - expect(page.status_code).to eq expected.to_i - # end + expect(page.status_code).to eq expected.to_i end Then /^I should see "([^\"]*)" lines$/ do |lines| - # cd(".") do - expect(page.body.chomp.split($/).length).to eq lines.to_i - # end + expect(page.body.chomp.split($/).length).to eq lines.to_i end diff --git a/middleman-core/middleman-core.gemspec b/middleman-core/middleman-core.gemspec index b43475e4..eb747036 100644 --- a/middleman-core/middleman-core.gemspec +++ b/middleman-core/middleman-core.gemspec @@ -52,7 +52,7 @@ Gem::Specification.new do |s| s.add_dependency('execjs', ['~> 2.0']) # Testing - s.add_dependency('contracts', ['~> 0.9.0']) + s.add_dependency('contracts', ['~> 0.11.0']) # Hash stuff s.add_dependency('hashie', ['~> 3.4'])