Skip to content

Commit

Permalink
Add sqlite db for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
namick committed Feb 8, 2015
1 parent b512893 commit 127515f
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 13 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
.bundle/
log/*.log
pkg/
spec/dummy/db/*.sqlite3
spec/dummy/log/*.log
spec/dummy/tmp/
spec/dummy/.sass-cache
Expand Down
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
language: ruby
rvm:
- 1.9.3
before_script:
- cd spec/dummy && bundle exec rake db:test:load && cd -
- 2.1.1
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ obfuscate_id turns a URL like this:
into something like:

http://example.com/users/2356513904

Sequential ActiveRecord ids become non-sequential, random looking, numeric ids.

# post 7000
Expand All @@ -22,7 +22,7 @@ Sequential ActiveRecord ids become non-sequential, random looking, numeric ids.
http://example.com/posts/7107163820
# post 7002
http://example.com/posts/3296163828

## Why would you want this?

If your site is scaling well, you might not want to leak that you are getting 50 new posts a minute.
Expand Down Expand Up @@ -52,7 +52,7 @@ Run bundler.

## Usage

In your model, add a single line.
In your model, add a single line.

class Post < ActiveRecord::Base
obfuscate_id
Expand Down Expand Up @@ -81,6 +81,12 @@ ActiveRecord reverses this obfuscated id back to the plain id before building th
* This is not security. obfuscate_id was created to lightly mask record id numbers for the casual user. If you need to really secure your database ids (hint, you probably don't), you need to use real encryption like AES.
* To properly generate obfuscated urls, make sure you trigger the model's `to_param` method by passing in the whole object rather than just the id; do this: `post_path(@post)` not this: `post_path(@post.id)`.

## Versions

This is tested with Rails 4.2.0. For other versions of Rails, please see [the releases](https://github.com/namick/obfuscate_id/releases).

If you are trying to get it to work with a different version of rails that is not tested, let me know in [the issues](https://github.com/namick/obfuscate_id/issues)

## Development

To run the tests, first clone the repo and run bundler:
Expand All @@ -89,12 +95,6 @@ To run the tests, first clone the repo and run bundler:
cd obfuscate_id
bundle install

Change to the dummy rails app and load the test database

cd spec/dummy
bundle exec rake db:test:load
cd -

Run the tests

bundle exec rspec spec
Expand Down
2 changes: 1 addition & 1 deletion spec/dummy/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
/.bundle

# Ignore the default SQLite database.
/db/*.sqlite3
/db/development.sqlite3
/db/*.sqlite3-journal

# Ignore all logfiles and tempfiles.
Expand Down
Binary file added spec/dummy/db/test.sqlite3
Binary file not shown.

0 comments on commit 127515f

Please sign in to comment.