Compare commits

..

52 Commits

Author SHA1 Message Date
Cesy
3325e1e388 Merge pull request #1020 from Growstuff/dev
Release 13
2016-07-19 10:45:28 +01:00
Daniel O'Connor
7947fd6e91 Clean up link_to as per #1013 2016-07-08 17:08:17 +09:30
Daniel O'Connor
70bf5499b2 Clean up logic a bit as per #1013 2016-07-08 17:07:14 +09:30
Daniel O'Connor
6b059cb4f4 Clean up a bit as per #1013 with TODO comments 2016-07-08 17:06:05 +09:30
Daniel O'Connor
efd112c4b8 And vs && - revised version of b50127c166 2016-07-08 17:01:59 +09:30
Mackenzie Morgan
5c7b760f34 Use array literal [] instead of Array.new 2016-07-08 16:58:34 +09:30
Mackenzie Morgan
81ae473972 space between comma-separated arguments 2016-07-08 16:58:29 +09:30
Mackenzie Morgan
a8171bb739 has_key? -> key? 2016-07-08 16:58:22 +09:30
Daniel O'Connor
c803ed4ee6 Merge pull request #976 from pozorvlak/remove_default_shows
Remove "show" methods that just do the default
2016-07-08 16:56:25 +09:30
Daniel O'Connor
9e41a65749 Tweak readme wiki links
Supercedes #1016
2016-07-08 15:33:16 +09:30
Cesy
a7539df5b5 Merge pull request #1018 from CloCkWeRX/minor_rails_bump
Minor gem upgrades for the month
2016-07-01 10:14:22 +01:00
Daniel O'Connor
3950619877 Update various minor gems even more 2016-07-01 17:42:58 +09:30
Daniel O'Connor
7373fd4aa9 Update various minor gems 2016-07-01 17:34:25 +09:30
Daniel O'Connor
c3d9885525 Merge pull request #987 from CloCkWeRX/upgradazzle_rails
Upgrade to rails 4.2.0+ (round 2)
2016-06-29 14:47:05 +09:30
Daniel O'Connor
4b5dee7bdb Merge pull request #1007 from ctlewitt/dev
issue #1006: change "Freenode" to "irc.freenode.net" in README.md
2016-06-29 12:51:05 +09:30
Charley Lewittes
55d846b9e0 Merge remote-tracking branch 'them/dev' into dev 2016-06-22 10:56:56 -04:00
Daniel O'Connor
f2d8349a88 #1012 Tweak script to avoid errors after merge 2016-06-22 10:46:26 +09:30
Daniel O'Connor
7c7dd7c609 Merge pull request #1012 from pozorvlak/check_contributors_md
Check PR author is in CONTRIBUTORS.md under Travis
2016-06-22 10:25:06 +09:30
Charley Lewittes
d8f2c580ee added myself to contributors list 2016-06-21 13:14:26 -04:00
Charley Lewittes
2a0602468d Added link and wording to access Freenode IRC growstuff channel easily
fixes #1006
2016-06-21 13:03:06 -04:00
Charley Lewittes
89a9c18188 fixes #1006: change "Freenode" to "irc.freenode.net" in README.md 2016-06-21 12:49:33 -04:00
Miles Gould
8b426da149 Check PR author is in CONTRIBUTORS.md under Travis
Results of testing this locally (the exit value of the last command is
in my prompt):

