diff --git a/.ruby-version b/.ruby-version index cd57a8b95..399088bf4 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.1.5 +2.1.6 diff --git a/.travis.yml b/.travis.yml index 8b8d9a6b0..04a6dabec 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,7 @@ env: secure: "Z5TpM2jEX4UCvNePnk/LwltQX48U2u9BRc+Iypr1x9QW2o228QJhPIOH39a8RMUrepGnkQIq9q3ZRUn98RfrJz1yThtlNFL3NmzdQ57gKgjGwfpa0e4Dwj/ZJqV2D84tDGjvdVYLP7zzaYZxQcwk/cgNpzKf/jq97HLNP7CYuf4=" bundler_args: "--without development production staging" rvm: -- 2.1.5 +- 2.1.6 before_script: - psql -c 'create database growstuff_test;' -U postgres script: diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 11f85d3b3..deab23739 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -64,4 +64,5 @@ submit the change with your pull request. - Manmeet Singh / [manmeetsingh](https://github.com/manmeetsingh) - Jym Paul Carandang / [jacarandang](https://github.com/jacarandang) - Anthony Atkinson / [sha1sum](https://github.com/sha1sum) -- Terence Conquest / [twconquest](https://github.com/twconquest) \ No newline at end of file +- Terence Conquest / [twconquest](https://github.com/twconquest) +- Daniel O'Connor / [CloCkWeRX](https://github.com/CloCkWeRX) diff --git a/Gemfile b/Gemfile index 745ca273b..0f712add6 100644 --- a/Gemfile +++ b/Gemfile @@ -1,8 +1,8 @@ source 'https://rubygems.org' -ruby '2.1.5' +ruby '2.1.6' -gem 'rails', '4.1.9' +gem 'rails', '4.1.11' gem 'bundler', '>=1.1.5' @@ -35,6 +35,9 @@ gem 'ruby-units' # for unit conversion gem 'comfortable_mexican_sofa', '~> 1.12.0' # content management system +gem 'kaminari' # pagination +gem 'bootstrap-kaminari-views' # bootstrap views for kaminari + # vendored activemerchant for testing- needed for bogus paypal # gateway monkeypatch gem 'activemerchant', '1.33.0', diff --git a/Gemfile.lock b/Gemfile.lock index 39312a659..b68e62dbe 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -20,29 +20,29 @@ PATH GEM remote: https://rubygems.org/ specs: - actionmailer (4.1.9) - actionpack (= 4.1.9) - actionview (= 4.1.9) + actionmailer (4.1.11) + actionpack (= 4.1.11) + actionview (= 4.1.11) mail (~> 2.5, >= 2.5.4) - actionpack (4.1.9) - actionview (= 4.1.9) - activesupport (= 4.1.9) + actionpack (4.1.11) + actionview (= 4.1.11) + activesupport (= 4.1.11) rack (~> 1.5.2) rack-test (~> 0.6.2) - actionview (4.1.9) - activesupport (= 4.1.9) + actionview (4.1.11) + activesupport (= 4.1.11) builder (~> 3.1) erubis (~> 2.7.0) active_link_to (1.0.2) actionpack - activemodel (4.1.9) - activesupport (= 4.1.9) + activemodel (4.1.11) + activesupport (= 4.1.11) builder (~> 3.1) - activerecord (4.1.9) - activemodel (= 4.1.9) - activesupport (= 4.1.9) + activerecord (4.1.11) + activemodel (= 4.1.11) + activesupport (= 4.1.11) arel (~> 5.0.0) - activesupport (4.1.9) + activesupport (4.1.11) i18n (~> 0.6, >= 0.6.9) json (~> 1.7, >= 1.7.7) minitest (~> 5.1) @@ -64,6 +64,9 @@ GEM bonsai-elasticsearch-rails (0.0.4) bootstrap-datepicker-rails (1.3.0.2) railties (>= 3.0) + bootstrap-kaminari-views (0.0.5) + kaminari (>= 0.13) + rails (>= 3.1) bootstrap-sass (3.3.3) autoprefixer-rails (>= 5.0.0.1) sass (>= 3.2.19) @@ -86,7 +89,7 @@ GEM climate_control (0.0.3) activesupport (>= 3.0) cliver (0.3.2) - cocaine (0.5.5) + cocaine (0.5.7) climate_control (>= 0.0.3, < 1.0) codemirror-rails (4.8) railties (>= 3.0, < 5) @@ -136,6 +139,8 @@ GEM warden (~> 1.2.3) diff-lcs (1.2.5) docile (1.1.5) + domain_name (0.5.24) + unf (>= 0.0.5, < 1.0.0) easy_translate (0.5.0) json thread @@ -210,6 +215,8 @@ GEM haml (>= 4.0.0.rc.1) hpricot (~> 0.8.6) ruby_parser (~> 3.1.1) + http-cookie (1.0.2) + domain_name (~> 0.5) httparty (0.13.3) json (~> 1.8) multi_xml (>= 0.5.2) @@ -223,7 +230,7 @@ GEM slop (>= 3.5.0) term-ansicolor terminal-table - jquery-rails (3.1.2) + jquery-rails (3.1.3) railties (>= 3.0, < 5.0) thor (>= 0.14, < 2.0) jquery-ui-rails (5.0.3) @@ -231,7 +238,10 @@ GEM js-routes (0.9.9) railties (>= 3.2) sprockets-rails - json (1.8.2) + json (1.8.3) + kaminari (0.16.3) + actionpack (>= 3.0.0) + activesupport (>= 3.0.0) kgio (2.9.2) kramdown (1.5.0) launchy (2.4.3) @@ -257,14 +267,15 @@ GEM mime-types (>= 1.16, < 3) memcachier (0.0.2) method_source (0.8.2) - mime-types (2.4.3) + mime-types (2.6.1) + mimemagic (0.3.0) mini_portile (0.6.1) - minitest (5.5.1) - multi_json (1.10.1) + minitest (5.8.0) + multi_json (1.11.2) multi_xml (0.5.5) multipart-post (2.0.0) nenv (0.2.0) - netrc (0.10.0) + netrc (0.10.3) newrelic_rpm (3.9.8.273) nokogiri (1.6.5) mini_portile (~> 0.6.0) @@ -284,11 +295,12 @@ GEM multi_json (~> 1.3) omniauth-oauth (~> 1.0) orm_adapter (0.5.0) - paperclip (4.2.1) - activemodel (>= 3.0.0) - activesupport (>= 3.0.0) - cocaine (~> 0.5.3) + paperclip (4.3.0) + activemodel (>= 3.2.0) + activesupport (>= 3.2.0) + cocaine (~> 0.5.5) mime-types + mimemagic (= 0.3.0) pg (0.17.1) plupload-rails (1.2.1) rails (>= 3.1) @@ -303,18 +315,18 @@ GEM slop (~> 3.4) quiet_assets (1.1.0) railties (>= 3.1, < 5.0) - rack (1.5.2) + rack (1.5.5) rack-test (0.6.3) rack (>= 1.0) - rails (4.1.9) - actionmailer (= 4.1.9) - actionpack (= 4.1.9) - actionview (= 4.1.9) - activemodel (= 4.1.9) - activerecord (= 4.1.9) - activesupport (= 4.1.9) + rails (4.1.11) + actionmailer (= 4.1.11) + actionpack (= 4.1.11) + actionview (= 4.1.11) + activemodel (= 4.1.11) + activerecord (= 4.1.11) + activesupport (= 4.1.11) bundler (>= 1.3.0, < 2.0) - railties (= 4.1.9) + railties (= 4.1.11) sprockets-rails (~> 2.0) rails-i18n (4.0.3) i18n (~> 0.6) @@ -324,9 +336,9 @@ GEM rails_stdout_logging rails_serve_static_assets (0.0.2) rails_stdout_logging (0.0.3) - railties (4.1.9) - actionpack (= 4.1.9) - activesupport (= 4.1.9) + railties (4.1.11) + actionpack (= 4.1.11) + activesupport (= 4.1.11) rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) raindrops (0.13.0) @@ -337,7 +349,8 @@ GEM ref (1.0.5) responders (1.1.2) railties (>= 3.2, < 4.2) - rest-client (1.7.2) + rest-client (1.8.0) + http-cookie (>= 1.0.2, < 2.0) mime-types (>= 1.16, < 3.0) netrc (~> 0.7) rspec (3.1.0) @@ -381,12 +394,12 @@ GEM simplecov-html (~> 0.8.0) simplecov-html (0.8.0) slop (3.6.0) - sprockets (2.12.3) + sprockets (2.12.4) hike (~> 1.2) multi_json (~> 1.0) rack (~> 1.0) tilt (~> 1.1, != 1.3.0) - sprockets-rails (2.2.2) + sprockets-rails (2.3.2) actionpack (>= 3.0) activesupport (>= 3.0) sprockets (>= 2.8, < 4.0) @@ -398,7 +411,7 @@ GEM ref thor (0.19.1) thread (0.1.4) - thread_safe (0.3.4) + thread_safe (0.3.5) tilt (1.4.1) tins (1.3.3) tzinfo (1.2.2) @@ -406,6 +419,9 @@ GEM uglifier (2.5.3) execjs (>= 0.3.0) json (>= 1.8.0) + unf (0.1.4) + unf_ext + unf_ext (0.0.7.1) unicorn (4.8.3) kgio (~> 2.6) rack @@ -434,6 +450,7 @@ DEPENDENCIES bluecloth bonsai-elasticsearch-rails bootstrap-datepicker-rails + bootstrap-kaminari-views bundler (>= 1.1.5) byebug cancancan (~> 1.9) @@ -464,6 +481,7 @@ DEPENDENCIES jquery-rails jquery-ui-rails (~> 5.0.2) js-routes + kaminari leaflet-markercluster-rails leaflet-rails less (~> 2.5.0) @@ -480,7 +498,7 @@ DEPENDENCIES poltergeist (~> 1.6) pry quiet_assets - rails (= 4.1.9) + rails (= 4.1.11) rails_12factor rake (>= 10.0.0) rspec-activemodel-mocks diff --git a/app/assets/javascripts/finish_planting.js.coffee b/app/assets/javascripts/finish_planting.js.coffee index b8139b7fe..f52409a66 100644 --- a/app/assets/javascripts/finish_planting.js.coffee +++ b/app/assets/javascripts/finish_planting.js.coffee @@ -9,11 +9,11 @@ jQuery -> finished = $('#planting_finished_at') if @checked if previousValue.length - date = previousValue + date = previousValue finished.val(date) else finished.trigger('focus') else previousValue = finished.val() finished.val('') - ) \ No newline at end of file + ) diff --git a/app/controllers/notifications_controller.rb b/app/controllers/notifications_controller.rb index 4608d3f99..f1934ded3 100644 --- a/app/controllers/notifications_controller.rb +++ b/app/controllers/notifications_controller.rb @@ -5,7 +5,7 @@ class NotificationsController < ApplicationController # GET /notifications def index - @notifications = Notification.where(recipient_id: current_member) + @notifications = Notification.where(recipient_id: current_member).page(params[:page]) respond_to do |format| format.html # index.html.erb diff --git a/app/mailers/notifier.rb b/app/mailers/notifier.rb index a37d65d67..5ffb862d6 100644 --- a/app/mailers/notifier.rb +++ b/app/mailers/notifier.rb @@ -2,12 +2,19 @@ class Notifier < ActionMailer::Base include NotificationsHelper default from: "Growstuff " + 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 + end + def notify(notification) @notification = notification @reply_link = reply_link(@notification) # Encrypting - verifier = ActiveSupport::MessageVerifier.new(ENV['RAILS_SECRET_TOKEN']) @signed_message = verifier.generate ({ member_id: @notification.recipient.id, type: :send_notification_email }) mail(:to => @notification.recipient.email, @@ -21,7 +28,6 @@ class Notifier < ActionMailer::Base @harvests = @member.harvests.first(5) # Encrypting - verifier = ActiveSupport::MessageVerifier.new(ENV['RAILS_SECRET_TOKEN']) @signed_message = verifier.generate ({ member_id: @member.id, type: :send_planting_reminder }) if @member.send_planting_reminder diff --git a/app/models/planting.rb b/app/models/planting.rb index f06ccf9ac..900156b2a 100644 --- a/app/models/planting.rb +++ b/app/models/planting.rb @@ -105,7 +105,7 @@ class Planting < ActiveRecord::Base if differences.compact.empty? nil else - differences.compact.sum/differences.compact.length + differences.compact.sum/differences.compact.size end end diff --git a/app/views/devise/registrations/_edit_email.html.haml b/app/views/devise/registrations/_edit_email.html.haml index 1ea863e2a..a44fbc3c8 100644 --- a/app/views/devise/registrations/_edit_email.html.haml +++ b/app/views/devise/registrations/_edit_email.html.haml @@ -9,24 +9,28 @@ %span.help-block If you change your email address you will have to reconfirm. .form-group - .col-md-offset-2.col-md-8 - = f.check_box :show_email - Show email publicly on your profile page. + .col-md-offset-2.col-md-8.checkbox + %label + = f.check_box :show_email + Show email publicly on your profile page. .form-group - .col-md-offset-2.col-md-8 - = f.check_box :send_notification_email - Receive emailed copies of Inbox notifications (eg. private messages). + .col-md-offset-2.col-md-8.checkbox + %label + = f.check_box :send_notification_email + Receive emailed copies of Inbox notifications (eg. private messages). .form-group - .col-md-offset-2.col-md-8 - = f.check_box :send_planting_reminder - Receive regular reminders to track your planting and harvesting. + .col-md-offset-2.col-md-8.checkbox + %label + = f.check_box :send_planting_reminder + Receive regular reminders to track your planting and harvesting. .form-group - .col-md-offset-2.col-md-8 - = f.check_box :newsletter - Subscribe to the #{ENV['GROWSTUFF_SITE_NAME']} newsletter + .col-md-offset-2.col-md-8.checkbox + %label + = f.check_box :newsletter + Subscribe to the #{ENV['GROWSTUFF_SITE_NAME']} newsletter .help-block = render :partial => 'newsletter_blurb' diff --git a/app/views/devise/registrations/new.html.haml b/app/views/devise/registrations/new.html.haml index 268fc3e45..f15142bb0 100644 --- a/app/views/devise/registrations/new.html.haml +++ b/app/views/devise/registrations/new.html.haml @@ -26,15 +26,17 @@ .col-md-8= f.password_field :password_confirmation, :class => 'form-control' .form-group - .col-md-offset-2.col-md-8 - = f.check_box :tos_agreement - I agree to the - = succeed "." do - = link_to 'Terms of Service', url_for(:action => 'tos', :controller => '/policy') + .col-md-offset-2.col-md-8.checkbox + %label + = f.check_box :tos_agreement + I agree to the + = succeed "." do + = link_to 'Terms of Service', url_for(:action => 'tos', :controller => '/policy') .form-group - .col-md-offset-2.col-md-8 - = f.check_box :newsletter, :checked => true - Subscribe to the #{ENV['GROWSTUFF_SITE_NAME']} newsletter + .col-md-offset-2.col-md-8.checkbox + %label + = f.check_box :newsletter, :checked => true + Subscribe to the #{ENV['GROWSTUFF_SITE_NAME']} newsletter .help-inline = render :partial => 'newsletter_blurb' diff --git a/app/views/devise/sessions/new.html.haml b/app/views/devise/sessions/new.html.haml index 51d7b6845..4fdef08be 100644 --- a/app/views/devise/sessions/new.html.haml +++ b/app/views/devise/sessions/new.html.haml @@ -15,9 +15,10 @@ - if devise_mapping.rememberable? .form-group - .col-md-8.col-md-offset-2 - = f.check_box :remember_me - Remember me + .col-md-8.col-md-offset-2.checkbox + %label + = f.check_box :remember_me + Remember me .form-group .form-actions.col-md-8.col-md-offset-2 diff --git a/app/views/gardens/_thumbnail.html.haml b/app/views/gardens/_thumbnail.html.haml index c622098c9..bd3fc7eb1 100644 --- a/app/views/gardens/_thumbnail.html.haml +++ b/app/views/gardens/_thumbnail.html.haml @@ -25,9 +25,9 @@ %dd= garden.active ? "Yes" : "No" .col-md-12 %b - = "#{pluralize(garden.plantings.count, "Planting")} : " + = "#{pluralize(garden.plantings.size, "Planting")} : " = display_garden_plantings(garden.plantings.current) - - if garden.plantings.count > 2 + - if garden.plantings.size > 2 %br = link_to "See more plantings >>", garden_path(garden) .panel-footer diff --git a/app/views/home/_stats.html.haml b/app/views/home/_stats.html.haml index e13f74719..53ffd2492 100644 --- a/app/views/home/_stats.html.haml +++ b/app/views/home/_stats.html.haml @@ -1,7 +1,7 @@ - cache("homepage_stats") do %p.stats - = t('.message_html', { member: link_to(t('.member_linktext', count: Member.confirmed.count.to_i), members_path), - number_crops: link_to(t('.number_crops_linktext', count: Crop.count.to_i), crops_path), + = t('.message_html', { member: link_to(t('.member_linktext', count: Member.confirmed.size.to_i), members_path), + number_crops: link_to(t('.number_crops_linktext', count: Crop.count.to_i), crops_path), number_plantings: link_to(t('.number_plantings_linktext', count: Planting.count.to_i), plantings_path), number_gardens: link_to(t('.number_gardens_linktext', count: Garden.count.to_i), gardens_path) }) diff --git a/app/views/layouts/_footer.html.haml b/app/views/layouts/_footer.html.haml index 946f45529..75e93f27f 100644 --- a/app/views/layouts/_footer.html.haml +++ b/app/views/layouts/_footer.html.haml @@ -7,3 +7,6 @@ != cms_snippet_content(:footer2) .col-md-4#footer3 != cms_snippet_content(:footer3) + %div(style="float: right;") + %a(href="http://opendefinition.org/ossd/") + %img(src="http://assets.okfn.org/images/ok_buttons/os_80x15_blue.png" alt="") diff --git a/app/views/notifications/index.html.haml b/app/views/notifications/index.html.haml index d5b373606..e5352ad26 100644 --- a/app/views/notifications/index.html.haml +++ b/app/views/notifications/index.html.haml @@ -1,6 +1,7 @@ - content_for :title, "Inbox" - if @notifications.size > 0 + = paginate @notifications, theme: 'twitter-bootstrap-3' %table.table.table-striped %tr %th From @@ -28,5 +29,6 @@ %strong= n.created_at %td = link_to 'Delete', n, method: :delete, data: { confirm: 'Are you sure?' }, :class => 'btn btn-default btn-xs' + = paginate @notifications, theme: 'twitter-bootstrap-3' - else You have no messages. diff --git a/app/views/plantings/_planting_progress.html.haml b/app/views/plantings/_planting_progress.html.haml index 86ba5d1a5..eea698c82 100644 --- a/app/views/plantings/_planting_progress.html.haml +++ b/app/views/plantings/_planting_progress.html.haml @@ -1,4 +1,4 @@ -- if DateTime.now.to_date < planting.planted_at +- if (planting.planted_at.nil? || DateTime.now.to_date < planting.planted_at) = "Progress: 0% - not planted yet" = render partial: "plantings/progress_bar", locals: {status: "warning", progress: "100%"} - elsif planting.finished? diff --git a/app/views/posts/_summary.html.haml b/app/views/posts/_summary.html.haml index 65fdeb567..59a58dd47 100644 --- a/app/views/posts/_summary.html.haml +++ b/app/views/posts/_summary.html.haml @@ -15,7 +15,8 @@ %td.hidden-xs =link_to post.author, post.author %td - = distance_of_time_in_words(post.recent_activity, Time.zone.now) - ago + = post.recent_activity.to_date.to_formatted_s(:short) + // once the site gets more active, can change this to include time as well + // can't make it relative (distance_of_time_in_words) as it's cached %td.hidden-xs = post.comments.size.to_s diff --git a/app/views/seeds/index.csv.shaper b/app/views/seeds/index.csv.shaper index 818e68909..68f5664d3 100644 --- a/app/views/seeds/index.csv.shaper +++ b/app/views/seeds/index.csv.shaper @@ -11,6 +11,9 @@ csv.headers :id, :latitude, :longitude, :description, + :organic, + :gmo, + :heirloom, :date_added, :last_modified, :license @@ -37,6 +40,9 @@ csv.headers :id, csv.cell :longitude, s.owner.longitude csv.cell :description + csv.cell :organic + csv.cell :gmo + csv.cell :heirloom csv.cell :date_added, s.created_at.to_s(:db) csv.cell :last_modified, s.updated_at.to_s(:db) diff --git a/app/views/seeds/index.rss.haml b/app/views/seeds/index.rss.haml index 30cec02af..c35bc0d74 100644 --- a/app/views/seeds/index.rss.haml +++ b/app/views/seeds/index.rss.haml @@ -12,6 +12,9 @@ :escaped

Quantity: #{seed.quantity ? seed.quantity : 'unknown' }

Plant before: #{seed.plant_before ? seed.plant_before : 'unknown' }

+

Organic? #{seed.organic}

+

GMO? #{seed.gmo}

+

Heirloom? #{seed.heirloom}

- if seed.tradable? :escaped

Will trade #{seed.tradable_to} from #{seed.owner.location ? seed.owner.location : 'unknown location'}

diff --git a/spec/controllers/photos_controller_spec.rb b/spec/controllers/photos_controller_spec.rb index 286b23b64..603959b46 100644 --- a/spec/controllers/photos_controller_spec.rb +++ b/spec/controllers/photos_controller_spec.rb @@ -115,7 +115,7 @@ describe PhotosController do post :create, {:photo => { :flickr_photo_id => photo.flickr_photo_id }, :type => "planting", :id => planting.id } - Photo.last.plantings.count.should eq 1 + Photo.last.plantings.size.should eq 1 end it "attaches the photo to a harvest" do @@ -140,7 +140,7 @@ describe PhotosController do post :create, {:photo => { :flickr_photo_id => photo.flickr_photo_id }, :type => "harvest", :id => harvest.id } - Photo.last.harvests.count.should eq 1 + Photo.last.harvests.size.should eq 1 end end diff --git a/spec/features/footer_spec.rb b/spec/features/footer_spec.rb index 400b153a4..6c0c7cead 100644 --- a/spec/features/footer_spec.rb +++ b/spec/features/footer_spec.rb @@ -2,11 +2,16 @@ require 'rails_helper' feature "footer" do + before { visit root_path } + scenario "footer is on home page" do - visit root_path expect(page).to have_css 'footer' end + it 'has the Open Service link and graphic' do + expect(page).to have_selector 'a[href="http://opendefinition.org/ossd/"]' + end + # NB: not testing specific content in the footer since I'm going to put them # in the CMS and they'll be variable. end diff --git a/spec/features/harvests/harvesting_a_crop_spec.rb b/spec/features/harvests/harvesting_a_crop_spec.rb index 1508feaa5..802f67a4d 100644 --- a/spec/features/harvests/harvesting_a_crop_spec.rb +++ b/spec/features/harvests/harvesting_a_crop_spec.rb @@ -23,8 +23,8 @@ feature "Harvesting a crop", :js do expect(page).to have_selector 'textarea#harvest_description[placeholder="optional"]' end - scenario "Creating a new harvest", :js => true do - fill_autocomplete "crop", :with => "mai" + scenario "Creating a new harvest", :js do + fill_autocomplete "crop", with: "mai" select_from_autocomplete "maize" within "form#new_harvest" do fill_in "When?", with: "2014-06-15" @@ -38,7 +38,7 @@ feature "Harvesting a crop", :js do end context "Clicking edit from the index page" do - let!(:harvest) { FactoryGirl.create(:harvest, :crop => maize, :owner => member) } + let!(:harvest) { create :harvest, crop: maize, owner: member } background do visit harvests_path diff --git a/spec/features/notifications_spec.rb b/spec/features/notifications_spec.rb index ee83f5c17..9949a619d 100644 --- a/spec/features/notifications_spec.rb +++ b/spec/features/notifications_spec.rb @@ -28,4 +28,25 @@ feature "Notifications", :js do expect(page).to have_content "Message was successfully sent" end end + + describe 'pagination' do + before do + 34.times { FactoryGirl.create :notification, recipient: recipient } + login_as recipient + visit notifications_path + end + + it 'has page navigation' do + expect(page).to have_selector 'a[rel="next"]' + end + + it 'paginates at 30 notifications per page' do + expect(page).to have_selector 'tr', count: 31 + end + + it 'navigates pages' do + first('a[rel="next"]').click + expect(page).to have_selector 'tr', count: 5 + end + end end \ No newline at end of file diff --git a/spec/models/crop_spec.rb b/spec/models/crop_spec.rb index 724567626..90e02c5fc 100644 --- a/spec/models/crop_spec.rb +++ b/spec/models/crop_spec.rb @@ -232,7 +232,7 @@ describe Crop do Crop.interesting.should include @crop1 Crop.interesting.should include @crop2 - Crop.interesting.length.should == 2 + Crop.interesting.size.should == 2 end it 'ignores crops without plantings' do @@ -254,7 +254,7 @@ describe Crop do Crop.interesting.should include @crop1 Crop.interesting.should_not include @crop2 - Crop.interesting.length.should == 1 + Crop.interesting.size.should == 1 end @@ -280,7 +280,7 @@ describe Crop do Crop.interesting.should include @crop1 Crop.interesting.should_not include @crop2 - Crop.interesting.length.should == 1 + Crop.interesting.size.should == 1 end end diff --git a/spec/models/forum_spec.rb b/spec/models/forum_spec.rb index dfebfa356..7c26c8f4b 100644 --- a/spec/models/forum_spec.rb +++ b/spec/models/forum_spec.rb @@ -19,7 +19,7 @@ describe Forum do it "has many posts" do @post1 = FactoryGirl.create(:forum_post, :forum => forum) @post2 = FactoryGirl.create(:forum_post, :forum => forum) - forum.posts.length.should == 2 + forum.posts.size.should == 2 end it "orders posts in reverse chron order" do diff --git a/spec/models/garden_spec.rb b/spec/models/garden_spec.rb index 6eebba460..ab52e2fac 100644 --- a/spec/models/garden_spec.rb +++ b/spec/models/garden_spec.rb @@ -88,7 +88,7 @@ describe Garden do garden = FactoryGirl.create(:garden, :owner => owner) @planting1 = FactoryGirl.create(:planting, :garden => garden) @planting2 = FactoryGirl.create(:planting, :garden => garden) - garden.plantings.length.should == 2 + garden.plantings.size.should == 2 all = Planting.count garden.destroy Planting.count.should == all - 2 diff --git a/spec/models/member_spec.rb b/spec/models/member_spec.rb index b91584953..93760a904 100644 --- a/spec/models/member_spec.rb +++ b/spec/models/member_spec.rb @@ -23,7 +23,7 @@ describe 'member' do end it 'should have a default garden' do - member.gardens.count.should == 1 + member.gardens.size.should == 1 end it 'should have a accounts entry' do @@ -61,13 +61,13 @@ describe 'member' do it "has many comments" do @comment1 = FactoryGirl.create(:comment, :author => member) @comment2 = FactoryGirl.create(:comment, :author => member) - member.comments.length.should == 2 + member.comments.size.should == 2 end it "has many forums" do @forum1 = FactoryGirl.create(:forum, :owner => member) @forum2 = FactoryGirl.create(:forum, :owner => member) - member.forums.length.should == 2 + member.forums.size.should == 2 end it 'has location and lat/long fields' do @@ -221,12 +221,12 @@ describe 'member' do end it 'sees confirmed members' do - Member.confirmed.count.should == 2 + Member.confirmed.size.should == 2 end it 'ignores unconfirmed members' do @member3 = FactoryGirl.create(:unconfirmed_member) - Member.confirmed.count.should == 2 + Member.confirmed.size.should == 2 end end diff --git a/spec/models/photo_spec.rb b/spec/models/photo_spec.rb index 650f0f57c..36a9eb068 100644 --- a/spec/models/photo_spec.rb +++ b/spec/models/photo_spec.rb @@ -11,19 +11,19 @@ describe Photo do context "adds photos" do it 'to a planting' do planting.photos << photo - expect(planting.photos.count).to eq 1 + expect(planting.photos.size).to eq 1 expect(planting.photos.first).to eq photo end it 'to a harvest' do harvest.photos << photo - expect(harvest.photos.count).to eq 1 + expect(harvest.photos.size).to eq 1 expect(harvest.photos.first).to eq photo end it 'to a garden' do garden.photos << photo - expect(garden.photos.count).to eq 1 + expect(garden.photos.size).to eq 1 expect(garden.photos.first).to eq photo end end @@ -32,19 +32,19 @@ describe Photo do it 'from a planting' do planting.photos << photo photo.destroy - expect(planting.photos.count).to eq 0 + expect(planting.photos.size).to eq 0 end it 'from a harvest' do harvest.photos << photo photo.destroy - expect(harvest.photos.count).to eq 0 + expect(harvest.photos.size).to eq 0 end it 'from a garden' do garden.photos << photo photo.destroy - expect(garden.photos.count).to eq 0 + expect(garden.photos.size).to eq 0 end it "automatically if unused" do diff --git a/spec/models/planting_spec.rb b/spec/models/planting_spec.rb index 16bb8b613..659636c5e 100644 --- a/spec/models/planting_spec.rb +++ b/spec/models/planting_spec.rb @@ -229,7 +229,7 @@ describe Planting do context "with howmany argument" do it "only returns the number asked for" do @plantings = FactoryGirl.create_list(:planting, 10) - Planting.interesting(3, false).length.should eq 3 + Planting.interesting(3, false).size.should eq 3 end end diff --git a/spec/models/post_spec.rb b/spec/models/post_spec.rb index cb9324d3f..c56a5b301 100644 --- a/spec/models/post_spec.rb +++ b/spec/models/post_spec.rb @@ -24,7 +24,7 @@ describe Post do @datestr = @time.strftime("%Y%m%d") # 2 digit day and month, full-length years # Counting digits using Math.log is not precise enough! - @datestr.length.should == 4 + @time.year.to_s.size + @datestr.size.should == 4 + @time.year.to_s.size @post.slug.should == "#{member.login_name}-#{@datestr}-a-post" end @@ -32,14 +32,14 @@ describe Post do @post = FactoryGirl.create(:post, :author => member) @comment1 = FactoryGirl.create(:comment, :post => @post) @comment2 = FactoryGirl.create(:comment, :post => @post) - @post.comments.length.should == 2 + @post.comments.size.should == 2 end it "destroys comments when deleted" do @post = FactoryGirl.create(:post, :author => member) @comment1 = FactoryGirl.create(:comment, :post => @post) @comment2 = FactoryGirl.create(:comment, :post => @post) - @post.comments.length.should == 2 + @post.comments.size.should == 2 all = Comment.count @post.destroy Comment.count.should == all - 2 diff --git a/spec/models/seed_spec.rb b/spec/models/seed_spec.rb index 58ae56ea7..65008adcc 100644 --- a/spec/models/seed_spec.rb +++ b/spec/models/seed_spec.rb @@ -146,7 +146,7 @@ describe Seed do Seed.interesting.should_not include @seed2 Seed.interesting.should_not include @seed3 Seed.interesting.should_not include @seed4 - Seed.interesting.length.should == 1 + Seed.interesting.size.should == 1 end end diff --git a/spec/views/forums/index.html.haml_spec.rb b/spec/views/forums/index.html.haml_spec.rb index 93d7090a9..9e7ef6f7e 100644 --- a/spec/views/forums/index.html.haml_spec.rb +++ b/spec/views/forums/index.html.haml_spec.rb @@ -45,7 +45,7 @@ describe "forums/index" do it "displays posts" do assert_select "table" rendered.should have_content @post.subject - rendered.should have_content "less than a minute ago" + rendered.should have_content Date.today.to_s(:short) end it "displays comment count" do diff --git a/spec/views/notifications/index.html.haml_spec.rb b/spec/views/notifications/index.html.haml_spec.rb index 04ecdd176..362037cce 100644 --- a/spec/views/notifications/index.html.haml_spec.rb +++ b/spec/views/notifications/index.html.haml_spec.rb @@ -26,10 +26,11 @@ describe "notifications/index" do before(:each) do @notification = FactoryGirl.create(:notification, :sender => @member, :recipient => @member) - assign(:notifications, [ @notification, @notification ]) + assign(:notifications, Kaminari.paginate_array([ @notification, @notification ]).page(1)) render end + it "renders a list of notifications" do assert_select "table" assert_select "tr>td", :text => @notification.sender.to_s, :count => 2 @@ -45,7 +46,7 @@ describe "notifications/index" do it "shows (no subject)" do @notification = FactoryGirl.create(:notification, :sender => @member, :recipient => @member, :subject => nil) - assign(:notifications, [@notification]) + assign(:notifications, Kaminari.paginate_array([@notification]).page(1)) render rendered.should have_content "(no subject)" end @@ -55,7 +56,7 @@ describe "notifications/index" do it "shows (no subject)" do @notification = FactoryGirl.create(:notification, :sender => @member, :recipient => @member, :subject => " ") - assign(:notifications, [@notification]) + assign(:notifications, Kaminari.paginate_array([@notification]).page(1)) render rendered.should have_content "(no subject)" end diff --git a/vendor/gems/activemerchant-1.33.0/lib/support/ssl_verify.rb b/vendor/gems/activemerchant-1.33.0/lib/support/ssl_verify.rb index 1ba28878a..ccb6650d5 100644 --- a/vendor/gems/activemerchant-1.33.0/lib/support/ssl_verify.rb +++ b/vendor/gems/activemerchant-1.33.0/lib/support/ssl_verify.rb @@ -10,7 +10,7 @@ class SSLVerify def test_gateways success, failed, missing, errored, disabled = [], [], [], [], [] - puts "Verifying #{@gateways.count} SSL certificates\n\n" + puts "Verifying #{@gateways.size} SSL certificates\n\n" @gateways.each do |g| if !g.live_url