Sha256: be458fb784ec9474d1f8b8fe648eefa7c947a1c789db66f44e8d6dae6b6efa94

Contents?: true

Size: 1.01 KB

Versions: 5

Compression:

Stored size: 1.01 KB

Contents

module Helpers
  RAILS_APP_PATH = "tmp/rails_app"

  def titles
    titles = []
    described_class.each_group_with_title {|g, t| titles << t}
    titles
  end

  def groups
    groups = []
    described_class.each_group {|g| groups << g}
    groups
  end

  def sensors(group)
    sensors = []
    described_class.each_sensor_in_group(group) {|s| sensors << s}
    sensors
  end

  def when_i_have_rails_app
    FileUtils.mkdir_p("tmp")
    FileUtils.remove_dir(RAILS_APP_PATH, true)
    system("rails new " + RAILS_APP_PATH + " > /dev/null 2>&1").should be_true
    system("ln -s ../../../lib/generators " + RAILS_APP_PATH + "/lib/generators").should be_true
  end

  def and_run_generator(name)
    system("cd " + RAILS_APP_PATH + " && rails g #{name} > /dev/null 2>&1").should be_true
  end

  def i_should_see_route(route)
    routes = File.open(RAILS_APP_PATH + "/config/routes.rb").read
    routes.should include(route)
  end

  def i_should_see_file(file)
    File.exists?(RAILS_APP_PATH + "/" + file).should be_true
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
pulse-meter-rails-0.1.4 spec/support/helpers.rb
pulse-meter-rails-0.1.3 spec/support/helpers.rb
pulse-meter-rails-0.1.2 spec/support/helpers.rb
pulse-meter-rails-0.1.1 spec/support/helpers.rb
pulse-meter-rails-0.1.0 spec/support/helpers.rb