This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
guard "minitest", all_on_start: false, rerun: false do | |
# with Minitest::Spec | |
watch(%r|^test/(.*)_test\.rb|) | |
watch(%r|^lib/(.*)([^/]+)\.rb|) { |m| "test/#{m[1]}#{m[2]}_test.rb" } | |
watch(%r|^test/minitest_helper\.rb|) { "test" } | |
watch(%r|^test/support/|) { "test" } | |
# Rails 3.2 | |
watch(%r|^app/controllers/(.*)\.rb|) { |m| "test/controllers/#{m[1]}_test.rb" } | |
watch(%r|^app/mailers/(.*)\.rb|) { |m| "test/mailers/#{m[1]}_test.rb" } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Models | |
module Concerns | |
module Bannable | |
extend ActiveSupport::Concern | |
included do | |
default_scope -> { where(banned_at: nil) } | |
end | |
def ban(reason=nil) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
// Localize jQuery variable | |
var jQuery; | |
/******** Load jQuery if not present *********/ | |
if (window.jQuery === undefined || window.jQuery.fn.jquery !== '1.4.2') { | |
var script_tag = document.createElement('script'); | |
script_tag.setAttribute("type","text/javascript"); | |
script_tag.setAttribute("src", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe "unpublished reviews are fucking up listing scores" do | |
let(:reviewable) { create(:dispensary) } | |
let(:user) { create :user } | |
before do | |
25.times do | |
review = Review.create! user: user, reviewable: reviewable, | |
title: "title", body: "body" | |
review.create_rates atmosphere: 5, bud_quality: 5, accessibility: 5, | |
staff: 5, price: 5 | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Bannable | |
extend ActiveSupport::Concern | |
included do | |
extend ClassMethods | |
default_scope where("banned_at IS NULL") | |
end | |
def ban(reason=nil) | |
options = ban_attributes({ban_reason: reason, banned_at: DateTime.now}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Requires on the model that mixes this concern in: | |
# => approved_by integer | |
# => approved_at DateTime | |
# => disapproved_by integer | |
# => disapproved_at DateTime | |
module Moderation | |
extend ActiveSupport::Concern | |
included do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if 5+5 == 10#topic.save! | |
else #Error Saving | |
p "#{topic.errors.full_messages}" | |
pp topic.attributes | |
20.times { p "------------------" } | |
errs << ["#{topic.errors.full_messages}", topic.attributes] | |
# output/log why no save | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{:docs=>[{:id=>1, | |
:"region-tz-min-offset"=>-480, | |
:"dispensary-name"=>"dr. greenthumb garden supply 1", | |
:"dispensary-slug"=>"dr-greenthumb-garden-supply-1", | |
:"title-pc"=>"Dr. Greenthumb Garden Supply 1", | |
:"dispensary-rating-power"=>"5.0000", | |
:"dispensary-created"=>"1970-01-01T00:00:00.000Z", :video_url=>nil, | |
:"dispensary-region-slug"=>"lake-tahoe", | |
:"super-region-id"=>2, | |
:"super-region-name"=>"California", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{:docs=>[{:id=>1, :"region-tz-min-offset"=>-480, :"dispensary-name"=>"dr. greenthumb garden supply 1", :"dispensary-slug"=>"dr-greenthumb-garden-supply-1", :"title-pc"=>"Dr. Greenthumb Garden Supply 1", :"dispensary-rating-power"=>"5.0000", :"dispensary-created"=>"1970-01-01T00:00:00.000Z", :video_url=>nil, :"dispensary-region-slug"=>"lake-tahoe", :"super-region-id"=>2, :"super-region-name"=>"California", :"super-region-slug"=>"california", :"dispensary-has-videos"=>0, :"dispensary-has-gpen"=>0, :"dispensary-hits"=>0, :hits=>0, :"reviewer-count"=>1, :intro=>"Hello body text", :"dispensary-intro"=>"Hello body text", :name=>"dr. greenthumb garden supply 1", :"name-phrase"=>"dr. greenthumb garden supply 1", :phone=>"555-555-5555", :zip=>"12345", :city=>"lake tahoe", :"city-phrase"=>"Lake Tahoe", :state=>"CA", :latitude=>32.751117, :longitude=>-117.213405, :location=>"32.751117,-117.213405", :featured=>1, :type=>"dispensary", :"within-5-mi-of"=>[], :"within-25-mi-of"=>[], :"within-50-mi-of"=>[], :"within-100-mi-o |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
## .git/hooks/pre-commit | |
bundle exec rake db:migrate | |
bundle exec rake db:test:prepare | |
bundle exec rake test |