Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 public
Octocat-spinner-32 spec
Octocat-spinner-32 .gitignore
Octocat-spinner-32 .rspec
Octocat-spinner-32 .travis.yml
Octocat-spinner-32 Gemfile
Octocat-spinner-32 MIT-LICENSE
Octocat-spinner-32 README.md
Octocat-spinner-32 Rakefile
Octocat-spinner-32 neverland.gemspec
README.md

Neverland

Build Status

Neverland takes the pain out of testing HTML5 geolocation within your Rails app. For more on HTML5 geolocation, check out the spec.

Getting Started

To install, add the following to your Gemfile:

gem 'neverland'

In your test environment initializer, add the Neverland middleware:

Dummy::Application.configure do
  # ...

  config.middleware.use Neverland::Middleware
end

By default, Neverland will mock the result of navigator.geolocation.getCurrentLocation to latitude 42.31283, longitude -71.114287. This can be overridden by sending the parameters neverland[:latitude] and neverland[:longitude]. Error states can also be triggered by setting neverland[:error_code].

Caveats

  • The implementation naievely overrides the browser's geolocation implementation by inserting a JavaScript tag into the response.

  • The middleware will treat the response body as HTML. If you're using XHTML, this could cause issues.

Something went wrong with that request. Please try again.