A guard plugin for watching and running Play Framework tests
Ruby
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib/guard
.gitignore
Gemfile
LICENSE
README.md
Rakefile
guard-play.gemspec

README.md

Guard::Play

A guard plugin for automatically running tests with Play Framework.

Installation

Add this line to your application's Gemfile:

gem 'guard-play'

And then execute:

$ bundle

Or install it yourself as:

$ gem install guard-play

Usage

Then run:

$ guard init play

This will setup your Guardfile with the basics you need to watch tests. To run guard, simply run:

$ guard

Once guard is running, anytime one of the 'watched' files is changed, the specified test will be run.

The next steps are to add additional files to watch, with accompanied tests to run. For example:

guard 'play' do
  watch(/test\/([^\/]+)\.java$/) {|m| "#{m[1]}"}
  watch(/test\/(.+)\/(.+)\.java/) {|m| "#{m[1]}.#{m[2]}"} # watch tests in sub-packages
  watch("app/controllers/PostsController.java") { "PostsTest" }
end

I found it helpful to add a few helper methods for watching models and controllers:

guard 'play' do
  def model(name, test)
    self.watch("app/models/#{name}") { test }
  end
  def controller(name, test)
    self.watch("app/controllers/#{name}") {test}
  end
  model "User.java", "UserTest" # => watch("app/models/User.java") { "UserTest" }
  controller "Auth.java", "AuthTest"
end

Hopefully you find it helpful!

##Todo

  • support for selenium tests