```
0 $ TRAVIS=true TRAVIS_REPO_SLUG=growstuff/growstuff
TRAVIS_PULL_REQUEST=1007 script/check_contributors_md
Checking to see if you're in CONTRIBUTORS.md...

Thanks for your contribution, ctlewitt!
Please add your name and GitHub handle to the file CONTRIBUTORS.md,
commit it, and update your PR.

1 $ TRAVIS=true TRAVIS_REPO_SLUG=growstuff/growstuff
TRAVIS_PULL_REQUEST=1008 script/check_contributors_md
Checking to see if you're in CONTRIBUTORS.md...
- Miles Gould / [pozorvlak](https://github.com/pozorvlak)
0 $ script/check_contributors_md
Checking to see if you're in CONTRIBUTORS.md...
- Miles Gould / [pozorvlak](https://github.com/pozorvlak)
0 $
```
2016-06-21 16:37:26 +01:00
pozorvlak
cab98f9750 Merge pull request #1011 from Growstuff/revert-1002-letsencrypt-pt2-1
Revert "challenge code"
2016-06-21 15:28:15 +01:00
pozorvlak
27b7a26fee Merge pull request #1010 from Growstuff/revert-999-letsencrypt
Revert "lets encrypt challenge page"
2016-06-21 15:27:38 +01:00
Cesy
7261fae9f2 Revert "challenge code" 2016-06-21 15:06:02 +01:00
Cesy
628ebd6841 Revert "lets encrypt challenge page" 2016-06-21 15:05:45 +01:00
Cesy
61bbf7c30d Merge pull request #1008 from pozorvlak/test_gemfile_commits
Check for "forgot to commit Gemfile.lock" in CI
2016-06-21 14:57:54 +01:00
Miles Gould
e33803343a Check for "forgot to commit Gemfile.lock" in CI
Quick-and-dirty script to catch an error we've missed a couple of times
in code review, but which is not (AFAICT) covered by any of our existing
checkers. Inspired by the following posts:

 - https://zachholman.com/posts/how-github-writes-blog-posts/
 - https://zachholman.com/talk/move-fast-break-nothing/
2016-06-21 13:32:11 +01:00
Mackenzie
b08a448fdc hotfix commit: letsencrypt try #2 2016-06-20 13:40:49 -04:00
Cesy
7210ebfb22 Merge pull request #1004 from maco/letsencrypt
Letsencrypt, will be backed out once SSL is up and running.
2016-06-20 16:57:24 +01:00
Mackenzie Morgan
039978357b letsencrypt verification for staging 2016-06-20 11:48:19 -04:00
Cesy
7ce2481cbc Merge pull request #1002 from Growstuff/letsencrypt-pt2-1
challenge code - will also get reverted once SSL is up.
2016-06-20 15:49:33 +01:00
Mackenzie
5bc6af87c5 challenge code 2016-06-20 10:46:40 -04:00
Cesy
a5eaf3566e Merge pull request #999 from Growstuff/letsencrypt
lets encrypt challenge page - temporary change for SSL tool, will be backed out after
2016-06-20 15:42:22 +01:00
Mackenzie
63d89be698 lets encrypt challenge page 2016-06-20 10:34:11 -04:00
pozorvlak
1b7be9f9b0 Merge pull request #936 from maco/add_bootstrap_flashes
Add support for Bootstrap alert types
2016-06-20 10:19:36 +01:00
Mackenzie Morgan
7a53e96d52 test the default case 2016-06-19 22:52:51 -04:00
Mackenzie Morgan
b28d146de7 use default of info
add tests
2016-06-19 22:42:20 -04:00
Mackenzie Morgan
55c8be8dc5 merge 2016-06-19 22:27:27 -04:00
Daniel O'Connor
38a273459a Merge pull request #996 from pozorvlak/block_unknown_urls_in_features
Block external URLs in feature tests
2016-06-18 20:21:32 +09:30
Miles Gould
1b07632c69 Block external URLs in features
https://github.com/teampoltergeist/poltergeist/issues/375#issuecomment-42620085
suggested that this might help with our intermittent "Request to
http://localhost:8081 failed to reach server, check DNS and/or server
status" errors in CI - the theory being that the error message is
misleading, and it's actually a daughter request to an external service
timing out. Seems worth a shot. It also ought to speed up testing, but
the effect is slight (20s out of 3.5 minutes) on my machine.

I've blacklisted only URLs I could find in app/views or by tcpdumping a
test run, because I couldn't get whitelisting to work.
2016-06-17 21:12:25 +01:00
Daniel O'Connor
fd467acc29 Clean up whitespace 2016-06-10 20:51:02 +09:30
Daniel O'Connor
ee604dc2b0 Upgrade activemerchant, fixing rails 5 deprecation warnings 2016-06-10 16:04:00 +09:30
Daniel O'Connor
0620646c6d Fix failing specs
- Updated assert_select behaviour given this is now based on nokogiri
 - Adjust some specs not to look for a specific asset name, but a behaviour
 - Adjust some specs for HTML5 style attributes instead of xhtml style
 - Fix tests that did not render before
