Skip to content

Commit

Permalink
cukes passing on windows but for file command
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Evans committed Sep 6, 2011
1 parent 5d329c2 commit 615c550
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 7 deletions.
24 changes: 18 additions & 6 deletions features/steps/rails_steps.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require 'fileutils'

RAILS_APP_NAME = 'tmp_app'
FIXTURES_PATH = ROOT_PATH + "/fixtures"

Expand All @@ -12,17 +14,27 @@ def app_path
##############################################################################

Given "a Rails application set up for using dragonfly" do
raise "Problem setting up Rails app" unless `
cd #{fixture_path} &&
rm -rf #{RAILS_APP_NAME} &&
bundle exec rails new #{RAILS_APP_NAME} -m template.rb`
ok = nil
FileUtils.cd fixture_path do
FileUtils.rm_rf RAILS_APP_NAME
ok = `bundle exec rails new #{RAILS_APP_NAME} -m template.rb`
end
raise "Problem setting up Rails app" unless ok
end

Then /^the (.+) cucumber features in my Rails app should pass$/ do |filename|
puts "\n*** RUNNING FEATURES IN THE RAILS APP... ***\n"
path = File.join(fixture_path, RAILS_APP_NAME)
`cd #{path} && RAILS_ENV=cucumber rake db:migrate`
features_passed = system "cd #{path} && cucumber features/#{filename}.feature"
FileUtils.cd path do
env = ENV['RAILS_ENV']
ENV['RAILS_ENV'] = 'cucumber'
`rake db:migrate`
ENV['RAILS_ENV'] = env
end
features_passed = nil
FileUtils.cd path do
features_passed = system "cucumber features/#{filename}.feature"
end
puts "\n*** FINISHED RUNNING FEATURES IN THE RAILS APP ***\n"
raise "Features failed" unless features_passed
end
11 changes: 10 additions & 1 deletion features/support/setup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,17 @@
# A hash of <name for reference> => <dragonfly uid> pairs
TEMP_FILES = {}

Dragonfly[:images].configure_with(:imagemagick)
root_path = ROOT_PATH + '/tmp/dragonfly_cukes'
logger = Logger.new(ROOT_PATH + '/tmp/dragonfly_cukes.log')

Dragonfly[:images].configure_with(:imagemagick).configure do |c|
c.datastore.root_path = root_path
c.log = logger
end

Dragonfly[:files].configure do |c|
c.datastore.root_path = root_path
c.log = logger
c.analyser.register(Dragonfly::Analysis::FileCommandAnalyser)
end

Expand Down

0 comments on commit 615c550

Please sign in to comment.