mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-05-25 09:19:15 -04:00
Compare commits
52 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3325e1e388 | ||
|
|
7947fd6e91 | ||
|
|
70bf5499b2 | ||
|
|
6b059cb4f4 | ||
|
|
efd112c4b8 | ||
|
|
5c7b760f34 | ||
|
|
81ae473972 | ||
|
|
a8171bb739 | ||
|
|
c803ed4ee6 | ||
|
|
9e41a65749 | ||
|
|
a7539df5b5 | ||
|
|
3950619877 | ||
|
|
7373fd4aa9 | ||
|
|
c3d9885525 | ||
|
|
4b5dee7bdb | ||
|
|
55d846b9e0 | ||
|
|
f2d8349a88 | ||
|
|
7c7dd7c609 | ||
|
|
d8f2c580ee | ||
|
|
2a0602468d | ||
|
|
89a9c18188 | ||
|
|
8b426da149 | ||
|
|
cab98f9750 | ||
|
|
27b7a26fee | ||
|
|
7261fae9f2 | ||
|
|
628ebd6841 | ||
|
|
61bbf7c30d | ||
|
|
e33803343a | ||
|
|
b08a448fdc | ||
|
|
7210ebfb22 | ||
|
|
039978357b | ||
|
|
7ce2481cbc | ||
|
|
5bc6af87c5 | ||
|
|
a5eaf3566e | ||
|
|
63d89be698 | ||
|
|
1b7be9f9b0 | ||
|
|
7a53e96d52 | ||
|
|
b28d146de7 | ||
|
|
55c8be8dc5 | ||
|
|
38a273459a | ||
|
|
1b07632c69 | ||
|
|
fd467acc29 | ||
|
|
ee604dc2b0 | ||
|
|
0620646c6d | ||
|
|
df9cf3f5c4 | ||
|
|
944349760a | ||
|
|
7fe75ee52a | ||
|
|
e3d7bf9a62 | ||
|
|
e6209a5906 | ||
|
|
1600dd9e0b | ||
|
|
90f444dc1a | ||
|
|
32b98a7e40 |
@@ -12,6 +12,8 @@ rvm:
|
||||
before_script:
|
||||
- psql -c 'create database growstuff_test;' -U postgres
|
||||
script:
|
||||
- script/gemfile_check
|
||||
- bundle exec script/check_contributors_md
|
||||
- bundle exec rake db:migrate --trace
|
||||
- bundle exec rspec spec/
|
||||
services:
|
||||
|
||||
@@ -69,3 +69,4 @@ submit the change with your pull request.
|
||||
- DV Dasari / [dv2](https://github.com/dv2)
|
||||
- Eric Tillberg / [Thrillberg](https://github.com/Thrillberg)
|
||||
- Lucas Nogueira / [lucasnogueira](https://github.com/lucasnogueira)
|
||||
- Charley Lewittes / [ctlewitt](https://github.com/ctlewitt)
|
||||
|
||||
6
Gemfile
6
Gemfile
@@ -2,7 +2,7 @@ source 'https://rubygems.org'
|
||||
|
||||
ruby '2.3.1'
|
||||
|
||||
gem 'rails', '~> 4.1.11'
|
||||
gem 'rails', '~> 4.2.0'
|
||||
|
||||
gem 'bundler', '>=1.1.5'
|
||||
|
||||
@@ -36,8 +36,8 @@ gem 'comfortable_mexican_sofa', '~> 1.12.0' # content management system
|
||||
gem 'kaminari' # pagination
|
||||
gem 'bootstrap-kaminari-views' # bootstrap views for kaminari
|
||||
|
||||
gem 'activemerchant', '1.33.0'
|
||||
gem 'active_utils', '1.0.5'
|
||||
gem 'activemerchant'
|
||||
gem 'active_utils'
|
||||
|
||||
# Markdown formatting for updates etc
|
||||
gem 'bluecloth'
|
||||
|
||||
163
Gemfile.lock
163
Gemfile.lock
@@ -1,49 +1,55 @@
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
actionmailer (4.1.15)
|
||||
actionpack (= 4.1.15)
|
||||
actionview (= 4.1.15)
|
||||
actionmailer (4.2.6)
|
||||
actionpack (= 4.2.6)
|
||||
actionview (= 4.2.6)
|
||||
activejob (= 4.2.6)
|
||||
mail (~> 2.5, >= 2.5.4)
|
||||
actionpack (4.1.15)
|
||||
actionview (= 4.1.15)
|
||||
activesupport (= 4.1.15)
|
||||
rack (~> 1.5.2)
|
||||
rails-dom-testing (~> 1.0, >= 1.0.5)
|
||||
actionpack (4.2.6)
|
||||
actionview (= 4.2.6)
|
||||
activesupport (= 4.2.6)
|
||||
rack (~> 1.6)
|
||||
rack-test (~> 0.6.2)
|
||||
actionview (4.1.15)
|
||||
activesupport (= 4.1.15)
|
||||
rails-dom-testing (~> 1.0, >= 1.0.5)
|
||||
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
||||
actionview (4.2.6)
|
||||
activesupport (= 4.2.6)
|
||||
builder (~> 3.1)
|
||||
erubis (~> 2.7.0)
|
||||
rails-dom-testing (~> 1.0, >= 1.0.5)
|
||||
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
||||
active_link_to (1.0.3)
|
||||
actionpack
|
||||
active_merchant-paypal-bogus-gateway (0.1.0)
|
||||
activemerchant
|
||||
active_utils (1.0.5)
|
||||
activesupport (>= 2.3.11)
|
||||
active_utils (3.2.0)
|
||||
activesupport (>= 3.2)
|
||||
i18n
|
||||
activemerchant (1.33.0)
|
||||
active_utils (>= 1.0.2)
|
||||
activesupport (>= 2.3.14)
|
||||
builder (>= 2.0.0)
|
||||
i18n
|
||||
json (>= 1.5.1)
|
||||
money
|
||||
nokogiri
|
||||
activemodel (4.1.15)
|
||||
activesupport (= 4.1.15)
|
||||
activejob (4.2.6)
|
||||
activesupport (= 4.2.6)
|
||||
globalid (>= 0.3.0)
|
||||
activemerchant (1.59.0)
|
||||
activesupport (>= 3.2.14, < 5.1)
|
||||
builder (>= 2.1.2, < 4.0.0)
|
||||
i18n (>= 0.6.9)
|
||||
nokogiri (~> 1.4)
|
||||
activemodel (4.2.6)
|
||||
activesupport (= 4.2.6)
|
||||
builder (~> 3.1)
|
||||
activerecord (4.1.15)
|
||||
activemodel (= 4.1.15)
|
||||
activesupport (= 4.1.15)
|
||||
arel (~> 5.0.0)
|
||||
activesupport (4.1.15)
|
||||
i18n (~> 0.6, >= 0.6.9)
|
||||
activerecord (4.2.6)
|
||||
activemodel (= 4.2.6)
|
||||
activesupport (= 4.2.6)
|
||||
arel (~> 6.0)
|
||||
activesupport (4.2.6)
|
||||
i18n (~> 0.7)
|
||||
json (~> 1.7, >= 1.7.7)
|
||||
minitest (~> 5.1)
|
||||
thread_safe (~> 0.1)
|
||||
thread_safe (~> 0.3, >= 0.3.4)
|
||||
tzinfo (~> 1.1)
|
||||
addressable (2.4.0)
|
||||
arel (5.0.1.20140414130214)
|
||||
arel (6.0.3)
|
||||
ast (2.3.0)
|
||||
autoprefixer-rails (6.3.6.2)
|
||||
execjs
|
||||
@@ -67,7 +73,7 @@ GEM
|
||||
bootstrap_form (2.3.0)
|
||||
builder (3.2.2)
|
||||
byebug (9.0.5)
|
||||
cancancan (1.14.0)
|
||||
cancancan (1.15.0)
|
||||
capybara (2.7.1)
|
||||
addressable
|
||||
mime-types (>= 1.16)
|
||||
@@ -88,7 +94,7 @@ GEM
|
||||
cliver (0.3.2)
|
||||
cocaine (0.5.8)
|
||||
climate_control (>= 0.0.3, < 1.0)
|
||||
codeclimate-test-reporter (0.5.1)
|
||||
codeclimate-test-reporter (0.6.0)
|
||||
simplecov (>= 0.7.1, < 1.0.0)
|
||||
codemirror-rails (5.11)
|
||||
railties (>= 3.0, < 5)
|
||||
@@ -139,21 +145,21 @@ GEM
|
||||
json
|
||||
thread
|
||||
thread_safe
|
||||
elasticsearch (1.0.17)
|
||||
elasticsearch-api (= 1.0.17)
|
||||
elasticsearch-transport (= 1.0.17)
|
||||
elasticsearch-api (1.0.17)
|
||||
elasticsearch (1.0.18)
|
||||
elasticsearch-api (= 1.0.18)
|
||||
elasticsearch-transport (= 1.0.18)
|
||||
elasticsearch-api (1.0.18)
|
||||
multi_json
|
||||
elasticsearch-model (0.1.9)
|
||||
activesupport (> 3)
|
||||
elasticsearch (> 0.4)
|
||||
hashie
|
||||
elasticsearch-rails (0.1.9)
|
||||
elasticsearch-transport (1.0.17)
|
||||
elasticsearch-transport (1.0.18)
|
||||
faraday
|
||||
multi_json
|
||||
erubis (2.7.0)
|
||||
excon (0.49.0)
|
||||
excon (0.50.1)
|
||||
execjs (2.7.0)
|
||||
factory_girl (4.7.0)
|
||||
activesupport (>= 3.0.0)
|
||||
@@ -165,7 +171,7 @@ GEM
|
||||
ffi (1.9.10)
|
||||
figaro (1.1.1)
|
||||
thor (~> 0.14)
|
||||
flickraw (0.9.8)
|
||||
flickraw (0.9.9)
|
||||
font-awesome-sass (4.6.2)
|
||||
sass (>= 3.2)
|
||||
formatador (0.2.5)
|
||||
@@ -175,6 +181,8 @@ GEM
|
||||
gibbon (1.2.1)
|
||||
httparty
|
||||
multi_json (>= 1.9.0)
|
||||
globalid (0.3.6)
|
||||
activesupport (>= 4.1.0)
|
||||
gravatar-ultimate (2.0.0)
|
||||
activesupport (>= 2.3.14)
|
||||
rack
|
||||
@@ -224,8 +232,9 @@ GEM
|
||||
parser (>= 2.2.3.0)
|
||||
term-ansicolor (>= 1.3.2)
|
||||
terminal-table (>= 1.5.1)
|
||||
jquery-rails (3.1.4)
|
||||
railties (>= 3.0, < 5.0)
|
||||
jquery-rails (4.1.1)
|
||||
rails-dom-testing (>= 1, < 3)
|
||||
railties (>= 4.2.0)
|
||||
thor (>= 0.14, < 2.0)
|
||||
jquery-ui-rails (5.0.5)
|
||||
railties (>= 3.2.16)
|
||||
@@ -249,6 +258,8 @@ GEM
|
||||
rb-fsevent (~> 0.9, >= 0.9.4)
|
||||
rb-inotify (~> 0.9, >= 0.9.7)
|
||||
ruby_dep (~> 1.2)
|
||||
loofah (2.0.3)
|
||||
nokogiri (>= 1.5.9)
|
||||
lumberjack (1.0.10)
|
||||
mail (2.6.4)
|
||||
mime-types (>= 1.16, < 4)
|
||||
@@ -260,14 +271,11 @@ GEM
|
||||
mimemagic (0.3.0)
|
||||
mini_portile2 (2.1.0)
|
||||
minitest (5.9.0)
|
||||
money (6.7.1)
|
||||
i18n (>= 0.6.4, <= 0.7.0)
|
||||
sixarm_ruby_unaccent (>= 1.1.1, < 2)
|
||||
multi_json (1.11.3)
|
||||
multi_xml (0.5.5)
|
||||
multipart-post (2.0.0)
|
||||
nenv (0.3.0)
|
||||
newrelic_rpm (3.15.2.317)
|
||||
newrelic_rpm (3.16.0.318)
|
||||
nokogiri (1.6.8)
|
||||
mini_portile2 (~> 2.1.0)
|
||||
pkg-config (~> 1.1.7)
|
||||
@@ -300,10 +308,9 @@ GEM
|
||||
pkg-config (1.1.7)
|
||||
plupload-rails (1.2.1)
|
||||
rails (>= 3.1)
|
||||
poltergeist (1.9.0)
|
||||
poltergeist (1.10.0)
|
||||
capybara (~> 2.1)
|
||||
cliver (~> 0.3.1)
|
||||
multi_json (~> 1.0)
|
||||
websocket-driver (>= 0.2.0)
|
||||
pry (0.10.3)
|
||||
coderay (~> 1.1.0)
|
||||
@@ -311,19 +318,28 @@ GEM
|
||||
slop (~> 3.4)
|
||||
quiet_assets (1.1.0)
|
||||
railties (>= 3.1, < 5.0)
|
||||
rack (1.5.5)
|
||||
rack (1.6.4)
|
||||
rack-test (0.6.3)
|
||||
rack (>= 1.0)
|
||||
rails (4.1.15)
|
||||
actionmailer (= 4.1.15)
|
||||
actionpack (= 4.1.15)
|
||||
actionview (= 4.1.15)
|
||||
activemodel (= 4.1.15)
|
||||
activerecord (= 4.1.15)
|
||||
activesupport (= 4.1.15)
|
||||
rails (4.2.6)
|
||||
actionmailer (= 4.2.6)
|
||||
actionpack (= 4.2.6)
|
||||
actionview (= 4.2.6)
|
||||
activejob (= 4.2.6)
|
||||
activemodel (= 4.2.6)
|
||||
activerecord (= 4.2.6)
|
||||
activesupport (= 4.2.6)
|
||||
bundler (>= 1.3.0, < 2.0)
|
||||
railties (= 4.1.15)
|
||||
sprockets-rails (~> 2.0)
|
||||
railties (= 4.2.6)
|
||||
sprockets-rails
|
||||
rails-deprecated_sanitizer (1.0.3)
|
||||
activesupport (>= 4.2.0.alpha)
|
||||
rails-dom-testing (1.0.7)
|
||||
activesupport (>= 4.2.0.beta, < 5.0)
|
||||
nokogiri (~> 1.6.0)
|
||||
rails-deprecated_sanitizer (>= 1.0.1)
|
||||
rails-html-sanitizer (1.0.3)
|
||||
loofah (~> 2.0)
|
||||
rails-i18n (4.0.8)
|
||||
i18n (~> 0.7)
|
||||
railties (~> 4.0)
|
||||
@@ -332,18 +348,18 @@ GEM
|
||||
rails_stdout_logging
|
||||
rails_serve_static_assets (0.0.5)
|
||||
rails_stdout_logging (0.0.5)
|
||||
railties (4.1.15)
|
||||
actionpack (= 4.1.15)
|
||||
activesupport (= 4.1.15)
|
||||
railties (4.2.6)
|
||||
actionpack (= 4.2.6)
|
||||
activesupport (= 4.2.6)
|
||||
rake (>= 0.8.7)
|
||||
thor (>= 0.18.1, < 2.0)
|
||||
raindrops (0.16.0)
|
||||
rake (11.1.2)
|
||||
rake (11.2.2)
|
||||
rb-fsevent (0.9.7)
|
||||
rb-inotify (0.9.7)
|
||||
ffi (>= 0.5.0)
|
||||
responders (1.1.2)
|
||||
railties (>= 3.2, < 4.2)
|
||||
responders (2.2.0)
|
||||
railties (>= 4.2.0, < 5.1)
|
||||
rspec (3.4.0)
|
||||
rspec-core (~> 3.4.0)
|
||||
rspec-expectations (~> 3.4.0)
|
||||
@@ -375,13 +391,13 @@ GEM
|
||||
sexp_processor (~> 4.1)
|
||||
rubyzip (1.2.0)
|
||||
sass (3.4.22)
|
||||
sass-rails (5.0.4)
|
||||
railties (>= 4.0.0, < 5.0)
|
||||
sass-rails (5.0.5)
|
||||
railties (>= 4.0.0, < 6)
|
||||
sass (~> 3.1)
|
||||
sprockets (>= 2.8, < 4.0)
|
||||
sprockets-rails (>= 2.0, < 4.0)
|
||||
tilt (>= 1.1, < 3)
|
||||
selenium-webdriver (2.53.1)
|
||||
selenium-webdriver (2.53.4)
|
||||
childprocess (~> 0.5)
|
||||
rubyzip (~> 1.0)
|
||||
websocket (~> 1.0)
|
||||
@@ -392,15 +408,14 @@ GEM
|
||||
json (~> 1.8)
|
||||
simplecov-html (~> 0.10.0)
|
||||
simplecov-html (0.10.0)
|
||||
sixarm_ruby_unaccent (1.1.1)
|
||||
slop (3.6.0)
|
||||
sprockets (3.6.0)
|
||||
sprockets (3.6.2)
|
||||
concurrent-ruby (~> 1.0)
|
||||
rack (> 1, < 3)
|
||||
sprockets-rails (2.3.3)
|
||||
actionpack (>= 3.0)
|
||||
activesupport (>= 3.0)
|
||||
sprockets (>= 2.8, < 4.0)
|
||||
sprockets-rails (3.1.1)
|
||||
actionpack (>= 4.0)
|
||||
activesupport (>= 4.0)
|
||||
sprockets (>= 3.0.0)
|
||||
term-ansicolor (1.3.2)
|
||||
tins (~> 1.0)
|
||||
terminal-table (1.6.0)
|
||||
@@ -436,8 +451,8 @@ PLATFORMS
|
||||
|
||||
DEPENDENCIES
|
||||
active_merchant-paypal-bogus-gateway
|
||||
active_utils (= 1.0.5)
|
||||
activemerchant (= 1.33.0)
|
||||
active_utils
|
||||
activemerchant
|
||||
better_errors
|
||||
binding_of_caller
|
||||
bluecloth
|
||||
@@ -491,7 +506,7 @@ DEPENDENCIES
|
||||
poltergeist (~> 1.6)
|
||||
pry
|
||||
quiet_assets
|
||||
rails (~> 4.1.11)
|
||||
rails (~> 4.2.0)
|
||||
rails_12factor
|
||||
rake (>= 10.0.0)
|
||||
rspec-activemodel-mocks
|
||||
|
||||
14
README.md
14
README.md
@@ -20,8 +20,8 @@ encourage participation from people of all backgrounds and skill levels.
|
||||
* [Issues](http://github.com/Growstuff/growstuff/issues) (features we're
|
||||
working on, known bugs, etc)
|
||||
* [Discussion forums](http://talk.growstuff.org/) (design ideas, planning releases)
|
||||
* IRC: #growstuff on Freenode (general chat, brainstorming and troubleshooting) or [Gitter](https://gitter.im/Growstuff/growstuff)
|
||||
* [Wiki](http://wiki.growstuff.org/) (general documentation, currently down but should be fixed soon)
|
||||
* [IRC](https://webchat.freenode.net/) growstuff channel (general chat, brainstorming and troubleshooting) or [Gitter](https://gitter.im/Growstuff/growstuff)
|
||||
* [Wiki](https://github.com/Growstuff/growstuff/wiki) (general documentation, etc. Help by migrating from the [old wiki](https://web.archive.org/web/*/wiki.growstuff.org))
|
||||
|
||||
## For coders
|
||||
|
||||
@@ -29,19 +29,11 @@ Growstuff is built in Ruby on Rails and also uses JavaScript for
|
||||
frontend features. We welcome contributions -- see
|
||||
[CONTRIBUTING](CONTRIBUTING.md) for details.
|
||||
|
||||
* To set up your development environment, see [Getting started](http://wiki.growstuff.org/index.php/Development/Getting_Started).
|
||||
* To set up your development environment, see [Getting started](https://github.com/Growstuff/growstuff/wiki/New-contributor-guide).
|
||||
* We encourage [pair programming](http://wiki.growstuff.org/index.php/Pairing), especially for newer developers. [Find a pair programming partner.](http://talk.growstuff.org/t/find-a-pair-programming-partner/13)
|
||||
* Drop in to our [discussion forums](http://talk.growstuff.org/), IRC or Gitter to chat to other developers, get help, etc.
|
||||
* You may also be interested in our [API](http://wiki.growstuff.org/index.php/API).
|
||||
|
||||
The wiki is down right now, so here's what you need to do on Mac OS X to get set up.
|
||||
|
||||
```
|
||||
gem install bundle
|
||||
gem install pg -v '0.18.4' -- --with-pg-config=/Applications/Postgres.app/Contents/Versions/latest/bin/pg_config
|
||||
bundle install
|
||||
```
|
||||
|
||||
## For designers, writers, researchers, data wranglers, and other contributors
|
||||
|
||||
There are heaps of ways to get involved and contribute no matter what
|
||||
|
||||
@@ -13,17 +13,6 @@ class AlternateNamesController < ApplicationController
|
||||
end
|
||||
end
|
||||
|
||||
# GET /alternate_names/1
|
||||
# GET /alternate_names/1.json
|
||||
def show
|
||||
@alternate_name = AlternateName.find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
format.html # show.html.haml
|
||||
format.json { render json: @alternate_name }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /alternate_names/new
|
||||
# GET /alternate_names/new.json
|
||||
def new
|
||||
|
||||
@@ -14,17 +14,6 @@ class CommentsController < ApplicationController
|
||||
end
|
||||
end
|
||||
|
||||
# GET /comments/1
|
||||
# GET /comments/1.json
|
||||
def show
|
||||
@comment = Comment.find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
format.html # show.html.erb
|
||||
format.json { render json: @comment }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /comments/new
|
||||
# GET /comments/new.json
|
||||
def new
|
||||
|
||||
@@ -83,8 +83,16 @@ class CropsController < ApplicationController
|
||||
respond_to do |format|
|
||||
format.html # show.html.haml
|
||||
format.json do
|
||||
# TODO RABL or similar one day to avoid presentation logic here
|
||||
owner_structure = {
|
||||
owner: {
|
||||
only: [:id, :login_name, :location, :latitude, :longitude]
|
||||
}
|
||||
}
|
||||
render json: @crop.to_json(include: {
|
||||
plantings: { include: { owner: { only: [:id, :login_name, :location, :latitude, :longitude] }}}
|
||||
plantings: {
|
||||
include: owner_structure
|
||||
}
|
||||
})
|
||||
end
|
||||
end
|
||||
@@ -136,7 +144,7 @@ class CropsController < ApplicationController
|
||||
end
|
||||
unless current_member.has_role? :crop_wrangler
|
||||
Role.crop_wranglers.each do |w|
|
||||
Notifier.new_crop_request(w, @crop).deliver!
|
||||
Notifier.new_crop_request(w, @crop).deliver_now!
|
||||
end
|
||||
end
|
||||
|
||||
@@ -180,8 +188,8 @@ class CropsController < ApplicationController
|
||||
if previous_status == "pending"
|
||||
requester = @crop.requester
|
||||
new_status = @crop.approval_status
|
||||
Notifier.crop_request_approved(requester, @crop).deliver! if new_status == "approved"
|
||||
Notifier.crop_request_rejected(requester, @crop).deliver! if new_status == "rejected"
|
||||
Notifier.crop_request_approved(requester, @crop).deliver_now! if new_status == "approved"
|
||||
Notifier.crop_request_rejected(requester, @crop).deliver_now! if new_status == "rejected"
|
||||
end
|
||||
format.html { redirect_to @crop, notice: 'Crop was successfully updated.' }
|
||||
format.json { head :no_content }
|
||||
|
||||
@@ -27,17 +27,6 @@ class HarvestsController < ApplicationController
|
||||
end
|
||||
end
|
||||
|
||||
# GET /harvests/1
|
||||
# GET /harvests/1.json
|
||||
def show
|
||||
@harvest = Harvest.find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
format.html # show.html.erb
|
||||
format.json { render json: @harvest }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /harvests/new
|
||||
# GET /harvests/new.json
|
||||
def new
|
||||
|
||||
6
app/controllers/pages_controller.rb
Normal file
6
app/controllers/pages_controller.rb
Normal file
@@ -0,0 +1,6 @@
|
||||
class PagesController < ApplicationController
|
||||
def letsencrypt
|
||||
# use your code here, not mine
|
||||
render text: "y9KNck8wqkoQLnlr2RgA2TVwWtyYb4PeY_hzGNx0Tfs.dlIPqFhMDCLyQEccczY3roHZ1UWu6UqVeyb9mkRxheU"
|
||||
end
|
||||
end
|
||||
@@ -13,17 +13,6 @@ class PhotosController < ApplicationController
|
||||
end
|
||||
end
|
||||
|
||||
# GET /photos/1
|
||||
# GET /photos/1.json
|
||||
def show
|
||||
@photo = Photo.find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
format.html # show.html.erb
|
||||
format.json { render json: @photo }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /photos/new
|
||||
# GET /photos/new.json
|
||||
def new
|
||||
|
||||
@@ -19,9 +19,23 @@ module ApplicationHelper
|
||||
pid = price_in_dollars(price)
|
||||
currency = Growstuff::Application.config.currency
|
||||
link = "http://www.wolframalpha.com/input/?i=#{pid}+#{currency}"
|
||||
return link_to "(convert)",
|
||||
link,
|
||||
target: "_blank"
|
||||
|
||||
link_to "(convert)", link, target: "_blank"
|
||||
end
|
||||
|
||||
def build_alert_classes(alert_type = :info)
|
||||
classes = 'alert alert-dismissable '
|
||||
case alert_type.to_sym
|
||||
when :alert, :danger, :error, :validation_errors
|
||||
classes += 'alert-danger'
|
||||
when :warning, :todo
|
||||
classes += 'alert-warning'
|
||||
when :notice, :success
|
||||
classes += 'alert-success'
|
||||
when :info
|
||||
classes += 'alert-info'
|
||||
end
|
||||
classes
|
||||
end
|
||||
|
||||
# Produces a cache key for uniquely identifying cached fragments.
|
||||
|
||||
@@ -2,12 +2,10 @@ class Notifier < ActionMailer::Base
|
||||
include NotificationsHelper
|
||||
default from: "Growstuff <noreply@growstuff.org>"
|
||||
|
||||
def verifier()
|
||||
if ENV['RAILS_SECRET_TOKEN']
|
||||
return ActiveSupport::MessageVerifier.new(ENV['RAILS_SECRET_TOKEN'])
|
||||
else
|
||||
raise "RAILS_SECRET_TOKEN environment variable not set - have you created config/application.yml?"
|
||||
end
|
||||
def verifier
|
||||
raise "RAILS_SECRET_TOKEN environment variable not set - have you created config/application.yml?" unless ENV['RAILS_SECRET_TOKEN']
|
||||
|
||||
return ActiveSupport::MessageVerifier.new(ENV['RAILS_SECRET_TOKEN'])
|
||||
end
|
||||
|
||||
def notify(notification)
|
||||
|
||||
@@ -206,7 +206,7 @@ class Crop < ActiveRecord::Base
|
||||
# returns a list of interesting crops, for use on the homepage etc
|
||||
def Crop.interesting
|
||||
howmany = 12 # max number to find
|
||||
interesting_crops = Array.new
|
||||
interesting_crops = []
|
||||
Crop.includes(:photos).randomized.each do |c|
|
||||
break if interesting_crops.size == howmany
|
||||
next unless c.interesting?
|
||||
|
||||
@@ -130,7 +130,7 @@ class Member < ActiveRecord::Base
|
||||
def is_paid?
|
||||
if account.account_type.is_permanent_paid
|
||||
return true
|
||||
elsif account.account_type.is_paid and account.paid_until >= Time.zone.now
|
||||
elsif account.account_type.is_paid && account.paid_until >= Time.zone.now
|
||||
return true
|
||||
else
|
||||
return false
|
||||
@@ -200,7 +200,7 @@ class Member < ActiveRecord::Base
|
||||
|
||||
def Member.interesting
|
||||
howmany = 12 # max number to find
|
||||
interesting_members = Array.new
|
||||
interesting_members = []
|
||||
Member.confirmed.located.recently_signed_in.each do |m|
|
||||
break if interesting_members.size == howmany
|
||||
if m.interesting?
|
||||
@@ -222,7 +222,7 @@ class Member < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def update_newsletter_subscription
|
||||
if confirmed_at_changed? and newsletter # just signed up
|
||||
if confirmed_at_changed? && newsletter # just signed up
|
||||
newsletter_subscribe
|
||||
elsif confirmed_at # i.e. after member's confirmed their account
|
||||
if newsletter_changed? # edited member settings
|
||||
|
||||
@@ -23,7 +23,7 @@ class Notification < ActiveRecord::Base
|
||||
|
||||
def send_email
|
||||
if self.recipient.send_notification_email
|
||||
Notifier.notify(self).deliver
|
||||
Notifier.notify(self).deliver_now
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ class Planting < ActiveRecord::Base
|
||||
|
||||
# check that any finished_at date occurs after planted_at
|
||||
def finished_must_be_after_planted
|
||||
return unless planted_at and finished_at # only check if we have both
|
||||
return unless planted_at && finished_at # only check if we have both
|
||||
errors.add(:finished_at, "must be after the planting date") unless planted_at < finished_at
|
||||
end
|
||||
|
||||
@@ -97,7 +97,7 @@ class Planting < ActiveRecord::Base
|
||||
def calculate_days_before_maturity(planting, crop)
|
||||
p_crop = Planting.where(crop_id: crop).where.not(id: planting)
|
||||
differences = p_crop.collect do |p|
|
||||
if p.finished and !p.finished_at.nil?
|
||||
if p.finished && !p.finished_at.nil?
|
||||
(p.finished_at - p.planted_at).to_i
|
||||
end
|
||||
end
|
||||
@@ -133,7 +133,7 @@ class Planting < ActiveRecord::Base
|
||||
# we can't do this via a scope (as far as we know) so sadly we have to
|
||||
# do it this way.
|
||||
def Planting.interesting(howmany=12, require_photo=true)
|
||||
interesting_plantings = Array.new
|
||||
interesting_plantings = []
|
||||
seen_owners = Hash.new(false) # keep track of which owners we've seen already
|
||||
|
||||
Planting.includes(:photos).each do |p|
|
||||
|
||||
@@ -11,17 +11,17 @@ class Post < ActiveRecord::Base
|
||||
# from this direction, so we won't set up an association for now.
|
||||
|
||||
after_create do
|
||||
recipients = Array.new
|
||||
recipients = []
|
||||
sender = self.author.id
|
||||
self.body.scan(Haml::Filters::GrowstuffMarkdown::MEMBER_REGEX) do |m|
|
||||
# find member case-insensitively and add to list of recipients
|
||||
member = Member.where('lower(login_name) = ?', $1.downcase).first
|
||||
recipients << member if member and not recipients.include?(member)
|
||||
recipients << member if member && !recipients.include?(member)
|
||||
end
|
||||
self.body.scan(Haml::Filters::GrowstuffMarkdown::MEMBER_AT_REGEX) do |m|
|
||||
# find member case-insensitively and add to list of recipients
|
||||
member = Member.where('lower(login_name) = ?', $1[1..-1].downcase).first
|
||||
recipients << member if member and not recipients.include?(member)
|
||||
recipients << member if member && !recipients.include?(member)
|
||||
end
|
||||
# don't send notifications to yourself
|
||||
recipients.map{ |r| r.id }.each do |recipient|
|
||||
@@ -64,7 +64,7 @@ class Post < ActiveRecord::Base
|
||||
|
||||
# return posts sorted by recent activity
|
||||
def Post.recently_active
|
||||
Post.all.sort do |a,b|
|
||||
Post.all.sort do |a, b|
|
||||
b.recent_activity <=> a.recent_activity
|
||||
end
|
||||
end
|
||||
@@ -77,7 +77,7 @@ class Post < ActiveRecord::Base
|
||||
# find crop case-insensitively
|
||||
crop = Crop.where('lower(name) = ?', $1.downcase).first
|
||||
# create association
|
||||
self.crops << crop if crop and not self.crops.include?(crop)
|
||||
self.crops << crop if crop && !self.crops.include?(crop)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -79,7 +79,7 @@ class Seed < ActiveRecord::Base
|
||||
# returns a list of interesting seeds, for use on the homepage etc
|
||||
def Seed.interesting
|
||||
howmany = 12 # max number to find
|
||||
interesting_seeds = Array.new
|
||||
interesting_seeds = []
|
||||
|
||||
Seed.tradable.each do |s|
|
||||
break if interesting_seeds.size == howmany
|
||||
|
||||
@@ -17,12 +17,7 @@
|
||||
%p
|
||||
.btn-group
|
||||
= yield(:buttonbar)
|
||||
- if notice
|
||||
.alert.alert-success
|
||||
= notice
|
||||
- if alert
|
||||
.alert.alert-warning
|
||||
= alert
|
||||
= render :partial => "shared/flash_messages", flash: flash
|
||||
= yield
|
||||
|
||||
%footer
|
||||
|
||||
6
app/views/shared/_flash_messages.html.haml
Normal file
6
app/views/shared/_flash_messages.html.haml
Normal file
@@ -0,0 +1,6 @@
|
||||
- flash.each do |type, content|
|
||||
%div{ class: build_alert_classes(type), role: "alert" }
|
||||
%button.close{ type: "button", "data-dismiss" => "alert" }
|
||||
%span{ "aria-hidden" => true } ×
|
||||
%span.sr-only Close
|
||||
= content
|
||||
@@ -106,5 +106,6 @@ module Growstuff
|
||||
# didn't work for us.
|
||||
config.cloudmade_key = '29a2d9e3cb3d429490a8f338b2388b1d'
|
||||
|
||||
config.active_record.raise_in_transactional_callbacks = true
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -15,7 +15,7 @@ Growstuff::Application.configure do
|
||||
config.action_controller.perform_caching = true
|
||||
|
||||
# Disable Rails's static asset server (Apache or nginx will already do this)
|
||||
config.serve_static_assets = false
|
||||
config.serve_static_files = false
|
||||
|
||||
# Compress JavaScripts and CSS.
|
||||
config.assets.js_compressor = :uglifier
|
||||
|
||||
@@ -17,7 +17,7 @@ Growstuff::Application.configure do
|
||||
config.action_controller.perform_caching = true
|
||||
|
||||
# Disable Rails's static asset server (Apache or nginx will already do this)
|
||||
config.serve_static_assets = false
|
||||
config.serve_static_files = false
|
||||
|
||||
# Compress JavaScripts and CSS.
|
||||
config.assets.js_compressor = :uglifier
|
||||
|
||||
@@ -15,7 +15,7 @@ Growstuff::Application.configure do
|
||||
config.cache_classes = false
|
||||
|
||||
# Configure static asset server for tests with Cache-Control for performance
|
||||
config.serve_static_assets = true
|
||||
config.serve_static_files = true
|
||||
config.static_cache_control = "public, max-age=3600"
|
||||
|
||||
# Show full error reports and disable caching
|
||||
|
||||
@@ -83,6 +83,8 @@ Growstuff::Application.routes.draw do
|
||||
get '/admin/newsletter' => 'admin#newsletter', :as => :admin_newsletter
|
||||
get '/admin/:action' => 'admin#:action'
|
||||
|
||||
get '/.well-known/acme-challenge/:id' => 'pages#letsencrypt'
|
||||
|
||||
# CMS stuff -- must remain LAST
|
||||
comfy_route :cms, path: '/', sitemap: false
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ class DeviseCreateUsers < ActiveRecord::Migration
|
||||
# t.string :authentication_token
|
||||
|
||||
|
||||
t.timestamps
|
||||
t.timestamps null: true
|
||||
end
|
||||
|
||||
add_index :users, :email, unique: true
|
||||
|
||||
@@ -3,7 +3,7 @@ class CreateCrops < ActiveRecord::Migration
|
||||
create_table :crops do |t|
|
||||
t.string :system_name
|
||||
t.string :en_wikipedia_url
|
||||
t.timestamps
|
||||
t.timestamps null: true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -5,7 +5,7 @@ class CreateGardens < ActiveRecord::Migration
|
||||
t.integer :user_id
|
||||
t.string :slug, null: false
|
||||
|
||||
t.timestamps
|
||||
t.timestamps null: true
|
||||
end
|
||||
|
||||
add_index :gardens, :user_id
|
||||
|
||||
@@ -4,7 +4,7 @@ class CreateScientificNames < ActiveRecord::Migration
|
||||
t.string :scientific_name, null: false
|
||||
t.integer :crop_id, null: false
|
||||
|
||||
t.timestamps
|
||||
t.timestamps null: true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -5,7 +5,7 @@ class CreateUpdates < ActiveRecord::Migration
|
||||
t.string :subject, null: false
|
||||
t.text :body, null: false
|
||||
|
||||
t.timestamps
|
||||
t.timestamps null: true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -7,7 +7,7 @@ class CreatePlantings < ActiveRecord::Migration
|
||||
t.integer :quantity
|
||||
t.text :description
|
||||
|
||||
t.timestamps
|
||||
t.timestamps null: true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -5,7 +5,7 @@ class CreateComments < ActiveRecord::Migration
|
||||
t.integer :author_id
|
||||
t.text :body
|
||||
|
||||
t.timestamps
|
||||
t.timestamps null: true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -8,7 +8,7 @@ class CreateNotifications < ActiveRecord::Migration
|
||||
t.boolean :read
|
||||
t.integer :post_id
|
||||
|
||||
t.timestamps
|
||||
t.timestamps null: true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -5,7 +5,7 @@ class CreateForums < ActiveRecord::Migration
|
||||
t.text :description, null: false
|
||||
t.integer :owner_id, null: false
|
||||
|
||||
t.timestamps
|
||||
t.timestamps null: true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -4,7 +4,7 @@ class CreateRoles < ActiveRecord::Migration
|
||||
t.string :name, null: false
|
||||
t.text :description
|
||||
|
||||
t.timestamps
|
||||
t.timestamps null: true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -6,7 +6,7 @@ class CreateAuthentications < ActiveRecord::Migration
|
||||
t.string :uid
|
||||
t.string :token
|
||||
t.string :secret
|
||||
t.timestamps
|
||||
t.timestamps null: true
|
||||
end
|
||||
add_index :authentications, :member_id
|
||||
end
|
||||
|
||||
@@ -5,7 +5,7 @@ class CreateProducts < ActiveRecord::Migration
|
||||
t.string :description, null: false
|
||||
t.decimal :min_price, null: false
|
||||
|
||||
t.timestamps
|
||||
t.timestamps null: true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -3,7 +3,7 @@ class CreateOrders < ActiveRecord::Migration
|
||||
create_table :orders do |t|
|
||||
t.string :member_id, null: false
|
||||
|
||||
t.timestamps
|
||||
t.timestamps null: true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -6,7 +6,7 @@ class CreatePhotos < ActiveRecord::Migration
|
||||
t.string :thumbnail_url, null: false
|
||||
t.string :fullsize_url, null: false
|
||||
|
||||
t.timestamps
|
||||
t.timestamps null: true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -6,7 +6,7 @@ class CreateOrderItems < ActiveRecord::Migration
|
||||
t.decimal :price
|
||||
t.integer :quantity
|
||||
|
||||
t.timestamps
|
||||
t.timestamps null: true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -5,7 +5,7 @@ class CreateAccountDetails < ActiveRecord::Migration
|
||||
t.integer :account_type_id
|
||||
t.datetime :paid_until
|
||||
|
||||
t.timestamps
|
||||
t.timestamps null: true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -5,7 +5,7 @@ class CreateAccountTypes < ActiveRecord::Migration
|
||||
t.boolean :is_paid
|
||||
t.boolean :is_permanent_paid
|
||||
|
||||
t.timestamps
|
||||
t.timestamps null: true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -7,7 +7,7 @@ class CreateSeeds < ActiveRecord::Migration
|
||||
t.integer :quantity
|
||||
t.date :use_by
|
||||
|
||||
t.timestamps
|
||||
t.timestamps null: true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -8,7 +8,7 @@ class CreateHarvests < ActiveRecord::Migration
|
||||
t.string :units
|
||||
t.text :notes
|
||||
|
||||
t.timestamps
|
||||
t.timestamps null: true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -3,7 +3,7 @@ class CreatePlantParts < ActiveRecord::Migration
|
||||
create_table :plant_parts do |t|
|
||||
t.string :name
|
||||
|
||||
t.timestamps
|
||||
t.timestamps null: true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -5,7 +5,7 @@ class CreateAlternateNames < ActiveRecord::Migration
|
||||
t.integer :crop_id, null: false
|
||||
t.integer :creator_id, null: false
|
||||
|
||||
t.timestamps
|
||||
t.timestamps null: true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -4,7 +4,7 @@ class CreateFollows < ActiveRecord::Migration
|
||||
t.integer :member_id
|
||||
t.integer :followed_id
|
||||
|
||||
t.timestamps
|
||||
t.timestamps null: true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -33,7 +33,7 @@ class CreateCms < ActiveRecord::Migration
|
||||
t.text :js, text_limit
|
||||
t.integer :position, null: false, default: 0
|
||||
t.boolean :is_shared, null: false, default: false
|
||||
t.timestamps
|
||||
t.timestamps null: true
|
||||
end
|
||||
add_index :comfy_cms_layouts, [:parent_id, :position]
|
||||
add_index :comfy_cms_layouts, [:site_id, :identifier], unique: true
|
||||
@@ -52,7 +52,7 @@ class CreateCms < ActiveRecord::Migration
|
||||
t.integer :children_count, null: false, default: 0
|
||||
t.boolean :is_published, null: false, default: true
|
||||
t.boolean :is_shared, null: false, default: false
|
||||
t.timestamps
|
||||
t.timestamps null: true
|
||||
end
|
||||
add_index :comfy_cms_pages, [:site_id, :full_path]
|
||||
add_index :comfy_cms_pages, [:parent_id, :position]
|
||||
@@ -62,7 +62,7 @@ class CreateCms < ActiveRecord::Migration
|
||||
t.string :identifier, null: false
|
||||
t.text :content, text_limit
|
||||
t.references :blockable, polymorphic: true
|
||||
t.timestamps
|
||||
t.timestamps null: true
|
||||
end
|
||||
add_index :comfy_cms_blocks, [:identifier]
|
||||
add_index :comfy_cms_blocks, [:blockable_id, :blockable_type]
|
||||
@@ -75,7 +75,7 @@ class CreateCms < ActiveRecord::Migration
|
||||
t.text :content, text_limit
|
||||
t.integer :position, null: false, default: 0
|
||||
t.boolean :is_shared, null: false, default: false
|
||||
t.timestamps
|
||||
t.timestamps null: true
|
||||
end
|
||||
add_index :comfy_cms_snippets, [:site_id, :identifier], unique: true
|
||||
add_index :comfy_cms_snippets, [:site_id, :position]
|
||||
@@ -90,7 +90,7 @@ class CreateCms < ActiveRecord::Migration
|
||||
t.integer :file_file_size, null: false
|
||||
t.string :description, limit: 2048
|
||||
t.integer :position, null: false, default: 0
|
||||
t.timestamps
|
||||
t.timestamps null: true
|
||||
end
|
||||
add_index :comfy_cms_files, [:site_id, :label]
|
||||
add_index :comfy_cms_files, [:site_id, :file_file_name]
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace :growstuff do
|
||||
|
||||
if Date.today.cwday == send_on_day and Date.today.cweek % every_n_weeks == 0
|
||||
Member.confirmed.find_each do |m|
|
||||
Notifier.planting_reminder(m).deliver!
|
||||
Notifier.planting_reminder(m).deliver_now!
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
38
script/check_contributors_md
Executable file
38
script/check_contributors_md
Executable file
@@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env ruby
|
||||
|
||||
puts "Checking to see if you're in CONTRIBUTORS.md..."
|
||||
if ENV['TRAVIS'] then
|
||||
if ENV['TRAVIS_PULL_REQUEST'] then
|
||||
require 'httparty'
|
||||
repo = ENV['TRAVIS_REPO_SLUG']
|
||||
pr = ENV['TRAVIS_PULL_REQUEST']
|
||||
url = "https://api.github.com/repos/#{repo}/pulls/#{pr}"
|
||||
response = HTTParty.get(url).parsed_response
|
||||
author = response['user']['login'] if response && response['user']
|
||||
|
||||
# Could not determine author
|
||||
exit unless author
|
||||
else
|
||||
# We're in a Travis branch build; nothing to check
|
||||
exit
|
||||
end
|
||||
else
|
||||
author = `git config github.user`.chomp
|
||||
if $?.exitstatus > 0 then
|
||||
abort %{
|
||||
Couldn't determine your GitHub username, and not in a Travis PR build
|
||||
Please set it using
|
||||
|
||||
git config --add github.user [username]
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
if !system("grep #{author} CONTRIBUTORS.md") then
|
||||
abort %{
|
||||
Thanks for your contribution, #{author}!
|
||||
Please add your name and GitHub handle to the file CONTRIBUTORS.md,
|
||||
commit it, and update your PR.
|
||||
}
|
||||
end
|
||||
|
||||
9
script/gemfile_check
Executable file
9
script/gemfile_check
Executable file
@@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env ruby
|
||||
|
||||
require 'set'
|
||||
|
||||
changed_file_list = `git diff --name-only --diff-filter=ACMRTUXB origin/dev...`
|
||||
files = Set.new changed_file_list.split
|
||||
if (files.include? "Gemfile") && !(files.include? "Gemfile.lock") then
|
||||
abort "Looks like you committed changes to Gemfile but not Gemfile.lock"
|
||||
end
|
||||
@@ -6,7 +6,7 @@ require 'yaml'
|
||||
heroku = Heroku::API.new(api_key: ENV['HEROKU_API_KEY'])
|
||||
branch = ENV['TRAVIS_BRANCH']
|
||||
travis_config = YAML.load_file('.travis.yml')
|
||||
if travis_config['deploy']['app'].has_key? branch
|
||||
if travis_config['deploy']['app'].key? branch
|
||||
app = travis_config['deploy']['app'][branch]
|
||||
else
|
||||
abort "No Heroku app found for branch #{branch}"
|
||||
|
||||
@@ -231,7 +231,7 @@ feature "Planting a crop", :js do
|
||||
end
|
||||
|
||||
describe "Planting sunniness" do
|
||||
it "should show the image sunniness_sun.png" do
|
||||
it "should show the a sunny image" do
|
||||
fill_autocomplete "crop", with: "mai"
|
||||
select_from_autocomplete "maize"
|
||||
within "form#new_planting" do
|
||||
@@ -244,11 +244,10 @@ feature "Planting a crop", :js do
|
||||
click_button "Save"
|
||||
end
|
||||
|
||||
expect(page).to have_css("img[src*='sunniness_sun.png']")
|
||||
expect(page).to have_css("img[alt=sun]")
|
||||
expect(page).to have_css("img[alt='sun']")
|
||||
end
|
||||
|
||||
it "should show the image 'not specified.png'" do
|
||||
it "should show a sunniness not specified image" do
|
||||
fill_autocomplete "crop", with: "mai"
|
||||
select_from_autocomplete "maize"
|
||||
within "form#new_planting" do
|
||||
@@ -260,7 +259,6 @@ feature "Planting a crop", :js do
|
||||
click_button "Save"
|
||||
end
|
||||
|
||||
expect(page).to have_css("img[src*='sunniness_not specified.png']")
|
||||
expect(page).to have_css("img[alt='not specified']")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -15,7 +15,7 @@ feature "unsubscribe" do
|
||||
expect(member.send_notification_email).to eq(true)
|
||||
|
||||
# generate planting reminder email
|
||||
Notifier.planting_reminder(member).deliver
|
||||
Notifier.planting_reminder(member).deliver_now
|
||||
open_email(member.email)
|
||||
|
||||
# clicking 'Unsubscribe' link will unsubscribe the member
|
||||
@@ -33,7 +33,7 @@ feature "unsubscribe" do
|
||||
|
||||
# generate inbox notification email
|
||||
notification.recipient = member
|
||||
Notifier.notify(notification).deliver
|
||||
Notifier.notify(notification).deliver_now
|
||||
open_email(member.email)
|
||||
|
||||
# clicking 'Unsubscribe' link will unsubscribe the member
|
||||
|
||||
@@ -70,5 +70,70 @@ describe ApplicationHelper do
|
||||
expect(localize_plural(post.comments, Comment)).to eq '0 comments'
|
||||
end
|
||||
end
|
||||
|
||||
describe '#build_alert_classes' do
|
||||
context 'danger' do
|
||||
it 'works when :alert' do
|
||||
expect(build_alert_classes(:alert)).to include 'alert-danger'
|
||||
end
|
||||
it 'works when :danger' do
|
||||
expect(build_alert_classes(:danger)).to include 'alert-danger'
|
||||
end
|
||||
it 'works when :error' do
|
||||
expect(build_alert_classes(:error)).to include 'alert-danger'
|
||||
end
|
||||
it 'works when :validation_errors' do
|
||||
expect(build_alert_classes(:validation_errors)).to include 'alert-danger'
|
||||
end
|
||||
it 'includes base classes' do
|
||||
expect(build_alert_classes(:danger)).to include 'alert alert-dismissable'
|
||||
end
|
||||
it 'does not include danger when info' do
|
||||
expect(build_alert_classes(:info)).not_to include ' alert-danger'
|
||||
end
|
||||
end
|
||||
context 'warning' do
|
||||
it 'works when :warning' do
|
||||
expect(build_alert_classes(:warning)).to include 'alert-warning'
|
||||
end
|
||||
it 'works when :todo' do
|
||||
expect(build_alert_classes(:todo)).to include 'alert-warning'
|
||||
end
|
||||
it 'includes base classes' do
|
||||
expect(build_alert_classes(:warning)).to include 'alert alert-dismissable'
|
||||
end
|
||||
it 'does not include warning when info' do
|
||||
expect(build_alert_classes(:info)).not_to include ' alert-warning'
|
||||
end
|
||||
end
|
||||
context 'success' do
|
||||
it 'works when :notice' do
|
||||
expect(build_alert_classes(:notice)).to include 'alert-success'
|
||||
end
|
||||
it 'works when :success' do
|
||||
expect(build_alert_classes(:success)).to include 'alert-success'
|
||||
end
|
||||
it 'includes base classes' do
|
||||
expect(build_alert_classes(:success)).to include 'alert alert-dismissable'
|
||||
end
|
||||
it 'does not include success when info' do
|
||||
expect(build_alert_classes(:info)).not_to include ' alert-success'
|
||||
end
|
||||
end
|
||||
context 'info' do
|
||||
it 'works when :info' do
|
||||
expect(build_alert_classes(:info)).to include 'alert-info'
|
||||
end
|
||||
it 'works when blank' do
|
||||
expect(build_alert_classes()).to include 'alert-info'
|
||||
end
|
||||
it 'includes base classes' do
|
||||
expect(build_alert_classes(:info)).to include 'alert alert-dismissable'
|
||||
end
|
||||
it 'does not include info when danger' do
|
||||
expect(build_alert_classes(:danger)).not_to include ' alert-info'
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -547,11 +547,11 @@ describe Crop do
|
||||
end
|
||||
|
||||
it "should delete the association between post and the crop(tomato)" do
|
||||
expect(Post.find(post).crops).to eq [maize]
|
||||
expect(Post.find(post.id).crops).to eq [maize]
|
||||
end
|
||||
|
||||
it "should not delete the posts" do
|
||||
expect(Post.find(post)).to_not eq nil
|
||||
expect(Post.find(post.id)).to_not eq nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -158,13 +158,13 @@ describe Post do
|
||||
end
|
||||
|
||||
it "should delete the association" do
|
||||
expect(Crop.find(tomato).posts).to eq []
|
||||
expect(Crop.find(maize).posts).to eq []
|
||||
expect(Crop.find(tomato.id).posts).to eq []
|
||||
expect(Crop.find(maize.id).posts).to eq []
|
||||
end
|
||||
|
||||
it "should not delete the crops" do
|
||||
expect(Crop.find(tomato)).to_not eq nil
|
||||
expect(Crop.find(maize)).to_not eq nil
|
||||
expect(Crop.find(tomato.id)).to_not eq nil
|
||||
expect(Crop.find(maize.id)).to_not eq nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -101,4 +101,14 @@ RSpec.configure do |config|
|
||||
|
||||
# Allow just create(:factory) instead of needing to specify FactoryGirl.create(:factory)
|
||||
config.include FactoryGirl::Syntax::Methods
|
||||
|
||||
# Prevent Poltergeist from fetching external URLs during feature tests
|
||||
config.before(:each, js: true) do
|
||||
page.driver.browser.url_blacklist = [
|
||||
'gravatar.com',
|
||||
'mapbox.com',
|
||||
'okfn.org',
|
||||
'googlecode.com',
|
||||
]
|
||||
end
|
||||
end
|
||||
|
||||
@@ -30,7 +30,7 @@ describe "crops/new" do
|
||||
end
|
||||
|
||||
it "shows a link to crop wrangling guidelines" do
|
||||
assert_select "a[href^=http://wiki.growstuff.org]", "crop wrangling guide"
|
||||
assert_select "a[href^='http://wiki.growstuff.org']", "crop wrangling guide"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -35,7 +35,7 @@ describe "forums/show" do
|
||||
|
||||
it 'links to new post with the forum id' do
|
||||
render
|
||||
assert_select "a[href=#{new_post_path(forum_id: @forum.id)}]"
|
||||
assert_select "a[href='#{new_post_path(forum_id: @forum.id)}']"
|
||||
end
|
||||
|
||||
it 'has no posts' do
|
||||
|
||||
@@ -66,7 +66,7 @@ describe "gardens/show" do
|
||||
end
|
||||
|
||||
it "links to the right crop in the planting link" do
|
||||
assert_select("a[href=#{new_planting_path}?garden_id=#{@garden.id}]")
|
||||
assert_select("a[href='#{new_planting_path}?garden_id=#{@garden.id}']")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ describe 'home/_crops.html.haml', type: "view" do
|
||||
|
||||
it 'shows crops section' do
|
||||
assert_select 'h2', text: 'Some of our crops'
|
||||
assert_select "a[href=#{crop_path(@crop)}]"
|
||||
assert_select "a[href='#{crop_path(@crop)}']"
|
||||
end
|
||||
|
||||
it 'shows plantings section' do
|
||||
@@ -45,6 +45,6 @@ describe 'home/_crops.html.haml', type: "view" do
|
||||
end
|
||||
|
||||
it 'includes a link to all crops' do
|
||||
assert_select "a[href=#{crops_path}]", text: /View all crops/
|
||||
assert_select "a[href='#{crops_path}']", text: /View all crops/
|
||||
end
|
||||
end
|
||||
|
||||
@@ -24,7 +24,7 @@ describe 'layouts/_header.html.haml', type: "view" do
|
||||
end
|
||||
|
||||
it 'shows the brand logo in the navbar' do
|
||||
assert_select("img[src='/assets/growstuff-brand.png']", href: root_path)
|
||||
assert_select("a.navbar-brand img[src]", href: root_path)
|
||||
end
|
||||
|
||||
it 'should have signup/signin links' do
|
||||
@@ -49,19 +49,19 @@ describe 'layouts/_header.html.haml', type: "view" do
|
||||
end
|
||||
|
||||
it 'links to members' do
|
||||
assert_select("a[href=#{members_path}]", 'Browse Members')
|
||||
assert_select("a[href='#{members_path}']", 'Browse Members')
|
||||
end
|
||||
|
||||
it 'links to posts' do
|
||||
assert_select("a[href=#{posts_path}]", 'Posts')
|
||||
assert_select("a[href='#{posts_path}']", 'Posts')
|
||||
end
|
||||
|
||||
it 'links to forums' do
|
||||
assert_select("a[href=#{forums_path}]", 'Forums')
|
||||
assert_select("a[href='#{forums_path}']", 'Forums')
|
||||
end
|
||||
|
||||
it 'has a crop search' do
|
||||
assert_select("form[action=#{crops_search_path}]")
|
||||
assert_select("form[action='#{crops_search_path}']")
|
||||
assert_select("input#term")
|
||||
end
|
||||
|
||||
@@ -81,16 +81,16 @@ describe 'layouts/_header.html.haml', type: "view" do
|
||||
rendered.should have_content "#{@member.login_name}"
|
||||
end
|
||||
it "should show link to member's gardens" do
|
||||
assert_select("a[href=#{gardens_by_owner_path(owner: @member.slug)}]", "Gardens")
|
||||
assert_select("a[href='#{gardens_by_owner_path(owner: @member.slug)}']", "Gardens")
|
||||
end
|
||||
it "should show link to member's plantings" do
|
||||
assert_select("a[href=#{plantings_by_owner_path(owner: @member.slug)}]", "Plantings")
|
||||
assert_select("a[href='#{plantings_by_owner_path(owner: @member.slug)}']", "Plantings")
|
||||
end
|
||||
it "should show link to member's seeds" do
|
||||
assert_select("a[href=#{seeds_by_owner_path(owner: @member.slug)}]", "Seeds")
|
||||
assert_select("a[href='#{seeds_by_owner_path(owner: @member.slug)}']", "Seeds")
|
||||
end
|
||||
it "should show link to member's posts" do
|
||||
assert_select("a[href=#{posts_by_author_path(author: @member.slug)}]", "Posts")
|
||||
assert_select("a[href='#{posts_by_author_path(author: @member.slug)}']", "Posts")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -23,17 +23,17 @@ describe 'layouts/_meta.html.haml', type: "view" do
|
||||
|
||||
it 'should have a Posts RSS feed' do
|
||||
posts_rss = url_for(controller: 'posts', format: 'rss', only_path: false)
|
||||
assert_select "head>link[href=#{posts_rss}]"
|
||||
assert_select "head>link[href='#{posts_rss}']"
|
||||
end
|
||||
|
||||
it 'should have a Crops RSS feed' do
|
||||
crops_rss = url_for(controller: 'crops', format: 'rss', only_path: false)
|
||||
assert_select "head>link[href=#{crops_rss}]"
|
||||
assert_select "head>link[href='#{crops_rss}']"
|
||||
end
|
||||
|
||||
it 'should have a Plantings RSS feed' do
|
||||
plantings_rss = url_for(controller: 'plantings', format: 'rss', only_path: false)
|
||||
assert_select "head>link[href=#{plantings_rss}]"
|
||||
assert_select "head>link[href='#{plantings_rss}']"
|
||||
end
|
||||
|
||||
it 'should have a title' do
|
||||
|
||||
@@ -36,7 +36,7 @@ describe "notifications/show" do
|
||||
end
|
||||
|
||||
it "includes a reply button" do
|
||||
assert_select "a[href=#{@reply_link}]", "Reply"
|
||||
assert_select "a", {href: @reply_link}, "Reply"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -36,17 +36,17 @@ describe 'notifier/notify.html.haml', type: "view" do
|
||||
end
|
||||
|
||||
it 'should include a reply link' do
|
||||
assert_select "a[href=#{@reply_link}]", text: /Reply/
|
||||
assert_select "a[href='#{@reply_link}']", text: /Reply/
|
||||
end
|
||||
|
||||
it 'should contain a link to your inbox' do
|
||||
assert_select "a[href*=notifications]"
|
||||
assert_select "a[href*='notifications']"
|
||||
end
|
||||
|
||||
it 'should have fully qualified URLs' do
|
||||
# lots of lovely fully qualified URLs
|
||||
assert_select "a[href^=http]", { minimum: 4 }
|
||||
assert_select "a[href^='http']", { minimum: 4 }
|
||||
# no relative URLs starting with /
|
||||
assert_select "a[href^=/]", { count: 0 }
|
||||
assert_select "a[href^='/']", { count: 0 }
|
||||
end
|
||||
end
|
||||
|
||||
@@ -33,7 +33,7 @@ describe "orders/index" do
|
||||
it "renders a list of orders" do
|
||||
render
|
||||
# Run the generator again with the --webrat flag if you want to use webrat matchers
|
||||
assert_select "tr>td", text: @order1.id
|
||||
assert_select "tr>td", text: @order2.id
|
||||
assert_select "tr>td a/@href", text: "/orders/#{@order1.id}"
|
||||
assert_select "tr>td a/@href", text: "/orders/#{@order2.id}"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -50,7 +50,7 @@ describe "orders/show" do
|
||||
|
||||
it "shows a foreign exchange link for the total" do
|
||||
currency = Growstuff::Application.config.currency
|
||||
assert_select("a[href=http://www.wolframalpha.com/input/?i=198.00+#{currency}]")
|
||||
assert_select("a[href='http://www.wolframalpha.com/input/?i=198.00+#{currency}']")
|
||||
end
|
||||
|
||||
it "asks for a referral code" do
|
||||
|
||||
@@ -32,6 +32,7 @@ describe "photos/new" do
|
||||
|
||||
context "user has no photosets" do
|
||||
it "doesn't show a dropdown with sets from Flickr" do
|
||||
render
|
||||
assert_select "select#set", false
|
||||
end
|
||||
end
|
||||
|
||||
@@ -29,7 +29,7 @@ describe "photos/show" do
|
||||
end
|
||||
|
||||
it "shows the image" do
|
||||
assert_select "img[src=#{@photo.fullsize_url}]"
|
||||
assert_select "img[src='#{@photo.fullsize_url}']"
|
||||
end
|
||||
|
||||
it "links to the owner's profile" do
|
||||
@@ -46,7 +46,7 @@ describe "photos/show" do
|
||||
end
|
||||
|
||||
it "has a delete button" do
|
||||
assert_select "a[href=#{photo_path(@photo)}]", 'Delete Photo'
|
||||
assert_select "a[href='#{photo_path(@photo)}']", 'Delete Photo'
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ describe "plantings/_form" do
|
||||
end
|
||||
|
||||
it "has a free-form text field containing the planting date in ISO format" do
|
||||
assert_select 'input#planting_planted_at[type=text][value=2013-03-01]'
|
||||
assert_select "input#planting_planted_at[type='text'][value='2013-03-01']"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -55,7 +55,7 @@ describe "plantings/edit" do
|
||||
end
|
||||
|
||||
it 'includes helpful links for crops and gardens' do
|
||||
assert_select "a[href=#{new_garden_path}]", text: "Add a garden."
|
||||
assert_select "a[href='#{new_garden_path}']", text: "Add a garden."
|
||||
end
|
||||
|
||||
it "chooses the right crop" do
|
||||
@@ -64,7 +64,7 @@ describe "plantings/edit" do
|
||||
|
||||
it "chooses the right garden" do
|
||||
assert_select "select#planting_garden_id",
|
||||
html: /option selected="selected" value="#{@garden.id}"/
|
||||
html: /option selected value="#{@garden.id}"/
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -56,12 +56,12 @@ describe "plantings/new" do
|
||||
end
|
||||
|
||||
it 'includes helpful links for crops and gardens' do
|
||||
assert_select "a[href=#{new_garden_path}]", text: "Add a garden."
|
||||
assert_select "a", href: new_garden_path, text: "Add a garden."
|
||||
end
|
||||
|
||||
it "selects a garden given in a param" do
|
||||
assert_select "select#planting_garden_id",
|
||||
html: /option selected="selected" value="#{@garden_z.id}"/
|
||||
html: /option selected value="#{@garden_z.id}"/
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -70,7 +70,7 @@ describe "plantings/show" do
|
||||
@photo = FactoryGirl.create(:photo, owner: @member)
|
||||
@p.photos << @photo
|
||||
render
|
||||
assert_select "img[src=#{@photo.thumbnail_url}]"
|
||||
assert_select "img[src='#{@photo.thumbnail_url}']"
|
||||
end
|
||||
|
||||
it "shows a link to add photos" do
|
||||
|
||||
@@ -33,11 +33,11 @@ describe "posts/_single" do
|
||||
end
|
||||
|
||||
it "contains a permanent link to post" do
|
||||
assert_select "a[href=#{post_path @post}]", "Permalink"
|
||||
assert_select "a[href='#{post_path @post}']", "Permalink"
|
||||
end
|
||||
|
||||
it "doesn't contain a link to new comment" do
|
||||
assert_select "a[href=#{new_comment_path(post_id: @post.id)}]", false
|
||||
assert_select("a", {href: new_comment_path(post_id: @post.id)}, false)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -50,11 +50,11 @@ describe "posts/_single" do
|
||||
end
|
||||
|
||||
it "contains link to new comment" do
|
||||
assert_select "a[href=#{new_comment_path(post_id: @post.id)}]", "Reply"
|
||||
assert_select("a", {href: new_comment_path(post_id: @post.id)}, "Reply")
|
||||
end
|
||||
|
||||
it "does not contain an edit link" do
|
||||
assert_select "a[href=#{edit_post_path(@post)}]", false
|
||||
assert_select "a[href='#{edit_post_path(@post)}']", false
|
||||
end
|
||||
end
|
||||
|
||||
@@ -68,7 +68,7 @@ describe "posts/_single" do
|
||||
end
|
||||
|
||||
it "contains an edit link" do
|
||||
assert_select "a[href=#{edit_post_path(@post)}]", "Edit"
|
||||
assert_select "a[href='#{edit_post_path(@post)}']", "Edit"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -78,7 +78,7 @@ describe "posts/_single" do
|
||||
end
|
||||
|
||||
it "renders the number of comments" do
|
||||
assert_select "a[href=#{post_path(@post)}\#comments]", "0 comments"
|
||||
assert_select "a[href='#{post_path(@post)}\#comments']", "0 comments"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -89,7 +89,7 @@ describe "posts/_single" do
|
||||
end
|
||||
|
||||
it "renders the number of comments" do
|
||||
assert_select "a[href=#{post_path(@post)}\#comments]", "1 comment"
|
||||
assert_select "a[href='#{post_path(@post)}\#comments']", "1 comment"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -101,7 +101,7 @@ describe "posts/_single" do
|
||||
end
|
||||
|
||||
it "renders the number of comments" do
|
||||
assert_select "a[href=#{post_path(@post)}\#comments]", "2 comments"
|
||||
assert_select "a[href='#{post_path(@post)}\#comments']", "2 comments"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -121,11 +121,11 @@ describe "posts/_single" do
|
||||
end
|
||||
|
||||
it "does not contain link to post" do
|
||||
assert_select "a[href=#{post_path @post}]", false
|
||||
assert_select "a[href='#{post_path @post}']", false
|
||||
end
|
||||
|
||||
it "does not contain link to new comment" do
|
||||
assert_select "a[href=#{new_comment_path(post_id: @post.id)}]", false
|
||||
assert_select "a[href='#{new_comment_path(post_id: @post.id)}']", false
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -55,7 +55,7 @@ describe "posts/edit" do
|
||||
end
|
||||
|
||||
it 'creates a hidden field' do
|
||||
assert_select "input#post_forum_id[type=hidden][value=#{@forum.id}]"
|
||||
assert_select "input#post_forum_id[type='hidden'][value='#{@forum.id}']"
|
||||
end
|
||||
|
||||
it 'tells the user what forum it will be posted in' do
|
||||
|
||||
@@ -56,7 +56,7 @@ describe "posts/new" do
|
||||
end
|
||||
|
||||
it 'creates a hidden field' do
|
||||
assert_select "input#post_forum_id[type=hidden][value=#{@forum.id}]"
|
||||
assert_select "input#post_forum_id[type='hidden'][value='#{@forum.id}']"
|
||||
end
|
||||
|
||||
it 'tells the user what forum it will be posted in' do
|
||||
|
||||
@@ -118,7 +118,7 @@ describe "posts/show" do
|
||||
end
|
||||
|
||||
it 'shows a comment button' do
|
||||
assert_select "a[href=#{new_comment_path(post_id: @post.id)}]", "Comment"
|
||||
assert_select "a", {href: new_comment_path(post_id: @post.id)}, "Comment"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -27,6 +27,6 @@ describe "products/index" do
|
||||
# Run the generator again with the --webrat flag if you want to use webrat matchers
|
||||
assert_select "tr>td", text: @product.name, count: 2
|
||||
assert_select "tr>td", text: @product.description, count: 2
|
||||
assert_select "tr>td", text: @product.min_price, count: 2
|
||||
assert_select "tr>td", text: @product.min_price.to_s, count: 2
|
||||
end
|
||||
end
|
||||
|
||||
@@ -65,7 +65,7 @@ describe "seeds/show" do
|
||||
|
||||
it "links to profile to set location" do
|
||||
render
|
||||
assert_select "a[href=#{url_for(edit_member_registration_path)}]", text: "Set Location"
|
||||
assert_select "a[href='#{url_for(edit_member_registration_path)}']", text: "Set Location"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ describe 'shop/index.html.haml', type: "view" do
|
||||
|
||||
it 'should contain an exchange rate link' do
|
||||
currency = Growstuff::Application.config.currency
|
||||
assert_select("a[href=http://www.wolframalpha.com/input/?i=9.99+#{currency}]")
|
||||
assert_select("a[href='http://www.wolframalpha.com/input/?i=9.99+#{currency}']")
|
||||
end
|
||||
|
||||
it 'shows recommended price for products that have it' do
|
||||
@@ -50,7 +50,7 @@ describe 'shop/index.html.haml', type: "view" do
|
||||
|
||||
it 'should contain an exchange rate link for recommended price' do
|
||||
currency = Growstuff::Application.config.currency
|
||||
assert_select("a[href=http://www.wolframalpha.com/input/?i=12.00+#{currency}]")
|
||||
assert_select("a[href='http://www.wolframalpha.com/input/?i=12.00+#{currency}']")
|
||||
end
|
||||
|
||||
it 'displays the order form' do
|
||||
|
||||
Reference in New Issue
Block a user