2016-06-10 16:01:30 +09:30
Daniel O'Connor
df9cf3f5c4 Fix various rails deprecations 2016-06-10 15:58:39 +09:30
Daniel O'Connor
944349760a Fix DEPRECATION WARNING: #timestamps was called without specifying an option for null.
In Rails 5, this behavior will change to `null: false`. You should manually specify `null: true` to prevent the behavior of your existing migrations from changing
2016-06-10 15:57:48 +09:30
Daniel O'Connor
7fe75ee52a Fix DEPRECATION WARNING: #deliver is deprecated. 2016-06-10 15:45:01 +09:30
Daniel O'Connor
e3d7bf9a62 Upgrade to rails 4.2.* 2016-06-10 15:43:04 +09:30
pozorvlak
e6209a5906 Remove "show" methods that just do the default
We can just fall back to the default implementation for these.
2016-06-08 15:58:45 +01:00
Mackenzie Morgan
1600dd9e0b Merge branch 'dev' of gitmaco:Growstuff/growstuff into add_bootstrap_flashes 2016-06-01 23:37:25 -04:00
Mackenzie Morgan
90f444dc1a Merge branch 'dev' of gitmaco:Growstuff/growstuff into add_bootstrap_flashes 2016-05-31 10:50:56 -04:00
Mackenzie Morgan
32b98a7e40 Add support for Bootstrap alert types
* All alerts are currently shoved into either red (error) or green (success)
* Add support for yellow (warning) and blue (info) alert types

Solution from this Stack Overflow: http://stackoverflow.com/questions/31094771/rails-bootstrap-haml-how-to-convert-this-code-to-display-flash-messages-to
2016-05-30 21:48:11 -04:00
82 changed files with 378 additions and 261 deletions

View File

@@ -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:

View File

@@ -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)

View File

@@ -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'

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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 }

View File

@@ -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

View File

@@ -0,0 +1,6 @@
class PagesController < ApplicationController
def letsencrypt
# use your code here, not mine
render text: "y9KNck8wqkoQLnlr2RgA2TVwWtyYb4PeY_hzGNx0Tfs.dlIPqFhMDCLyQEccczY3roHZ1UWu6UqVeyb9mkRxheU"
end
end

View File

@@ -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

View File

@@ -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.

View File

@@ -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)

View File

@@ -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?

View File

@@ -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

View File

@@ -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

View File

@@ -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|

View File

@@ -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

View File

@@ -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

View File

@@ -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

View 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 } &times;
%span.sr-only Close
= content

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -7,7 +7,7 @@ class CreatePlantings < ActiveRecord::Migration
t.integer :quantity
t.text :description
t.timestamps
t.timestamps null: true
end
end
end

View File

@@ -5,7 +5,7 @@ class CreateComments < ActiveRecord::Migration
t.integer :author_id
t.text :body
t.timestamps
t.timestamps null: true
end
end
end

View File

@@ -8,7 +8,7 @@ class CreateNotifications < ActiveRecord::Migration
t.boolean :read
t.integer :post_id
t.timestamps
t.timestamps null: true
end
end
end

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -6,7 +6,7 @@ class CreateOrderItems < ActiveRecord::Migration
t.decimal :price
t.integer :quantity
t.timestamps
t.timestamps null: true
end
end
end

View File

@@ -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

View File

@@ -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

View File

@@ -7,7 +7,7 @@ class CreateSeeds < ActiveRecord::Migration
t.integer :quantity
t.date :use_by
t.timestamps
t.timestamps null: true
end
end
end

View File

@@ -8,7 +8,7 @@ class CreateHarvests < ActiveRecord::Migration
t.string :units
t.text :notes
t.timestamps
t.timestamps null: true
end
end
end

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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]

View File

@@ -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
View 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
View 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

View File

@@ -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}"

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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