Sha256: d154e6277441a811572d22427d14ac027fafea5ae627372ead893326d54a07bd

Contents?: true

Size: 905 Bytes

Versions: 33

Compression:

Stored size: 905 Bytes

Contents

When /^I define a Metal endpoint called "([^\"]*)":$/ do |class_name, definition|
  FileUtils.mkdir_p(File.join(rails_root, 'app', 'metal'))
  file_name = File.join(rails_root, 'app', 'metal', "#{class_name.underscore}.rb")
  File.open(file_name, "w") do |file|
    file.puts "class #{class_name}"
    file.puts definition
    file.puts "end"
  end
  When %{the metal endpoint "#{class_name}" is mounted in the Rails 3 routes.rb} if rails3?
end

When /^the metal endpoint "([^\"]*)" is mounted in the Rails 3 routes.rb$/ do |class_name|
  routesrb = File.join(rails_root, "config", "routes.rb")
  routes = IO.readlines(routesrb)
  rack_route = "match '/metal(/*other)' => #{class_name}"
  routes = routes[0..-2] + [rack_route, routes[-1]]
  File.open(routesrb, "w") do |f|
    f.puts "require 'app/metal/#{class_name.underscore}'"
    routes.each do |route_line|
      f.puts route_line
    end
  end
end

Version data entries

33 entries across 33 versions & 5 rubygems

Version Path
projectlocker_pulse-1.0.0 features/step_definitions/metal_steps.rb
projectlocker_pulse-0.2.1 features/step_definitions/metal_steps.rb
projectlocker_errata-0.1.1 features/step_definitions/metal_steps.rb
projectlocker_errata-0.1.0 features/step_definitions/metal_steps.rb
honeybadger-1.3.1 features/step_definitions/metal_steps.rb
airbrake-3.1.6 features/step_definitions/metal_steps.rb
airbrake-3.1.5 features/step_definitions/metal_steps.rb
honeybadger-1.3.0 features/step_definitions/metal_steps.rb
honeybadger-1.2.1 features/step_definitions/metal_steps.rb
projectlocker_errata-0.0.2 features/step_definitions/metal_steps.rb
projectlocker_errata-0.0.1 features/step_definitions/metal_steps.rb
honeybadger-1.2.0 features/step_definitions/metal_steps.rb
airbrake-3.1.4 features/step_definitions/metal_steps.rb
airbrake-3.1.3 features/step_definitions/metal_steps.rb
honeybadger-1.1.0 features/step_definitions/metal_steps.rb
airbrake-3.1.2 features/step_definitions/metal_steps.rb
honeybadger-1.0.0 features/step_definitions/metal_steps.rb
cloudtrapper-0.0.3.pre features/step_definitions/metal_steps.rb
cloudtrapper-0.0.2.pre features/step_definitions/metal_steps.rb
airbrake-3.1.1 features/step_definitions/metal_steps.rb