Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add some docs info #3114

Merged
merged 2 commits into from
Jul 31, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions doc/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ API methods are found in the codebase in the following places:
* https://github.com/publiclab/plots2/blob/master/app/api/srch/typeahead.rb
* https://github.com/publiclab/plots2/blob/master/app/api/srch/search.rb

We are beginning to consolidate API methods into the `/app/api/srch/` namespace, to reduce complexity in the non-API codebase and make the API more predictable and maintainable.
We are beginning to consolidate API methods into the `/app/api/srch/` namespace, to reduce complexity in the non-API codebase and make the API more predictable and maintainable.

RSS feeds can be found in views, such as:

Expand All @@ -60,6 +60,8 @@ https://github.com/publiclab/plots2/blob/master/app/controllers/tag_controller.r
## Token based API for creating comment
Allows a logged user or bot to post comments via API with a token.

You can generate your token to use this feature accessing your Profile on https://publiclab.org/profile/your-username (just make sure you are logged in).

API method is found in the codebase in the following place:

https://github.com/publiclab/plots2/blob/master/app/controllers/comment_controller.rb#L48-L73
Expand All @@ -71,16 +73,16 @@ https://github.com/publiclab/plots2/blob/master/app/controllers/comment_controll
**Required:**

`id=[integer]`: This value specifies the node for which comment is to be created
`format=[string]` : Specifies response format

`format=[string]` : Specifies response format

`username=[string]`: This string specifies username of user tends to create comment by this API post request
**Data Params:**

**Data Params:**

`body=[string]` : This is the actual content of the comment.
**Headers:**

**Headers:**

`TOKEN=[string]`: This string value specifies ``access_token`` of the user for authentication purpose.

Expand Down
6 changes: 5 additions & 1 deletion doc/DATA_MODEL.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,11 @@ Answers are similar to Comments, but are used in Question-type Notes, and may ea

## Users

Our primary user type is User, an Authlogic model. We also maintain a legacy `DrupalUsers` type, but are in the process of deprecating it. Users and `DrupalUsers` both have `uid` fields, which are synced one-to-one, and to fully deprecate `DrupalUsers` we must migrate these fields over to User.
Our primary user type is User. We also maintain a legacy `DrupalUsers` type, but are in the process of deprecating it. Users and `DrupalUsers` both have `uid` fields, which are synced one-to-one, and to fully deprecate `DrupalUsers` we must migrate these fields over to User.

Users can login via email using the [Authlogic gem (a simple ruby authentication
solution)](https://github.com/binarylogic/authlogic). Also, recently we have added the option to login via Twitter, Github, Facebook and Google using the
[Omniauth gem](https://github.com/publiclab/plots2/blob/master/doc/Omniauth.md).

Users each have a profile at `/profile/username`, which displays content stored in an associated `DrupalProfileValue` with `fid = 7`.

Expand Down
27 changes: 15 additions & 12 deletions doc/TESTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Run all basic rails tests with `rails test -d`. This is **no longer required for

## Pull Requests

[Open a pull request](https://services.github.com/on-demand/github-cli/open-pull-request-github) early, and link it back to the issue you're working on! We run an automatic testing service called Travis on all [pull requests](https://github.com/publiclab/plots2/pulls); this means that it can be easier to simply upload your changes and see how they run in this standard test environment. That way other contributors can see what you've done, and help you out or provide support.
[Open a pull request](https://services.github.com/on-demand/github-cli/open-pull-request-github) early, and link it back to the issue you're working on! We run an automatic testing service called Travis on all [pull requests](https://github.com/publiclab/plots2/pulls); this means that it can be easier to simply upload your changes and see how they run in this standard test environment. That way other contributors can see what you've done, and help you out or provide support.

### Working in a pull request

Expand All @@ -16,26 +16,20 @@ The tests take between 6-12 minutes to run (we're working on shortening this!) s

## Coverage

See [plots2 on CodeClimate](https://codeclimate.com/github/publiclab/plots2) for how well covered our code is with tests; we are extremely interested in building our out test suite, so please consider helping us write tests!
See [plots2 on CodeClimate](https://codeclimate.com/github/publiclab/plots2) for how well covered our code is with tests; we are extremely interested in building our out test suite, so please consider helping us write tests!

## Client-side tests

Client-side tests (for JavaScript functions) are run using [Jasmine](https://jasmine.github.io/) in [jasmine-rails](https://github.com/searls/jasmine-rails). You can run tests by navigating to `/specs/` in the browser. Headless, or command-line test running may be possible with:

`RAILS_ENV=test bundle exec rake spec:javascript`

...[if you have phantomjs installed](#phantomjs-for-javascript-tests) (see above).

## Solr tests

Solr (search) tests (generally not recommended!) require [installing the Solr search engine](#solr-search-engine) (see above). Once you've done that, you still need to turn it off in development mode before running tests, with `rake sunspot:solr:stop`. Read more about [this issue here](https://github.com/publiclab/plots2/issues/832#issuecomment-249695309).
...[if you have phantomjs installed](#phantomjs-for-javascript-tests) (see above).

****

If you get stuck on testing at any point, you can _open a pull request with your changes_ -- please add the prefix `[testing]` to the title -- which will then be automatically tested by our TravisCI service -- which runs **all tests**. If your additions are pretty basic, and you write tests against them, this may be sufficient without actually running the whole environment yourself!



## Running just one type of test

If you want to run just unit tests, to save time, you can run:
Expand All @@ -61,10 +55,19 @@ And to run just a single test within a file:

`rails test test/functional/some_file.rb:[line number of the test]`

### Testing mails in development envirmoment
### Testing mails in development environment

We are using 'letter_opener' gem to open the mails in development enviroment.
Whenever a email is sent then it will automatically catch by letter_opener and it will open in new window in development enviroment, nothing is to be done to run it, it will be done automatically.
We are using 'letter_opener' gem to open the mails in development environment.
Whenever a email is sent then it will automatically catch by letter_opener and it will open in new window in development environment, nothing is to be done to run it, it will be done automatically.
Same links would work, no modification in links are required.
It will also show us how our actual mail will look like.
Mail will be same as actual mail we will get in production.

## Testing branches
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉


We have three principle branches: a master, where all tested new features are live,
a stable and an unstable. Those last two are used to test new code before sending
them to production.
If you need to use the stable or the unstable branch,
please ask in the chatroom (https://publiclab.org/chat) if someone else is
already using it.