diff
stringlengths 65
26.7k
| message
stringlengths 7
9.92k
|
|---|---|
diff --git a/spec/pptx/smoke/api_shape_spec.rb b/spec/pptx/smoke/api_shape_spec.rb
index abc1234..def5678 100644
--- a/spec/pptx/smoke/api_shape_spec.rb
+++ b/spec/pptx/smoke/api_shape_spec.rb
@@ -0,0 +1,30 @@+require 'spec_helper'
+describe 'ApiShape section tests' do
+ it 'ApiShape | GetClassType method' do
+ pptx = DocBuilderWrapper.new.build_doc_and_parse('asserts/js/pptx/smoke/ApiShape/getclasstype.js')
+ expect(pptx.slides.first.elements.first.shape_properties.preset.name).to eq(:flowChartOnlineStorage)
+ expect(pptx.slides[0].nonempty_elements.first.text_body.paragraphs
+ .first.characters.first.text).to eq('Class Type = shape')
+ expect(pptx.slides.first.elements.first.shape_properties.fill.type).to eq(:solid)
+ shape_color = pptx.slides.first.elements.last.shape_properties.fill.value
+ expect([shape_color.red, shape_color.green, shape_color.blue].to_s).to eq("[61, 74, 107]")
+ shape_size = pptx.slides.first.elements.first.shape_properties.shape_size.offset
+ expect([shape_size.x.to_s, shape_size.y.to_s]).to eq(["608400.0 emu", "1267200.0 emu"])
+ end
+
+ it 'ApiShape | GetDocContent method' do
+ pptx = DocBuilderWrapper.new.build_doc_and_parse('asserts/js/pptx/smoke/ApiShape/getdoccontent.js')
+ expect(pptx.slides.first.elements.first.shape_properties.preset.name).to eq(:flowChartOnlineStorage)
+ expect(pptx.slides[0].elements.first.text_body.paragraphs
+ .last.characters.first.text).to eq("We removed all elements from the shape and added a new paragraph inside it ")
+ expect(pptx.slides[0].elements.first.text_body.paragraphs
+ .last.characters.last.text).to eq("aligning it vertically by the bottom.")
+ expect(pptx.slides[0].elements.last.text_body.paragraphs.last.properties.align).to eq(:left)
+ end
+
+ it 'ApiShape | SetVerticalTextAlign method' do
+ pptx = DocBuilderWrapper.new.build_doc_and_parse('asserts/js/pptx/smoke/ApiShape/getdoccontent.js')
+ expect(pptx.slides.first.elements.first.shape_properties.preset.name).to eq(:flowChartOnlineStorage)
+ expect(pptx.slides[0].elements.first.text_body.properties.vertical_align).to eq(:bottom)
+ end
+end
|
Add shape test for presentation.
|
diff --git a/spec/services/next_player_spec.rb b/spec/services/next_player_spec.rb
index abc1234..def5678 100644
--- a/spec/services/next_player_spec.rb
+++ b/spec/services/next_player_spec.rb
@@ -0,0 +1,18 @@+require "rails_helper"
+
+RSpec.describe NextPlayer, type: :service do
+ fixtures :all
+ let(:find_next_player) { NextPlayer.new(round) }
+
+ describe "#call" do
+ before { find_next_player.call }
+
+ context "when bidding has finished" do
+ let(:round) { rounds(:playing_round) }
+
+ it "returns the player who won the bidding" do
+ expect(find_next_player.next_player).to eq(players(:player2))
+ end
+ end
+ end
+end
|
Add basic spec for next_player
|
diff --git a/spec/watirspec/checkboxes_spec.rb b/spec/watirspec/checkboxes_spec.rb
index abc1234..def5678 100644
--- a/spec/watirspec/checkboxes_spec.rb
+++ b/spec/watirspec/checkboxes_spec.rb
@@ -24,6 +24,7 @@ count = 0
browser.checkboxes.each_with_index do |c, index|
+ c.should be_instance_of(CheckBox)
c.name.should == browser.checkbox(:index, index).name
c.id.should == browser.checkbox(:index, index).id
c.value.should == browser.checkbox(:index, index).value
|
Make sure CheckBoxCollection enumerates ChecBox instances.
|
diff --git a/week-4/triangle-side/my_solution.rb b/week-4/triangle-side/my_solution.rb
index abc1234..def5678 100644
--- a/week-4/triangle-side/my_solution.rb
+++ b/week-4/triangle-side/my_solution.rb
@@ -1,4 +1,4 @@-# I worked on this challenge [by myself, with: ].
+# I worked on this challenge [by myself, with: Kevin Corso].
# Your Solution Below
|
Add triangle-side challenge edit typo
|
diff --git a/ticket_gate.gemspec b/ticket_gate.gemspec
index abc1234..def5678 100644
--- a/ticket_gate.gemspec
+++ b/ticket_gate.gemspec
@@ -22,4 +22,6 @@ spec.add_development_dependency "rake"
spec.add_development_dependency "rspec"
spec.add_development_dependency "rocket_pants"
+
+ spec.add_runtime_dependency "rocket_pants", "~> 1.9.1"
end
|
Add rocket_pants as runtime dependency
|
diff --git a/sprout-osx-apps/attributes/vlc.rb b/sprout-osx-apps/attributes/vlc.rb
index abc1234..def5678 100644
--- a/sprout-osx-apps/attributes/vlc.rb
+++ b/sprout-osx-apps/attributes/vlc.rb
@@ -0,0 +1,2 @@+node.default["vlc_version"]="2.0.8"
+node.default["vlc_checksum"]="bbfdc6d10d9f3a4d357d276d9c6db9c049e637fa2cc54fa511f0fce914a38ea0"
|
Copy VLC attributes into sprout-osx-apps, update to version 2.08
|
diff --git a/_plugins/jekyll_slideshow.rb b/_plugins/jekyll_slideshow.rb
index abc1234..def5678 100644
--- a/_plugins/jekyll_slideshow.rb
+++ b/_plugins/jekyll_slideshow.rb
@@ -9,10 +9,11 @@
def generate(site)
+ config = Jekyll.configuration({})['slideshow']
site.static_files.each do |file|
if File.extname(file.path).downcase == ('.jpg' || '.png') && file.path.index("-thumb") == nil
img = Magick::Image::read(file.path).first
- thumb = img.resize_to_fill(150, 150)
+ thumb = img.resize_to_fill(config['width'], config['height'])
path = file.path.sub(File.extname(file.path), '-thumb' << File.extname(file.path))
thumb.write path
site.static_files << StaticFile.new(thumb, site.source, File.dirname(file.path).sub(site.source, ''), File.basename(file.path).sub('.JPG', '-thumb.JPG'))
|
Set thumbnail size based on config
|
diff --git a/sonos_wailer.rb b/sonos_wailer.rb
index abc1234..def5678 100644
--- a/sonos_wailer.rb
+++ b/sonos_wailer.rb
@@ -18,4 +18,7 @@ upstairs_speaker.play
end
+# Set reasonable volume
+upstairs_speaker.volume = 50
+
|
Set fixed volume for Sonos wailer
|
diff --git a/ellen-syoboi_calendar.gemspec b/ellen-syoboi_calendar.gemspec
index abc1234..def5678 100644
--- a/ellen-syoboi_calendar.gemspec
+++ b/ellen-syoboi_calendar.gemspec
@@ -16,6 +16,8 @@ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]
+ spec.add_dependency "ellen", ">= 0.2.0"
+ spec.add_dependency "syoboi_calendar", ">= 0.2.1"
spec.add_development_dependency "bundler", "~> 1.6"
spec.add_development_dependency "rake"
end
|
Add gem dependencies, we will use them later
|
diff --git a/spec/classes/consul_exporter_spec.rb b/spec/classes/consul_exporter_spec.rb
index abc1234..def5678 100644
--- a/spec/classes/consul_exporter_spec.rb
+++ b/spec/classes/consul_exporter_spec.rb
@@ -0,0 +1,30 @@+require 'spec_helper'
+
+describe 'prometheus::consul_exporter' do
+ on_supported_os.each do |os, facts|
+ context "on #{os}" do
+ let(:facts) do
+ facts
+ end
+
+ context 'with version specified' do
+ let(:params) do
+ {
+ version: '0.3.0',
+ arch: 'amd64',
+ os: 'linux',
+ }
+ end
+
+ describe 'with all defaults' do
+ it { is_expected.to compile.with_all_deps }
+ it { is_expected.to contain_file('/usr/local/bin/consul_exporter').with('target' => '/opt/consul_exporter-0.3.0.linux-amd64/consul_exporter') }
+ it { is_expected.to contain_prometheus__daemon('consul_exporter') }
+ it { is_expected.to contain_user('consul-exporter') }
+ it { is_expected.to contain_group('consul-exporter') }
+ it { is_expected.to contain_service('consul_exporter') }
+ end
+ end
+ end
+ end
+end
|
Add unit test for consul_exporter
|
diff --git a/db/migrate/20171017190006_create_user_emails.rb b/db/migrate/20171017190006_create_user_emails.rb
index abc1234..def5678 100644
--- a/db/migrate/20171017190006_create_user_emails.rb
+++ b/db/migrate/20171017190006_create_user_emails.rb
@@ -8,7 +8,13 @@ end
User.find_each(batch_size: 100) do |user|
- user.user_emails.create! user: user, email: user.email
+ duplicates = User.where(fax_number: user.fax_number).where.not(id: user.id)
+ parent = duplicates.find { |duplicate| duplicate.user_emails.any? }
+ if parent
+ parent.user_emails.create! user: parent, email: user.email
+ else
+ user.user_emails.create! user: user, email: user.email
+ end
end
remove_column :users, :email
@@ -16,5 +22,6 @@
def down
drop_table :user_emails
+ add_column :users, :email, :string
end
end
|
Fix migration in case of duplicate preexisting users
|
diff --git a/spec/controllers/categories_controller_spec.rb b/spec/controllers/categories_controller_spec.rb
index abc1234..def5678 100644
--- a/spec/controllers/categories_controller_spec.rb
+++ b/spec/controllers/categories_controller_spec.rb
@@ -1,19 +1,36 @@ require 'spec_helper'
describe CategoriesController do
- let(:category) { FactoryGirl.create(:category) }
- context 'GET #index' do
+ before do
+ category = FactoryGirl.create(:category)
+ FactoryGirl.create_list(:node_type, 4, category: category)
+ end
+
+ describe 'GET #index' do
+ before do
+ get :index, format: 'json'
+ end
it 'returns HTTP 200 status code' do
get :index, format: 'json'
expect(response).to have_http_status(:success)
+ end
+
+ describe 'the response' do
+ it 'has categories' do
+ expect(json_response['categories'].length).to eq 1
+ end
end
end
context 'GET #show' do
it 'returns HTTP 200 status code' do
- get :show, id: category.id, format: 'json'
+ get :show, id: Category.first.id, format: 'json'
expect(response).to have_http_status(:success)
end
end
+
+ def json_response
+ JSON.parse(response.body)
+ end
end
|
Update specs to test if controllers return json
|
diff --git a/app/models/event_instance.rb b/app/models/event_instance.rb
index abc1234..def5678 100644
--- a/app/models/event_instance.rb
+++ b/app/models/event_instance.rb
@@ -22,10 +22,11 @@ class EventInstance < ApplicationRecord
belongs_to :address
belongs_to :event
- has_many :attendees
+ belongs_to :questionnaire, optional: true
+
+ has_many :leaders, dependent: :destroy
+ has_many :attendees, dependent: :destroy
has_many :members, through: :attendees
- belongs_to :questionnaire, optional: true
- has_many :leaders
scope :upcoming, -> { includes(:event).where('start_time >= ?', DateTime.now) }
scope :by_event, ->(event_id) { includes(:event).where(event_id: event_id) }
|
Allow to delete event instance
|
diff --git a/spec/dummy/config/environments/development.rb b/spec/dummy/config/environments/development.rb
index abc1234..def5678 100644
--- a/spec/dummy/config/environments/development.rb
+++ b/spec/dummy/config/environments/development.rb
@@ -24,4 +24,7 @@
# Do not compress assets
config.assets.compress = false
+
+ # Email configuration
+ config.action_mailer.default_url_options = { :host => 'localhost:3000' }
end
|
Add default host in spec/dummy
|
diff --git a/app/services/level_access.rb b/app/services/level_access.rb
index abc1234..def5678 100644
--- a/app/services/level_access.rb
+++ b/app/services/level_access.rb
@@ -2,6 +2,7 @@
def can_access?(level)
return true if level == 1
+ return true if level == 2
score = get_score_for(level-1)
required = get_required_for(level-1)
score >= required
|
Enable level 2 for everyone
|
diff --git a/spec/requests/expanded_links_endpoint_spec.rb b/spec/requests/expanded_links_endpoint_spec.rb
index abc1234..def5678 100644
--- a/spec/requests/expanded_links_endpoint_spec.rb
+++ b/spec/requests/expanded_links_endpoint_spec.rb
@@ -0,0 +1,58 @@+require "rails_helper"
+
+RSpec.describe "GET /v2/expanded-links/:id", type: :request do
+ it "returns expanded links" do
+ organisation = create(:content_item,
+ state: "published",
+ format: "organisation",
+ base_path: "/my-super-org",
+ content_id: "9b5ae6f5-f127-4843-9333-c157a404dd2d",
+ )
+
+ content_item = create(:content_item,
+ state: "published",
+ format: "placeholder",
+ title: "Some title",
+ )
+
+ link_set = create(:link_set,
+ content_id: content_item.content_id,
+ )
+
+ create(:link, link_set: link_set, target_content_id: organisation.content_id, link_type: 'organisations')
+
+ get "/v2/expanded-links/#{content_item.content_id}"
+
+ expect(parsed_response).to eql({
+ "organisations" => [
+ {
+ "analytics_identifier" => "GDS01",
+ "api_url" => "http://www.dev.gov.uk/api/content/my-super-org",
+ "base_path" => "/my-super-org",
+ "content_id" => "9b5ae6f5-f127-4843-9333-c157a404dd2d",
+ "description" => "VAT rates for goods and services",
+ "locale" => "en",
+ "title" => "VAT rates",
+ "web_url" => "http://www.dev.gov.uk/my-super-org",
+ "expanded_links" => {}
+ }
+ ]
+ })
+ end
+
+ it "returns empty expanded links if there are no links" do
+ content_item = create(:content_item,
+ state: "published",
+ format: "placeholder",
+ title: "Some title",
+ )
+
+ content_item = create(:link_set,
+ content_id: content_item.content_id,
+ )
+
+ get "/v2/expanded-links/#{content_item.content_id}"
+
+ expect(parsed_response).to eql({})
+ end
+end
|
Add test for expanded links endpoint
This endpoint used to be internal for testing, but we will now use it
from other apps. It needs some tests.
|
diff --git a/spec/unit/virtus/attribute/comparison_spec.rb b/spec/unit/virtus/attribute/comparison_spec.rb
index abc1234..def5678 100644
--- a/spec/unit/virtus/attribute/comparison_spec.rb
+++ b/spec/unit/virtus/attribute/comparison_spec.rb
@@ -0,0 +1,23 @@+require 'spec_helper'
+
+describe Virtus::Attribute, '#== (defined by including Virtus::Equalizer)' do
+ let(:attribute) { described_class.build(String, :name => :name) }
+
+ # Currently that's the way it works and it happens because default_value objects
+ # don't have equalizer, resulting in attributes object mismatch.
+ # This behavior (and a spec) will need a change in future.
+ it 'returns false when attributes have same type and options' do
+ equal_attribute = described_class.build(String, :name => :name)
+ expect(attribute == equal_attribute).to be_falsey
+ end
+
+ it 'returns false when attributes have different type' do
+ different_attribute = described_class.build(Integer, :name => :name)
+ expect(attribute == different_attribute).to be_falsey
+ end
+
+ it 'returns false when attributes have different options' do
+ different_attribute = described_class.build(Integer, :name => :name_two)
+ expect(attribute == different_attribute).to be_falsey
+ end
+end
|
Add specs for attributes comparison (based on latest Equalizer gem working version)
|
diff --git a/lib/subscriptions/concerns/models/subscription_template_group.rb b/lib/subscriptions/concerns/models/subscription_template_group.rb
index abc1234..def5678 100644
--- a/lib/subscriptions/concerns/models/subscription_template_group.rb
+++ b/lib/subscriptions/concerns/models/subscription_template_group.rb
@@ -7,6 +7,8 @@ included do
has_many :subscription_templates, class_name: "Subscriptions::SubscriptionTemplate", dependent: :destroy
+ acts_as_list
+
scope :visible, -> { where( visible: true ) }
end
end
|
Add acts_as_list to subscription template groups
|
diff --git a/annotate_models.gemspec b/annotate_models.gemspec
index abc1234..def5678 100644
--- a/annotate_models.gemspec
+++ b/annotate_models.gemspec
@@ -6,7 +6,7 @@
spec.name = "annotate_models"
spec.version = AnnotateModels::VERSION
- spec.date = "2015-02-08"
+ spec.date = "2018-07-27"
spec.summary = "Simple gem that adds several rake tasks to annotate Rails source files with model schema."
spec.description = "This is my own re-write of an earlier version https://github.com/ctran/annotate_models when work on it waned.
This work started out as an old-style Rails plugin; I am now re-bundling it as a gem-ified plugin."
|
Update release date of gem.
|
diff --git a/app/models/recipe.rb b/app/models/recipe.rb
index abc1234..def5678 100644
--- a/app/models/recipe.rb
+++ b/app/models/recipe.rb
@@ -1,9 +1,9 @@ class Recipe < ActiveRecord::Base
has_many :comments
validates_presence_of :api_id
- def self.get_recipes_by_ingredient(ingredient, limit)
-
- response = HTTParty.get "https://spoonacular-recipe-food-nutrition-v1.p.mashape.com/recipes/findByIngredients?ingredients=#{ingredient}&number=#{limit}",
+ def self.get_recipes_by_ingredient(ingredients, limit)
+ search_params = ingredients.gsub(/,\s?/, "%2C").gsub(" ", "+")
+ response = HTTParty.get "https://spoonacular-recipe-food-nutrition-v1.p.mashape.com/recipes/findByIngredients?ingredients=#{search_params}&number=#{limit}",
headers:{
"X-Mashape-Key" => ENV['SPOONACULAR_API'],
"Accept" => "application/json"
|
Add handling for multi-word and multi-ingredient searching
|
diff --git a/app/lib/audit_logger.rb b/app/lib/audit_logger.rb
index abc1234..def5678 100644
--- a/app/lib/audit_logger.rb
+++ b/app/lib/audit_logger.rb
@@ -12,13 +12,11 @@ end
def error(msg, exception = nil)
- airbrake_params = {
- :error_message => msg.dup,
- :environment_name => Rails.env
- }
- airbrake_params[:error_class] = exception.nil? ? @error_class : exception.class.name
- airbrake_params[:backtrace] = exception.backtrace if ! exception.nil?
- Airbrake.notify(airbrake_params)
+ if exception.nil?
+ exception = RuntimeError.new("#{@error_class}: #{msg}")
+ exception.set_backtrace msg
+ end
+ NewRelic::Agent.notice_error(exception)
add(ERROR, nil, msg)
end
|
Make AuditLogger talk to NewRelic, not Airbrake
We removed Airbrake in 480b55289725eebd3cd15977f229f298c1cbdf7d but didn't stop the logger from talking to it. We can achieve the same thing with the ``NewRelic::Agent.notice_error`` api (although we can't provide quite as much information).
|
diff --git a/app/models/alumni.rb b/app/models/alumni.rb
index abc1234..def5678 100644
--- a/app/models/alumni.rb
+++ b/app/models/alumni.rb
@@ -2,6 +2,9 @@ has_one :AlumniStatus
has_one :AlumniData
after_create :build_other_records
+ before_destroy { |record| AlumniStatus.destroy_all "Alumni_id = #{record.id}" }
+ before_destroy { |record| AlumniData.destroy_all "Alumni_id = #{record.id}" }
+ before_destroy { |record| TieAlumniWithStudentMember.destroy_all "Alumni_id = #{record.id}" }
private
def build_other_records
|
Add the before_destroy callback in Alumni model
- Before destroying an Alumni, always destroy the associated
AlumniStatus, AlumniData and the TieAlumni records too.
Signed-off-by: Siddharth Kannan <805f056820c7a1cecc4ab591b8a0a604b501a0b7@gmail.com>
|
diff --git a/app/models/review.rb b/app/models/review.rb
index abc1234..def5678 100644
--- a/app/models/review.rb
+++ b/app/models/review.rb
@@ -3,7 +3,9 @@ belongs_to :restaurant
has_many :review_cuisines
has_many :cuisines, through: :review_cuisines
-
+
+ before_save { self.restaurant_name = restaurant_name.upcase_first }
+
validates_presence_of :restaurant_name, :date_visited, :rating
validates :content, presence: true, length: { minimum: 10 }
|
Add before_save { self.restaurant_name to capitalize first letter
|
diff --git a/test/dummy/config/boot.rb b/test/dummy/config/boot.rb
index abc1234..def5678 100644
--- a/test/dummy/config/boot.rb
+++ b/test/dummy/config/boot.rb
@@ -6,5 +6,3 @@ require 'bundler'
Bundler.setup
end
-
-$:.unshift File.expand_path('../../../../lib', __FILE__)
|
Remove glow lib from dummy load path
|
diff --git a/spec/configuration_spec.rb b/spec/configuration_spec.rb
index abc1234..def5678 100644
--- a/spec/configuration_spec.rb
+++ b/spec/configuration_spec.rb
@@ -0,0 +1,14 @@+require 'spec_helper'
+
+describe MetaTags::Configuration do
+ it 'should be returned by MetaTags.config' do
+ expect(MetaTags.config).to be_instance_of(MetaTags::Configuration)
+ end
+
+ it 'should be yielded by MetaTags.configure' do
+ MetaTags.configure do |c|
+ expect(c).to be_instance_of(MetaTags::Configuration)
+ expect(c).to be(MetaTags.config)
+ end
+ end
+end
|
Make sure MetaTags.config/configuration work as expected
|
diff --git a/spec/isolation/rom_spec.rb b/spec/isolation/rom_spec.rb
index abc1234..def5678 100644
--- a/spec/isolation/rom_spec.rb
+++ b/spec/isolation/rom_spec.rb
@@ -3,14 +3,14 @@ describe ROM, '.finalize' do
subject(:env) { ROM.finalize.env }
- before { ROM.setup(:sql, 'sqlite::memory') }
+ before { ROM.setup(:memory) }
it 'sets up lazy-env first' do
expect(env).to be_instance_of(ROM::LazyEnv)
end
it 'triggers finalization on relation access' do
- relation = Class.new(ROM::Relation[:sql]) do
+ relation = Class.new(ROM::Relation[:memory]) do
dataset :users
register_as :users
end
@@ -19,12 +19,12 @@ end
it 'triggers finalization on command access' do
- Class.new(ROM::Relation[:sql]) do
+ Class.new(ROM::Relation[:memory]) do
dataset :users
register_as :users
end
- command = Class.new(ROM::Commands::Create[:sql]) do
+ command = Class.new(ROM::Commands::Create[:memory]) do
relation :users
register_as :create
end
@@ -42,6 +42,6 @@ end
it 'triggers finalization on gateways access' do
- expect(env.gateways[:default]).to be_instance_of(ROM::SQL::Gateway)
+ expect(env.gateways[:default]).to be_instance_of(ROM::Memory::Gateway)
end
end
|
Use memory adapter for rom isolation specs
|
diff --git a/features/support/env.rb b/features/support/env.rb
index abc1234..def5678 100644
--- a/features/support/env.rb
+++ b/features/support/env.rb
@@ -11,9 +11,10 @@
Before('@events') do
- @app = Flapjack::Executive.run
- @app.process_events
- @redis = Redis.new
+ # Use a separate database whilst testing
+ @app = Flapjack::Executive.new(:redis => { :db => 14 })
+ @app.drain_events
+ @redis = Flapjack.persistence
end
After('@events') do
|
Use a different redis database while testing
|
diff --git a/app/controllers/locations_controller.rb b/app/controllers/locations_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/locations_controller.rb
+++ b/app/controllers/locations_controller.rb
@@ -15,8 +15,8 @@ def nyc_index
@location = Location.find_by(loc_code:"nyc")
@location_name = @location.name
- @total_owed = School.total_owed_sum(@location.schools) / 2
- @total_enrollment = School.total_enrollment_sum(@location.schools) / 2
+ @total_owed = School.total_owed_sum(@location.schools)
+ @total_enrollment = School.total_enrollment_sum(@location.schools)
@amount_per_student = School.amount_per_student(@total_owed, @total_enrollment)
end
end
|
Fix calculation issue with nyc totals
|
diff --git a/app/controllers/positions_controller.rb b/app/controllers/positions_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/positions_controller.rb
+++ b/app/controllers/positions_controller.rb
@@ -1,9 +1,9 @@ class PositionsController < ApplicationController
respond_to :json
+ rescue_from Exception, with: :render_500
rescue_from ActionController::RoutingError, with: :render_404
rescue_from ActiveRecord::RecordNotFound, with: :render_404
- rescue_from Exception, with: :render_500
def show
@article = Article.find(params[:article_id])
|
Fix rescue_from order in PositionsController
|
diff --git a/app/controllers/team_name_controller.rb b/app/controllers/team_name_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/team_name_controller.rb
+++ b/app/controllers/team_name_controller.rb
@@ -2,22 +2,6 @@ skip_before_action :verify_authenticity_token, only: [:create]
def create
- @colour_palette = [
- "purple",
- "mauve",
- "fuschia",
- "pink",
- "baby-pink",
- "red",
- "mellow-red",
- "orange",
- "brown",
- "yellow",
- "grass-green",
- "green",
- "turquoise",
- "light-blue"
- ]
end
def create_sign
@@ -41,4 +25,23 @@ @team_name = params[:team_name].gsub('_', '.').gsub('__', '_')
@page_title = "#{params[:team_name].gsub('_', '.').gsub('__', '_')} – "
end
+ before_action :set_colours
+ def set_colours
+ @colour_palette = [
+ "purple",
+ "mauve",
+ "fuschia",
+ "pink",
+ "baby-pink",
+ "red",
+ "mellow-red",
+ "orange",
+ "brown",
+ "yellow",
+ "grass-green",
+ "green",
+ "turquoise",
+ "light-blue"
+ ]
+ end
end
|
Make @colour_palette accessible to all methods
|
diff --git a/test/substitution_test.rb b/test/substitution_test.rb
index abc1234..def5678 100644
--- a/test/substitution_test.rb
+++ b/test/substitution_test.rb
@@ -0,0 +1,12 @@+require 'test_helper'
+
+context "Substitions" do
+ setup do
+ @rendered = render_string(":frog: Yo, I am a frog.\n\nA frog says, '{frog}'")
+ end
+
+ test "defines" do
+ result = Nokogiri::HTML(@rendered)
+ assert_equal("A frog says, 'Yo, I am a frog.'", result.css("p").first.content.strip)
+ end
+end
|
Add basic test for substitutions
|
diff --git a/modules/govuk/spec/defines/govuk_app_package_spec.rb b/modules/govuk/spec/defines/govuk_app_package_spec.rb
index abc1234..def5678 100644
--- a/modules/govuk/spec/defines/govuk_app_package_spec.rb
+++ b/modules/govuk/spec/defines/govuk_app_package_spec.rb
@@ -19,9 +19,11 @@ }
end
- it { should contain_file('/var/apps/giraffe').with_ensure('link') }
- it { should contain_file('/var/run/giraffe') }
- it { should contain_file('/var/log/giraffe') }
- it { should contain_file('/data/vhost/giraffe.example.com') }
+ it do
+ should contain_file('/var/apps/giraffe').with_ensure('link')
+ should contain_file('/var/run/giraffe')
+ should contain_file('/var/log/giraffe')
+ should contain_file('/data/vhost/giraffe.example.com')
+ end
end
end
|
Refactor test to only do one it
|
diff --git a/config.ru b/config.ru
index abc1234..def5678 100644
--- a/config.ru
+++ b/config.ru
@@ -6,7 +6,7 @@
use Rack::ShowExceptions
-if ENV.has_key 'HTTP_MESSAGE'
+if ENV.has_key? 'HTTP_MESSAGE'
message = ENV['HTTP_MESSAGE']
else
message = "Private Blog"
|
Use a question mark for checkign in hash
|
diff --git a/config.ru b/config.ru
index abc1234..def5678 100644
--- a/config.ru
+++ b/config.ru
@@ -27,5 +27,32 @@ end
end
+class InsertTags < Struct.new(:app)
+ def call(env)
+ status, headers, body = app.call(env)
+
+ Rack::Response.new(body, status, headers) do |response|
+ if media_type(response) == 'text/html'
+ content = add_tags(response.body.join)
+ response.body = [content]
+ response.headers['Content-Length'] = content.length.to_s
+ end
+ end
+ end
+
+ def media_type(response)
+ response.content_type.to_s.split(';').first
+ end
+
+ def add_tags(content)
+ content.sub(%r{(?=</head>)}, script_tags)
+ end
+
+ def script_tags
+ %Q{<script src="#{MIRROR_JAVASCRIPT_PATH}"></script>}
+ end
+end
+
use Rack::Static, urls: [MIRROR_JAVASCRIPT_PATH]
+use InsertTags
run Proxy.new
|
Add middleware to insert <script> tag
|
diff --git a/app/controllers/bunny_sessions_controller.rb b/app/controllers/bunny_sessions_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/bunny_sessions_controller.rb
+++ b/app/controllers/bunny_sessions_controller.rb
@@ -5,10 +5,6 @@ def create
self.current_bunny = Bunny.authenticate(params[:username], params[:password])
if current_bunny
- if params[:remember_me] == "1"
- self.current_bunny.remember_me
- cookies[:bunny_auth_token] = { :value => self.current_bunny.remember_token , :expires => self.current_bunny.remember_token_expires_at }
- end
redirect_back_or_default(valentines_path)
else
flash[:error] = "We couldn't find those details. Please try again."
|
Remove unused 'remember me' code
git-svn-id: 801577a2cbccabf54a3a609152c727abd26e524a@1250 a18515e9-6cfd-0310-9624-afb4ebaee84e
|
diff --git a/Specta.podspec b/Specta.podspec
index abc1234..def5678 100644
--- a/Specta.podspec
+++ b/Specta.podspec
@@ -17,4 +17,5 @@ s.tvos.deployment_target = '9.0'
s.pod_target_xcconfig = { 'ENABLE_BITCODE' => 'NO' }
+ s.user_target_xcconfig = { 'FRAMEWORK_SEARCH_PATHS' => '$(PLATFORM_DIR)/Developer/Library/Frameworks' }
end
|
Handle the custom search path for XCTest
|
diff --git a/test/controllers/labelings_controller_test.rb b/test/controllers/labelings_controller_test.rb
index abc1234..def5678 100644
--- a/test/controllers/labelings_controller_test.rb
+++ b/test/controllers/labelings_controller_test.rb
@@ -24,6 +24,22 @@ sign_in users(:alice)
end
+ test 'should create labeling' do
+
+ assert_difference 'Labeling.count' do
+
+ post :create, format: :js, labeling: {
+ labelable_id: tickets(:problem).id,
+ labelable_type: 'Ticket',
+ label: {
+ name: 'Hello'
+ }
+ }
+
+ assert_response :success
+ end
+ end
+
test 'should remove labeling' do
assert_difference 'Labeling.count', -1 do
delete :destroy, id: @labeling, format: :js
|
Add tests for creating labelings
|
diff --git a/app/mailers/course_invitation_mailer.rb b/app/mailers/course_invitation_mailer.rb
index abc1234..def5678 100644
--- a/app/mailers/course_invitation_mailer.rb
+++ b/app/mailers/course_invitation_mailer.rb
@@ -8,8 +8,6 @@ @member = member
@invitation = invitation
- load_attachments
-
subject = "Course :: #{@course.title} by codebar - #{l(@course.date_and_time, format: :email_title)}"
mail(mail_args(member, subject)) do |format|
@@ -19,12 +17,6 @@
private
- def load_attachments
- %w{logo.png}.each do |image|
- attachments.inline[image] = File.read("#{Rails.root.to_s}/app/assets/images/#{image}")
- end
- end
-
helper do
def full_url_for path
"#{@host}#{path}"
|
Remove codebar logo from course invitation attachments
|
diff --git a/NSData+TDTImageMIMEDetection.podspec b/NSData+TDTImageMIMEDetection.podspec
index abc1234..def5678 100644
--- a/NSData+TDTImageMIMEDetection.podspec
+++ b/NSData+TDTImageMIMEDetection.podspec
@@ -4,7 +4,7 @@ s.summary = "Category on NSData to check if it represents PNG or JPEG."
s.homepage = "https://github.com/talk-to/NSData-ImageMIMEDetection"
s.license = { :type => 'BSD', :text => 'Property of Talk.to FZC' }
- s.author = 'Talk.to'
+ s.author = { 'Ayush Goel' => 'ayush.g@directi.com' }
s.source = { :git => "git@github.com:talk-to/NSData-ImageMIMEDetection.git", :tag => '#{s.version}' }
s.ios.deployment_target = '7.0'
|
Update author name and email
|
diff --git a/spec/cli_spec.rb b/spec/cli_spec.rb
index abc1234..def5678 100644
--- a/spec/cli_spec.rb
+++ b/spec/cli_spec.rb
@@ -2,8 +2,8 @@
describe Tracking::CLI do
- before :each { backup_data }
- after :each { restore_data }
+ before(:all) { backup_data }
+ after(:all) { restore_data }
it 'performs a few operations on a new list and then clears it' do
capture_output do
|
Tests: Use before/after :all, not before/after :each
|
diff --git a/spec/ghe_spec.rb b/spec/ghe_spec.rb
index abc1234..def5678 100644
--- a/spec/ghe_spec.rb
+++ b/spec/ghe_spec.rb
@@ -0,0 +1,68 @@+describe '...' do
+
+ MOCK_GHE_HOST = 'ghe.example.com'
+ MOCK_USER = 'foo'
+ MOCK_PASSWORD = 'bar'
+ MOCK_AUTHZ_GHE_URL = "http://#{MOCK_USER}:#{MOCK_PASSWORD}@#{MOCK_GHE_HOST}/"
+ MOCK_GHE_URL = "http://#{MOCK_GHE_HOST}/"
+
+ before do
+ @saved_env = ENV['GHE_URL']
+
+ # stub requests for /gists
+ stub_request(:post, /^#{MOCK_GHE_URL}api\/v3\/gists/).to_return(:body => %[{"html_url": "#{MOCK_GHE_URL}"}])
+ stub_request(:post, /^https:\/\/api.github.com\/gists/).to_return(:body => '{"html_url": "http://github.com/"}')
+
+ # stub requests for /authorizations
+ stub_request(:post, /^#{MOCK_AUTHZ_GHE_URL}api\/v3\/authorizations/).
+ to_return(:status => 201, :body => '{"token": "asdf"}')
+ stub_request(:post, /^https:\/\/#{MOCK_USER}:#{MOCK_PASSWORD}@api.github.com\/authorizations/).
+ to_return(:status => 201, :body => '{"token": "asdf"}')
+ end
+
+ after do
+ ENV['GHE_URL'] = @saved_env
+ end
+
+ describe :login! do
+ before do
+ @saved_stdin = $stdin
+
+ # stdin emulation
+ $stdin = StringIO.new "#{MOCK_USER}\n#{MOCK_PASSWORD}\n"
+
+ # intercept for updating ~/.jist
+ File.stub(:open)
+ end
+
+ after do
+ $stdin = @saved_stdin
+ end
+
+ it "should access to api.github.com when $GHE_URL wasn't set" do
+ ENV.delete 'GHE_URL'
+ Jist.login!
+ assert_requested(:post, /api.github.com/)
+ end
+
+ it "should access to #{MOCK_GHE_HOST} when $GHE_URL was set" do
+ ENV['GHE_URL'] = MOCK_GHE_URL
+ Jist.login!
+ assert_requested(:post, /#{MOCK_GHE_HOST}/)
+ end
+ end
+
+ describe :gist do
+ it "should access to api.github.com when $GHE_URL wasn't set" do
+ ENV.delete 'GHE_URL'
+ Jist.gist "test gist"
+ assert_requested(:post, /api.github.com/)
+ end
+
+ it "should access to #{MOCK_GHE_HOST} when $GHE_URL was set" do
+ ENV['GHE_URL'] = MOCK_GHE_URL
+ Jist.gist "test gist"
+ assert_requested(:post, /#{MOCK_GHE_HOST}/)
+ end
+ end
+end
|
Add a spec for GitHub Enterprise support
|
diff --git a/app/services/ci/update_build_queue_service.rb b/app/services/ci/update_build_queue_service.rb
index abc1234..def5678 100644
--- a/app/services/ci/update_build_queue_service.rb
+++ b/app/services/ci/update_build_queue_service.rb
@@ -6,6 +6,12 @@ runner.tick_runner_queue
end
end
+
+ Ci::Runner.shared.each do |runner|
+ if runner.can_pick?(build)
+ runner.tick_runner_queue
+ end
+ end if build.project.shared_runners_enabled?
end
end
end
|
Fix shared runners queue update
|
diff --git a/rack-reverse-proxy.gemspec b/rack-reverse-proxy.gemspec
index abc1234..def5678 100644
--- a/rack-reverse-proxy.gemspec
+++ b/rack-reverse-proxy.gemspec
@@ -1,11 +1,11 @@ Gem::Specification.new do |s|
s.name = 'rack-reverse-proxy'
s.version = "0.8.1"
- s.authors = ["Jon Swope", "Ian Ehlert", "Roman Ernst"]
+ s.authors = ["Jon Swope", "Ian Ehlert", "Roman Ernst", "Oleksii Fedorov"]
s.description = 'A Rack based reverse proxy for basic needs. Useful for testing or in cases where webserver configuration is unavailable.'
- s.email = ["jaswope@gmail.com", "ehlertij@gmail.com", "rernst@farbenmeer.net"]
+ s.email = ["jaswope@gmail.com", "ehlertij@gmail.com", "rernst@farbenmeer.net", "waterlink000@gmail.com"]
s.files = Dir['README.md', 'LICENSE', 'lib/**/*']
- s.homepage = 'http://github.com/pex/rack-reverse-proxy'
+ s.homepage = 'http://github.com/waterlink/rack-reverse-proxy'
s.require_paths = ["lib"]
s.summary = 'A Simple Reverse Proxy for Rack'
|
Add author and change homepage to reflect maintainer change
|
diff --git a/app/views/api/visits/show.json.jbuilder b/app/views/api/visits/show.json.jbuilder
index abc1234..def5678 100644
--- a/app/views/api/visits/show.json.jbuilder
+++ b/app/views/api/visits/show.json.jbuilder
@@ -6,6 +6,8 @@ json.contact_email_address @visit.contact_email_address
json.slots @visit.slots.map(&:iso8601)
json.slot_granted @visit.slot_granted&.iso8601
+ json.cancellation_reason @visit.cancellation&.reason
+ json.cancelled_at @visit.cancellation&.created_at&.iso8601
json.visitors @visit.visitors do |visitor|
json.anonymized_name visitor.anonymized_name
|
Add cancellation reason, timestamps to visit API
So that PVB Public can build a visit show page with the reason.
|
diff --git a/lib/terraforming/resource/db_parameter_group.rb b/lib/terraforming/resource/db_parameter_group.rb
index abc1234..def5678 100644
--- a/lib/terraforming/resource/db_parameter_group.rb
+++ b/lib/terraforming/resource/db_parameter_group.rb
@@ -1,12 +1,10 @@ module Terraforming::Resource
class DBParameterGroup
def self.tf(client = Aws::RDS::Client.new)
- # TODO: fetch parameter (describe-db-parameters)
Terraforming::Resource.apply_template(client, "tf/db_parameter_group")
end
def self.tfstate(client = Aws::RDS::Client.new)
- # TODO: implement DBParameterGroup.tfstate
tfstate_db_parameter_groups =
client.describe_db_parameter_groups.db_parameter_groups.inject({}) do |result, parameter_group|
attributes = {
|
Remove TODO comments from DBParameterGroup
|
diff --git a/db/seeds.rb b/db/seeds.rb
index abc1234..def5678 100644
--- a/db/seeds.rb
+++ b/db/seeds.rb
@@ -5,12 +5,19 @@ # name = shell.ask("What's your name?")
# shell.say name
#
-email = shell.ask "Which email do you want use for logging into admin?"
-password = shell.ask "Tell me the password to use:", :echo => false
+
+email = ENV['ADMIN_EMAIL'] || shell.ask('Which email do you want use for logging into admin?')
+password = ENV['ADMIN_PASSWORD'] || shell.ask('Tell me the password to use:', :echo => false)
shell.say ""
-account = Account.new(:email => email, :name => "Foo", :surname => "Bar", :password => password, :password_confirmation => password, :role => "admin")
+account = Account.new(
+ :email => email,
+ :name => "Foo",
+ :surname => "Bar",
+ :password => password,
+ :password_confirmation => password,
+ :role => "admin")
if account.valid?
account.save
|
Allow seed to take admin credentials from env
|
diff --git a/db/seeds.rb b/db/seeds.rb
index abc1234..def5678 100644
--- a/db/seeds.rb
+++ b/db/seeds.rb
@@ -0,0 +1,56 @@+# Users
+
+User.create(
+ username: "evan",
+ email: "evan@email.com",
+ password: "000000",
+ password_confirmation: "000000"
+)
+
+User.create(
+ username: "mphelps",
+ email: "mphelps@email.com",
+ password: "qqqqqq",
+ password_confirmation: "qqqqqq"
+)
+
+User.create(
+ username: "ubolt",
+ email: "ubolt@email.com",
+ password: "qqqqqq",
+ password_confirmation: "qqqqqq"
+)
+
+User.create(
+ username: "sbiles",
+ email: "sbiles@email.com",
+ password: "qqqqqq",
+ password_confirmation: "qqqqqq"
+)
+
+User.create(
+ username: "ndjoker",
+ email: "ndjoker@email.com",
+ password: "qqqqqq",
+ password_confirmation: "qqqqqq"
+)
+
+# Genres
+
+Genre.create(name: "comedy")
+Genre.create(name: "drama")
+Genre.create(name: "horror")
+Genre.create(name: "non-fiction")
+Genre.create(name: "realistic fiction")
+Genre.create(name: "romance")
+Genre.create(name: "satire")
+Genre.create(name: "tragedy")
+Genre.create(name: "tragicomedy")
+Genre.create(name: "classic")
+Genre.create(name: "fairytale")
+Genre.create(name: "mystery")
+Genre.create(name: "science fiction")
+Genre.create(name: "memoir")
+Genre.create(name: "biography/autobiography")
+Genre.create(name: "self-help")
+Genre.create(name: "reference")
|
Add seed data from users and list of genres
|
diff --git a/spec/controllers/api/v1/invoices_controller_spec.rb b/spec/controllers/api/v1/invoices_controller_spec.rb
index abc1234..def5678 100644
--- a/spec/controllers/api/v1/invoices_controller_spec.rb
+++ b/spec/controllers/api/v1/invoices_controller_spec.rb
@@ -4,6 +4,11 @@ include Randomness
include ResponseJson
+ before(:all) do
+ Invoice.destroy_all
+ Transaction.destroy_all
+ end
+
it 'should list all Invoices for a Transaction' do
rand_array_of_models(:transaction).each do |tm|
invoices = rand_array_of_models(:invoice, transact_id: tm.id)
|
Clean up before starting the spec
|
diff --git a/spec/organic_sitemap/middleware/url_capture_spec.rb b/spec/organic_sitemap/middleware/url_capture_spec.rb
index abc1234..def5678 100644
--- a/spec/organic_sitemap/middleware/url_capture_spec.rb
+++ b/spec/organic_sitemap/middleware/url_capture_spec.rb
@@ -0,0 +1,52 @@+require 'spec_helper'
+require 'rack'
+require './lib/organic-sitemap/middleware/url_capture'
+require 'pry'
+
+describe OrganicSitemap::Middleware::UrlCapture do
+ let(:app) { proc{[status, headers, body]} }
+ let(:stack) { OrganicSitemap::Middleware::UrlCapture.new(app) }
+ let(:request) { Rack::MockRequest.new(stack) }
+
+ ['post', 'put', 'delete'].each do |method|
+ context "when called with a #{method.upcase} request" do
+ before do
+ request.send(method, '/')
+ end
+ ALL_STATUS.each do |status|
+ context "with response #{status}" do
+ let(:status) { status }
+ let(:headers) { {'Content-Type' => '_'} }
+ let(:body) { ['_'] }
+ it "don't add anything to url redis" do
+ expect(OrganicSitemap::RedisManager.sitemap_urls).to be_empty
+ end
+ end
+ end
+ end
+ end
+
+ context "when called with a GET request" do
+ before do
+ request.get('/')
+ end
+ (ALL_STATUS - [200]).each do |status|
+ context "with response #{status}" do
+ let(:status) { status }
+ let(:headers) { {'Content-Type' => 'text/html'} }
+ let(:body) { ['_'] }
+ it "don't add anything to url redis" do
+ expect(OrganicSitemap::RedisManager.sitemap_urls).to be_empty
+ end
+ end
+ end
+ context "with response 200" do
+ let(:status) { 200 }
+ let(:headers) { {'Content-Type' => 'text/html'} }
+ let(:body) { ['_'] }
+ it "don't add anything to url redis" do
+ expect(OrganicSitemap::RedisManager.sitemap_urls).not_to be_empty
+ end
+ end
+ end
+end
|
Add first Middleware tests :D
|
diff --git a/sample/spec/spec_helper.rb b/sample/spec/spec_helper.rb
index abc1234..def5678 100644
--- a/sample/spec/spec_helper.rb
+++ b/sample/spec/spec_helper.rb
@@ -23,14 +23,14 @@ c.syntax = :expect
end
- config.before(:suite) do
+ config.before(:each) do
DatabaseCleaner.clean_with(:truncation)
end
# If you're not using ActiveRecord, or you'd prefer not to run each of your
# examples within a transaction, comment the following line or assign false
# instead of true.
- config.use_transactional_fixtures = true
+ config.use_transactional_fixtures = false
config.include FactoryGirl::Syntax::Methods
config.fail_fast = ENV['FAIL_FAST'] || false
|
Switch sample spec to truncation
Postgresql was experiencing "No live threads left. Deadlock?" under
Rails 5.1.
|
diff --git a/core/lib/spree/money.rb b/core/lib/spree/money.rb
index abc1234..def5678 100644
--- a/core/lib/spree/money.rb
+++ b/core/lib/spree/money.rb
@@ -7,9 +7,9 @@ def initialize(amount, options={})
@money = ::Money.parse([amount, (options[:currency] || Spree::Config[:currency])].join)
@options = {}
- @options[:with_currency] = true if Spree::Config[:display_currency]
+ @options[:with_currency] = Spree::Config[:display_currency]
@options[:symbol_position] = Spree::Config[:currency_symbol_position].to_sym
- @options[:no_cents] = true if Spree::Config[:hide_cents]
+ @options[:no_cents] = Spree::Config[:hide_cents]
@options.merge!(options)
# Must be a symbol because the Money gem doesn't do the conversion
@options[:symbol_position] = @options[:symbol_position].to_sym
|
Refactor Spree::Money's with_currency and no_cents option settings
|
diff --git a/config/schedule.rb b/config/schedule.rb
index abc1234..def5678 100644
--- a/config/schedule.rb
+++ b/config/schedule.rb
@@ -17,7 +17,7 @@
# Learn more: http://github.com/javan/whenever
-job_type :rake, "cd :path && RAILS_ENV=:environment /usr/local/bin/rake :task :output"
+job_type :rake, "cd :path && RAILS_ENV=:environment bundle exec rake :task :output"
every 1.day, :at => '3:00 am' do
rake "starlight"
|
Update our cron job format.
|
diff --git a/BVLinearGradient.podspec b/BVLinearGradient.podspec
index abc1234..def5678 100644
--- a/BVLinearGradient.podspec
+++ b/BVLinearGradient.podspec
@@ -16,6 +16,6 @@ s.preserve_paths = "**/*.js"
s.frameworks = 'UIKit', 'QuartzCore', 'Foundation'
- s.dependency 'React'
+ s.dependency 'React-Core'
end
|
Update React dependency in podspec
|
diff --git a/lib/generators/templates/component/model/spec/models/%file_name%_spec.rb b/lib/generators/templates/component/model/spec/models/%file_name%_spec.rb
index abc1234..def5678 100644
--- a/lib/generators/templates/component/model/spec/models/%file_name%_spec.rb
+++ b/lib/generators/templates/component/model/spec/models/%file_name%_spec.rb
@@ -1,6 +1,6 @@ require File.join( File.dirname(__FILE__), <%= go_up(modules.size + 1) %>, "spec_helper" )
-describe <%= class_name %> do
+describe <%= full_class_name %> do
it "should have specs"
|
[merb-gen] Fix for generation of namespaced model specs
[#1233 state:resolved]
|
diff --git a/alphagov/vagrant-govuk/load_nodes.rb b/alphagov/vagrant-govuk/load_nodes.rb
index abc1234..def5678 100644
--- a/alphagov/vagrant-govuk/load_nodes.rb
+++ b/alphagov/vagrant-govuk/load_nodes.rb
@@ -1,37 +1,60 @@-require 'json'
+require 'yaml'
-# Load node definitions from the JSON in the vcloud-templates repo parallel
-# to this.
+# Load node definitions from the vcloud-launcher YAML in the
+# govuk-provisioning repo parallel to this.
def load_nodes
- json_dir = File.expand_path("../../vcloud-templates/machines", __FILE__)
+ yaml_dir = File.expand_path(
+ "../../govuk-provisioning/vcloud-launcher/production_skyscape/",
+ __FILE__
+ )
+ yaml_local = File.expand_path("../nodes.local.yaml", __FILE__)
+
+ # DEPRECATED
json_local = File.expand_path("../nodes.local.json", __FILE__)
+ if File.exists?(json_local)
+ $stderr.puts "ERROR: nodes.local.json is deprecated. Please convert it to YAML"
+ exit 1
+ end
- unless File.exists?(json_dir)
- puts "Unable to find nodes in 'vcloud-templates' repo"
+ unless File.exists?(yaml_dir)
+ puts "Unable to find nodes in 'govuk-provisioning' repo"
puts
return {}
end
- json_files = Dir.glob(
- File.join(json_dir, "**", "*.json")
+ yaml_files = Dir.glob(
+ File.join(yaml_dir, "*.yaml")
)
nodes = Hash[
- json_files.map { |json_file|
- node = JSON.parse(File.read(json_file))
- name = node["vm_name"] + "." + node["zone"]
+ yaml_files.flat_map { |yaml_file|
+ YAML::load_file(yaml_file).fetch('vapps').map { |vapp|
+ name = vapp.fetch('name')
+ vm = vapp.fetch('vm')
+ network = vm.fetch('network_connections').first
+ vdc = network.fetch('name').downcase
- # Ignore physical attributes.
- node.delete("memory")
- node.delete("num_cores")
+ name = "#{name}.#{vdc}"
+ config = {
+ :ip => network.fetch('ip_address'),
+ }
- [name, node]
+ [name, config]
+ }
}
]
- # Local JSON file can override node properties like "memory".
- if File.exists?(json_local)
- nodes_local = JSON.parse(File.read(json_local))
+ # Local YAML file can override node properties like "memory". It should
+ # look like:
+ #
+ # ---
+ # machine1.vdc1:
+ # memory: 128
+ # machine2.vdc2:
+ # memory: 4096
+ #
+ if File.exists?(yaml_local)
+ nodes_local = YAML::load_file(yaml_local)
nodes_local.each { |k,v| nodes[k].merge!(v) if nodes.has_key?(k) }
end
|
Use vcloud-launcher configs in govuk-provisioning
vcloud-templates and vcloud-box-spinner are dead. This is a simpler version
of Nicola's yaml_input branch which:
- Uses the updated syntax of vcloud-launcher
- Only takes the required items out of each vApp entry
- Doesn't add disks - I'll create a separate story for that
- Removes support for JSON - we no longer need it
It will raise an error if you have an old `nodes.local.json` file.
|
diff --git a/templates/spec_helper.rb b/templates/spec_helper.rb
index abc1234..def5678 100644
--- a/templates/spec_helper.rb
+++ b/templates/spec_helper.rb
@@ -9,6 +9,8 @@ require 'capybara/poltergeist'
Dir[Rails.root.join('spec/support/**/*.rb')].each { |file| require file }
+
+ActiveRecord::Migration.maintain_test_schema!
RSpec.configure do |config|
config.expect_with :rspec do |c|
|
Maintain db schema from spec helper
|
diff --git a/halide.rb b/halide.rb
index abc1234..def5678 100644
--- a/halide.rb
+++ b/halide.rb
@@ -1,9 +1,9 @@ class Halide < Formula
desc "The Halide image processing language"
homepage "http://halide-lang.org"
- url "https://github.com/halide/Halide/releases/download/release_2016_03_02/halide-mac-64-trunk-65bbac2967ebd59994e613431fd5236baf8a5829.tgz"
- version "2016.03.02"
- sha256 "df1bb22350891ba2d71e21f59863abb622cf437284bd64726bad91cf1d2e83f8"
+ url "https://github.com/halide/Halide/releases/download/release_2016_10_25/release_2016_10_25/halide-mac-64-trunk-aa5d5514f179bf0ffe1a2dead0c0eb7300b4069a.tgz"
+ version "2016.10.25"
+ sha256 "7cc502ebeabd1890f9ab12c186e59745c9f524ce74b325931103ef7a1136ca2a"
def install
lib.install Dir['bin/libHalide*']
|
Update tarball URL and sha256 to 2016.10.25
|
diff --git a/lib/generators/spree_related_products/install/install_generator.rb b/lib/generators/spree_related_products/install/install_generator.rb
index abc1234..def5678 100644
--- a/lib/generators/spree_related_products/install/install_generator.rb
+++ b/lib/generators/spree_related_products/install/install_generator.rb
@@ -1,27 +1,20 @@ module SpreeRelatedProducts
module Generators
class InstallGenerator < Rails::Generators::Base
-
- # def add_javascripts
- # append_file "app/assets/javascripts/store/all.js", "//= require store/spree_wishlist\n"
- # end
-
- # def add_stylesheets
- # inject_into_file "app/assets/stylesheets/store/all.css", " *= require store/spree_wishlist\n", :before => /\*\//, :verbose => true
- # end
def add_migrations
run 'rake railties:install:migrations FROM=spree_related_products'
end
def run_migrations
- res = ask "Would you like to run the migrations now? [Y/n]"
- if res == "" || res.downcase == "y"
- run 'rake db:migrate'
- else
- puts "Skiping rake db:migrate, don't forget to run it!"
- end
+ res = ask "Would you like to run the migrations now? [Y/n]"
+ if res == "" || res.downcase == "y"
+ run 'rake db:migrate'
+ else
+ puts "Skipping rake db:migrate, don't forget to run it!"
+ end
end
+
end
end
end
|
Remove unused & incorrect copy/pasted code.
|
diff --git a/app/controllers/filters_controller.rb b/app/controllers/filters_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/filters_controller.rb
+++ b/app/controllers/filters_controller.rb
@@ -9,7 +9,7 @@ # @sexual_preferences = Filter.where(filterable_type:"SexualPreference")
@sexual_preferences = SexualPreference.pluck("name")
- @user_filters = current_user.user_filters.where(active: true).pluck('id')
+ @user_filters = current_user.user_filters.where(active: true).pluck('filter_id')
end
def update
|
Fix minor bug in filter controller
|
diff --git a/lib/vagrant-multiprovider-snap/providers/virtualbox/driver/base.rb b/lib/vagrant-multiprovider-snap/providers/virtualbox/driver/base.rb
index abc1234..def5678 100644
--- a/lib/vagrant-multiprovider-snap/providers/virtualbox/driver/base.rb
+++ b/lib/vagrant-multiprovider-snap/providers/virtualbox/driver/base.rb
@@ -11,8 +11,11 @@ end
def snapshot_rollback(bootmode)
- halt
- sleep 2 # race condition on locked VMs otherwise?
+ info = execute("showvminfo", @uuid, "--machinereadable")
+ if ! info =~ /^VMState="poweroff"/ # don't try to power off if we're already off
+ halt
+ sleep 2 # race condition on locked VMs otherwise?
+ end
execute("snapshot", @uuid, "restore", snapshot_list.first)
start(bootmode)
end
|
Check if VM is already powered off before halting
Before this commit, rolling back a snapshot from a VM in a poweroff
state results in the below error:
Stderr: VBoxManage: error: Invalid machine state: PoweredOff (must be
Running, Paused or Stuck)
This commit adds a check to skip the halting step if the machine is
already off.
|
diff --git a/test/mathematical/mathjax_test.rb b/test/mathematical/mathjax_test.rb
index abc1234..def5678 100644
--- a/test/mathematical/mathjax_test.rb
+++ b/test/mathematical/mathjax_test.rb
@@ -1,4 +1,5 @@ require 'test_helper'
+require 'nokogiri'
class Mathematical::MathJaxTest < Test::Unit::TestCase
@@ -10,7 +11,10 @@ Dir["#{MATHJAX_TEST_TEX_DIR}/**/*.tex"].each do |tex|
define_method "test_#{tex}" do
tex_contents = File.read(tex)
- assert_nothing_raised { render.render(tex_contents) }
+ data = nil
+ assert_nothing_raised { data = render.render(tex_contents) }
+ doc = Nokogiri::HTML(data['svg'])
+ assert_empty doc.search(%(//svg[@width='0pt']))
end
end
end
|
Check that MathJax SVGs are actually valid
|
diff --git a/app/serializers/chapter_serializer.rb b/app/serializers/chapter_serializer.rb
index abc1234..def5678 100644
--- a/app/serializers/chapter_serializer.rb
+++ b/app/serializers/chapter_serializer.rb
@@ -1,4 +1,4 @@ class ChapterSerializer < ActiveModel::Serializer
- attributes :id, :created_at, :completed_at, :title, :description, :goal
+ attributes :id, :created_at, :completed_at, :title, :description, :goal, :total_calories, :total_carbs, :total_fats, :total_protein
has_many :entries
end
|
Complete reducing page load time by updating JSON serializers
|
diff --git a/app/controllers/topics_controller.rb b/app/controllers/topics_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/topics_controller.rb
+++ b/app/controllers/topics_controller.rb
@@ -38,6 +38,6 @@ private
def instantiate_latest_editions
- @latest_editions = Guide.all.includes(:latest_edition).map(&:latest_edition)
+ @latest_editions = Guide.all.includes(:latest_edition).map(&:latest_edition).sort_by(&:title)
end
end
|
Order editions by title in the topics manager
|
diff --git a/tasks/spec.rake b/tasks/spec.rake
index abc1234..def5678 100644
--- a/tasks/spec.rake
+++ b/tasks/spec.rake
@@ -17,7 +17,7 @@ t.spec_opts = ['--format', 'html:doc/spec/index.html', '--color']
# t.out = 'doc/spec/index.html'
t.rcov = true
- t.rcov_opts = ['--html', '--exclude', "#{ENV['HOME']}/.autotest,spec"]
+ t.rcov_opts = ['--html', '--exclude', "#{ENV['HOME']}/.autotest,spec,/usr/lib/ruby"]
t.rcov_dir = 'doc/rcov'
t.fail_on_error = true
end
|
Exclude /usr/lib/ruby from RCov C0 code coverage report
|
diff --git a/core/app/models/spree/payment_method.rb b/core/app/models/spree/payment_method.rb
index abc1234..def5678 100644
--- a/core/app/models/spree/payment_method.rb
+++ b/core/app/models/spree/payment_method.rb
@@ -1,5 +1,7 @@ module Spree
class PaymentMethod < ActiveRecord::Base
+
+ attr_accessible :name, :active, :environment, :description, :as => :internal
DISPLAY = [:both, :front_end, :back_end]
default_scope where(:deleted_at => nil)
|
Make name, active, environment and description attributes on payment method mass-assignable by internal calls
|
diff --git a/validate_as_email.gemspec b/validate_as_email.gemspec
index abc1234..def5678 100644
--- a/validate_as_email.gemspec
+++ b/validate_as_email.gemspec
@@ -18,6 +18,7 @@ gem.add_dependency 'activemodel', '~> 3'
gem.add_dependency 'mail', '~> 2'
+ gem.add_development_dependency 'rake', '~> 0.9.2'
gem.add_development_dependency 'rspec-rails', '~> 2.11'
gem.add_development_dependency 'cucumber', '~> 1.2'
gem.add_development_dependency 'aruba', '~> 0.4'
|
Add rake to development dependencies
|
diff --git a/lib/mailboxer/engine.rb b/lib/mailboxer/engine.rb
index abc1234..def5678 100644
--- a/lib/mailboxer/engine.rb
+++ b/lib/mailboxer/engine.rb
@@ -3,7 +3,6 @@ require 'carrierwave'
begin
require 'sunspot_rails'
- Logger.new(STDOUT).debug 'The sunspot_rails gem is present. Loading it into mailboxer. You can know use Solr search engine.'
rescue LoadError
end
|
Remove unnecessary trash in stdout.
|
diff --git a/lib/raml_models/body.rb b/lib/raml_models/body.rb
index abc1234..def5678 100644
--- a/lib/raml_models/body.rb
+++ b/lib/raml_models/body.rb
@@ -15,11 +15,11 @@
def example
if body.example
- body.example
+ eval(body.example)
elsif body.schema
- JSON.parse(JsonTestData.generate!(body.schema), symbolize_names: true)
+ JsonTestData.generate!(body.schema, ruby: true)
else
- {}.to_json
+ {}
end
end
end
|
Make sure all output is Ruby (will be converted by generator)
|
diff --git a/lib/urban_dictionary.rb b/lib/urban_dictionary.rb
index abc1234..def5678 100644
--- a/lib/urban_dictionary.rb
+++ b/lib/urban_dictionary.rb
@@ -1,4 +1,25 @@+require 'uri'
+require 'net/http'
+
require 'urban_dictionary/version'
+require 'urban_dictionary/word'
+require 'urban_dictionary/entry'
module UrbanDictionary
+ DEFINE_URL = 'http://www.urbandictionary.com/define.php'
+ RANDOM_URL = 'http://www.urbandictionary.com/random.php'
+
+ def self.define(str)
+ Word.from_url("#{DEFINE_URL}?term=#{URI.encode(str)}")
+ end
+
+ def self.random_word
+ url = URI.parse(RANDOM_URL)
+ req = Net::HTTP::Get.new(url.path)
+ rsp = Net::HTTP.start(url.host, url.port) {|http|
+ http.request(req)
+ }
+
+ Word.from_url(rsp['location'])
+ end
end
|
Add static methods to UrbanDictionary
|
diff --git a/lib/whatsnew/project.rb b/lib/whatsnew/project.rb
index abc1234..def5678 100644
--- a/lib/whatsnew/project.rb
+++ b/lib/whatsnew/project.rb
@@ -28,7 +28,7 @@ def matched_from_git_repository
Dir.chdir(Pathname(@path).to_path) do
`git config --get remote.origin.url`.match(
- %r{git@(?<host>.*):(?<owner>jollygoodcode)/(?<repo>whatsnew).git}
+ %r{git.+(?<host>(github.com|bitbucket.com|bitbucket.org))[:/](?<owner>\S+)/(?<repo>\S+)\.git}
)
end
end
|
Fix hardcoded RegExp when matching git repository
|
diff --git a/app/helpers/noodall/components_helper.rb b/app/helpers/noodall/components_helper.rb
index abc1234..def5678 100644
--- a/app/helpers/noodall/components_helper.rb
+++ b/app/helpers/noodall/components_helper.rb
@@ -9,27 +9,22 @@ # render each slot in the row
args.map do |slot_code|
index = args.index(slot_code)
- component = components[index]
-
+ component = components[index]
+
additional_classes = []
additional_classes << slot_code.split("_").shift unless slot_code.split("_").shift.nil?
additional_classes << 'penultimate' if slot_code == args[args.size - 2]
additional_classes << 'last' if args.last == slot_code
additional_classes << 'first' if args.first == slot_code
-
+
# pass a flag to the view to add an expanded html class
component(node, slot_code, ( components[index + 1].nil? && index < (args.size - 1) ), additional_classes.join(' ')).to_s
- end
+ end.to_s.html_safe
end
-
+
def component(node, slot_code, expand = false, additional_classes = '')
component = node.send(slot_code)
- # Add an empty blank to fill in
- if component.respond_to?(:contents)
- component.contents.reject!{|c| c.asset_id.blank? }
- component.contents << Content.new
- end
-
+
additional_classes = []
additional_classes << slot_code.split("_").shift unless slot_code.split("_").shift.nil?
|
Make component row html safe
|
diff --git a/test/activerecord_test.rb b/test/activerecord_test.rb
index abc1234..def5678 100644
--- a/test/activerecord_test.rb
+++ b/test/activerecord_test.rb
@@ -0,0 +1,17 @@+# coding: utf-8
+require 'test_helper'
+require 'models/utilisateur'
+class ActiverecordTest < Test::Unit::TestCase
+
+ def test_human_attribute_name
+ GettextColumnMapping.locale = 'en'
+ assert_equal 'First name', Utilisateur.human_attribute_name('prenom')
+ assert_equal 'Last name', Utilisateur.human_attribute_name('nom')
+ assert_equal 'Gender', Utilisateur.human_attribute_name('sexe')
+ GettextColumnMapping.locale = 'fr'
+ assert_equal 'Prénom', Utilisateur.human_attribute_name('prenom')
+ assert_equal 'Nom', Utilisateur.human_attribute_name('nom')
+ assert_equal 'Sexe', Utilisateur.human_attribute_name('sexe')
+ end
+
+end
|
Add translation test for activerecord
|
diff --git a/spec/acceptance_helper.rb b/spec/acceptance_helper.rb
index abc1234..def5678 100644
--- a/spec/acceptance_helper.rb
+++ b/spec/acceptance_helper.rb
@@ -1,6 +1,6 @@ # encoding: utf-8
require_relative './spec_helper'
-require "steak"
+#require "steak"
require 'capybara/rails'
require "capybara/dsl"
require "selenium-webdriver"
|
Remove steak from acceptance helper
|
diff --git a/spec/installation_spec.rb b/spec/installation_spec.rb
index abc1234..def5678 100644
--- a/spec/installation_spec.rb
+++ b/spec/installation_spec.rb
@@ -26,11 +26,13 @@ it { should be_mode 755 }
end
- describe command('vagrant plugin list') do
- its(:stdout) {
- should match /.*vagrant-serverspec.*/m
- should match /.*vagrant-triggers.*/m
- }
+ if not ENV['TRAVIS']
+ describe command('vagrant plugin list') do
+ its(:stdout) {
+ should match /.*vagrant-serverspec.*/m
+ should match /.*vagrant-triggers.*/m
+ }
+ end
end
end
|
Disable plugin test for Travis, need investigation
|
diff --git a/spec/models/entry_spec.rb b/spec/models/entry_spec.rb
index abc1234..def5678 100644
--- a/spec/models/entry_spec.rb
+++ b/spec/models/entry_spec.rb
@@ -11,7 +11,7 @@ nickname: "The Science Guy",
provider: "foo",
image: "bar",
- uid: "baz"
+ uid: 12345
)
c = Challenge.new({
:title => :test,
|
Make uid a numeric type to pass validation
|
diff --git a/spec/money_column_spec.rb b/spec/money_column_spec.rb
index abc1234..def5678 100644
--- a/spec/money_column_spec.rb
+++ b/spec/money_column_spec.rb
@@ -0,0 +1,32 @@+require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
+
+class MoneyRecord < ActiveRecord::Base
+ money_column :price
+end
+
+describe "MoneyColumn" do
+
+ it "should typecast string to money" do
+ m = MoneyRecord.new(:price => "100")
+
+ m.price.should == Money.new(100)
+ end
+
+ it "should typecast numeric to money" do
+ m = MoneyRecord.new(:price => 100)
+
+ m.price.should == Money.new(100)
+ end
+
+ it "should typecast blank to nil" do
+ m = MoneyRecord.new(:price => "")
+
+ m.price.should == nil
+ end
+
+ it "should typecast invalid string to empty money" do
+ m = MoneyRecord.new(:price => "magic")
+
+ m.price.should == Money.new(0)
+ end
+end
|
Add basic tests for money column
|
diff --git a/spec/rspec/sitemap/matchers/include_url_spec.rb b/spec/rspec/sitemap/matchers/include_url_spec.rb
index abc1234..def5678 100644
--- a/spec/rspec/sitemap/matchers/include_url_spec.rb
+++ b/spec/rspec/sitemap/matchers/include_url_spec.rb
@@ -4,14 +4,14 @@ include RSpec::Sitemap::Matchers
context "on a File" do
- subject { fixture('basic') }
+ let(:sitemap) { fixture('basic') }
it "passes" do
- subject.should include_url('http://www.example.com')
+ sitemap.should include_url('http://www.example.com')
end
it "fails" do
expect {
- subject.should include_url('http://www.not-an-example.com')
+ sitemap.should include_url('http://www.not-an-example.com')
}.to raise_error {|e|
e.message.should match("to include a URL to http://www.not-an-example.com")
}
@@ -21,15 +21,15 @@
context "on a String" do
- subject { fixture('basic').read }
+ let(:sitemap) { fixture('basic').read }
it "passes" do
- subject.should include_url('http://www.example.com')
+ sitemap.should include_url('http://www.example.com')
end
it "fails" do
expect {
- subject.should include_url('http://www.not-an-example.com')
+ sitemap.should include_url('http://www.not-an-example.com')
}.to raise_error {|e|
e.message.should match("to include a URL to http://www.not-an-example.com")
}
|
Use `let` instead of `subject` in the tests and make them more descriptive.
|
diff --git a/spec/configuration_spec.rb b/spec/configuration_spec.rb
index abc1234..def5678 100644
--- a/spec/configuration_spec.rb
+++ b/spec/configuration_spec.rb
@@ -1,28 +1,34 @@ require "helper"
describe SimpleCov::Configuration do
+ let(:config_class) do
+ Class.new do
+ include SimpleCov::Configuration
+ end
+ end
+ let(:config) { config_class.new }
+
describe "#tracked_files" do
context "when configured" do
let(:glob) { "{app,lib}/**/*.rb" }
-
- before { SimpleCov.track_files(glob) }
+ before { config.track_files(glob) }
it "returns the configured glob" do
- expect(SimpleCov.tracked_files).to eq glob
+ expect(config.tracked_files).to eq glob
end
context "and configured again with nil" do
- before { SimpleCov.track_files(nil) }
+ before { config.track_files(nil) }
it "returns nil" do
- expect(SimpleCov.tracked_files).to be_nil
+ expect(config.tracked_files).to be_nil
end
end
end
context "when unconfigured" do
it "returns nil" do
- expect(SimpleCov.tracked_files).to be_nil
+ expect(config.tracked_files).to be_nil
end
end
end
|
Adjust spec to not modify global state
This way the second context is also truly unconfigured, plus
no possible test order shenanigans/global influence.
|
diff --git a/spec/models/person_spec.rb b/spec/models/person_spec.rb
index abc1234..def5678 100644
--- a/spec/models/person_spec.rb
+++ b/spec/models/person_spec.rb
@@ -16,4 +16,12 @@ it 'creates a name from first and last names' do
expect(build(:person, first_name: 'Roger', last_name: 'Smith').name).to eq('Roger Smith')
end
+
+ it 'stores arbitrary fields' do
+ fields = { 'a' => 'b', 'd' => 3, 'f' => true }
+ person = build(:person, fields: fields)
+ expect(person.save).to be true
+ person.reload
+ expect(person.fields).to eq(fields)
+ end
end
|
Test that the jsonb storage of arbitrary fields works.
|
diff --git a/spec/models/update_spec.rb b/spec/models/update_spec.rb
index abc1234..def5678 100644
--- a/spec/models/update_spec.rb
+++ b/spec/models/update_spec.rb
@@ -19,7 +19,9 @@ :body => "They leave slime everywhere", :user_id => @id
time = update.created_at
datestr = time.strftime("%Y%m%d")
- datestr.length.should == 8
+ # 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
update.slug.should == "test-#{datestr}-slugs-are-nasty"
end
end
|
Fix Y10K bug in update tests, at @zoeimogen's insistence.
See https://twitter.com/zoeimogen/status/280699989674577921
|
diff --git a/lib/cocoapods/command/push.rb b/lib/cocoapods/command/push.rb
index abc1234..def5678 100644
--- a/lib/cocoapods/command/push.rb
+++ b/lib/cocoapods/command/push.rb
@@ -1,7 +1,7 @@ module Pod
class Command
class Push < Command
- self.summary = 'Temporary placeholder for the `pod repo push` command'
+ self.summary = 'Temporary alias for the `pod repo push` command'
def initialize(argv)
|
[Command::Push] Add temporary foward command 2
|
diff --git a/lib/git_crecord/hunks/file.rb b/lib/git_crecord/hunks/file.rb
index abc1234..def5678 100644
--- a/lib/git_crecord/hunks/file.rb
+++ b/lib/git_crecord/hunks/file.rb
@@ -50,6 +50,19 @@ def highlightable_subs
@hunks
end
+
+ def generate_diff
+ return unless selected
+ out_line_offset = 0
+ [
+ "diff --git a/#{@filename_a} b/#{@filename_b}",
+ *@extra_lines,
+ *subs.map do |sub|
+ content, out_line_offset = sub.generate_diff(out_line_offset)
+ content
+ end.compact
+ ].join("\n")
+ end
end
end
end
|
Implement generate_diff method for FileHunk
|
diff --git a/lib/globot/plugins/welcome.rb b/lib/globot/plugins/welcome.rb
index abc1234..def5678 100644
--- a/lib/globot/plugins/welcome.rb
+++ b/lib/globot/plugins/welcome.rb
@@ -7,7 +7,8 @@ 'Welcome to the room, %s.',
'Back again hey, %s?',
'%s! Good to see you!'
- ]
+ # Plugins can be reloaded dynamically, and we don't want to redefine contants.
+ ] unless self.const_defined?('SCRIPTS')
def setup
self.name = "Welcome"
|
Stop warnings about redefining constants when reloading plugins.
|
diff --git a/lib/formaggio/capistrano/cleanup.rb b/lib/formaggio/capistrano/cleanup.rb
index abc1234..def5678 100644
--- a/lib/formaggio/capistrano/cleanup.rb
+++ b/lib/formaggio/capistrano/cleanup.rb
@@ -1,3 +1,9 @@ Capistrano::Configuration.instance(:must_exist).load do
after "deploy:restart", "deploy:cleanup"
+ before "deploy:cleanup", "touch:latest_release"
+ namespace :touch do
+ task :set_variables do
+ run "touch #{current_release}"
+ end
+ end
end
|
Make sure latest release is the most recently modified release
|
diff --git a/lib/mongomodel/support/reference.rb b/lib/mongomodel/support/reference.rb
index abc1234..def5678 100644
--- a/lib/mongomodel/support/reference.rb
+++ b/lib/mongomodel/support/reference.rb
@@ -9,6 +9,8 @@ def to_s
id.to_s
end
+
+ alias :to_str :to_s
def hash
id.hash
|
Add implicit cast method to Reference
|
diff --git a/lib/nutils/filters/yuicompressor.rb b/lib/nutils/filters/yuicompressor.rb
index abc1234..def5678 100644
--- a/lib/nutils/filters/yuicompressor.rb
+++ b/lib/nutils/filters/yuicompressor.rb
@@ -28,6 +28,8 @@ # It fallbacks to `:type => :js` because backwards compatibility w/
# prior versions of the filter.
compressor = ::YUI::JavaScriptCompressor.new
+ else
+ raise "You should define a params[:type] either :js or :css"
end
compressor.compress(content)
|
Add an error when no type defined for YUICompressor filter
|
diff --git a/download.rb b/download.rb
index abc1234..def5678 100644
--- a/download.rb
+++ b/download.rb
@@ -14,19 +14,18 @@
def download
create_directory
- puts "------ Start downloading ------"
@rss.items.each do |item|
Dir.chdir(download_directory) do
- next if File.exist?("#{item.title}.mp3")
- puts "Now download -> #{item.title}"
+ title = item.title.delete("/")
+ next if File.exist?("#{title}.mp3")
+ puts "Now download -> #{title}"
system("curl",
"--location",
"--output",
- "#{item.title}.mp3",
+ "#{title}.mp3",
"#{item.enclosure.url}")
end
end
- puts "****** Finished downloading ******"
end
private
|
Use title instead of item.title
|
diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb
index abc1234..def5678 100644
--- a/spec/rails_helper.rb
+++ b/spec/rails_helper.rb
@@ -18,4 +18,14 @@ RSpec.configure do |config|
config.use_transactional_fixtures = true
config.include ControllerMatchers, type: :controller
+
+ config.around(:example, :debug) do |example|
+ old = ActiveRecord::Base.logger
+ begin
+ ActiveRecord::Base.logger = Logger.new($stderr)
+ example.run
+ ensure
+ ActiveRecord::Base.logger = old
+ end
+ end
end
|
Add ActiveRecord debugging helper for RSpec
|
diff --git a/spec_support.gemspec b/spec_support.gemspec
index abc1234..def5678 100644
--- a/spec_support.gemspec
+++ b/spec_support.gemspec
@@ -18,4 +18,8 @@ s.test_files = Dir["spec/**/*"]
s.add_development_dependency "rspec"
+
+ # to execute `rake release` from a jruby environment, uncomment line below
+ # s.add_dependency "jruby-openssl"
+
end
|
Add comment about dependency on "jruby-openssl" for `rake release` from JRuby env
|
diff --git a/Formula/brew-desc.rb b/Formula/brew-desc.rb
index abc1234..def5678 100644
--- a/Formula/brew-desc.rb
+++ b/Formula/brew-desc.rb
@@ -0,0 +1,11 @@+require 'formula'
+
+class BrewDesc < Formula
+ url 'git://github.com/telemachus/brew-desc'
+ homepage 'https://github.com/telemachus/brew-desc'
+ version '0.0.1'
+
+ def install
+ bin.install 'bin/brew-desc.rb'
+ end
+end
|
Add a formula for installation
|
diff --git a/lib/realm/messaging/message_type.rb b/lib/realm/messaging/message_type.rb
index abc1234..def5678 100644
--- a/lib/realm/messaging/message_type.rb
+++ b/lib/realm/messaging/message_type.rb
@@ -1,7 +1,7 @@ module Realm
module Messaging
class MessageType
- GENERIC_PROPERTIES = [ :message_type, :version, :timestamp, :uuid ].freeze
+ GENERIC_PROPERTIES = [ :message_type, :version, :timestamp ].freeze
def initialize(name, properties = [ ])
@name = name
|
Stop requiring UUIDs in messages to support commands as well as events
|
diff --git a/lib/rom/support/auto_curry.rb b/lib/rom/support/auto_curry.rb
index abc1234..def5678 100644
--- a/lib/rom/support/auto_curry.rb
+++ b/lib/rom/support/auto_curry.rb
@@ -0,0 +1,28 @@+module ROM
+ module AutoCurry
+ def self.extended(klass)
+ busy = false
+ curried = klass.curried
+
+ klass.define_singleton_method(:method_added) do |name|
+ return if busy
+
+ busy = true
+ meth = instance_method(name)
+ arity = meth.arity
+
+ define_method(name) do |*args|
+ if arity < 0 || arity == args.size
+ meth.bind(self).(*args)
+ else
+ curried.new(self, name: name, curry_args: args, arity: arity)
+ end
+ end
+
+ busy = false
+
+ super(name)
+ end
+ end
+ end
+end
|
Make Relation lazy by default
|
diff --git a/lib/smartdown/engine/state.rb b/lib/smartdown/engine/state.rb
index abc1234..def5678 100644
--- a/lib/smartdown/engine/state.rb
+++ b/lib/smartdown/engine/state.rb
@@ -51,7 +51,7 @@ if has_key?(key)
@data.fetch(key.to_s)
else
- raise UndefinedValue
+ raise UndefinedValue, "variable '#{key}' not defined", caller
end
end
|
Improve error message on undefined value
|
diff --git a/lib/uploadie/storage/file_system.rb b/lib/uploadie/storage/file_system.rb
index abc1234..def5678 100644
--- a/lib/uploadie/storage/file_system.rb
+++ b/lib/uploadie/storage/file_system.rb
@@ -6,13 +6,15 @@ class Uploadie
module Storage
class FileSystem
- attr_reader :directory, :subdirectory
+ attr_reader :directory, :subdirectory, :host
- def initialize(directory, root: nil)
+ def initialize(directory, root: nil, host: "")
if root
@subdirectory = directory
@directory = File.join(root, directory)
+ @host = host
else
+ raise Error, ":host only works in combination with :root" if !host.empty?
@directory = directory
end
@@ -52,7 +54,7 @@
def path(id)
if subdirectory
- "/" + ::File.join(subdirectory, id)
+ File.join(host, ::File.join(subdirectory, id))
else
::File.join(directory, id)
end
|
Add :host option to FileSystem storage for CDNs
|
diff --git a/lib/torckapi/response/base.rb b/lib/torckapi/response/base.rb
index abc1234..def5678 100644
--- a/lib/torckapi/response/base.rb
+++ b/lib/torckapi/response/base.rb
@@ -7,7 +7,7 @@
def self.bdecode_and_check(data, key)
begin
- bdecoded_data = BEncode.load(data)
+ bdecoded_data = BEncode.load(data, :ignore_trailing_junk => true)
rescue BEncode::DecodeError
raise Torckapi::Tracker::MalformedResponseError, "Can't decode '%s'" % data
end
|
Revert "Revert "Allow proper loading of failed Bencoded data""
This reverts commit 5262935bf43adf18d10be95c926df5d643f8b5d5.
|
diff --git a/lib/wingtips/configuration.rb b/lib/wingtips/configuration.rb
index abc1234..def5678 100644
--- a/lib/wingtips/configuration.rb
+++ b/lib/wingtips/configuration.rb
@@ -3,21 +3,14 @@ attr_reader :slide_classes
def initialize(path)
- @allow_unnamed_slides = false
-
- path = File.expand_path(path)
- dir = File.dirname(path)
- Dir[File.join(dir, "slides/*.rb")].each do |file|
- self.instance_eval(File.read(file)) unless file == path
- end
-
- @allow_unnamed_slides = true
+ full_path = File.expand_path(path)
+ load_named_slides full_path
# the empty slide at the start is needed as otherwise the dimensions
# of the first slide are most likely messed up
@slide_classes = [Wingtips::Slide]
- self.instance_eval(File.read(path))
+ self.instance_eval(File.read(full_path))
end
def slide(title=nil, &content)
@@ -30,7 +23,16 @@ end
private
- def create_slide_class content
+ def load_named_slides(full_path)
+ @allow_unnamed_slides = false
+ dir = File.dirname(full_path)
+ Dir[File.join(dir, "slides/*.rb")].each do |file|
+ self.instance_eval(File.read(file)) unless file == full_path
+ end
+ @allow_unnamed_slides = true
+ end
+
+ def create_slide_class(content)
clazz = Class.new(Wingtips::Slide)
clazz.class_eval do
define_method(:content, &content)
@@ -38,7 +40,7 @@ clazz
end
- def publish_slide_class clazz, title
+ def publish_slide_class(clazz, title)
if @allow_unnamed_slides && title.nil?
@slide_classes << clazz
elsif title.nil?
|
Replace the parameter overwrite and extract the slide loading switch
|
diff --git a/app/views/crumbs/index.json.jbuilder b/app/views/crumbs/index.json.jbuilder
index abc1234..def5678 100644
--- a/app/views/crumbs/index.json.jbuilder
+++ b/app/views/crumbs/index.json.jbuilder
@@ -1,4 +1,9 @@ json.array!(@crumbs) do |crumb|
json.extract! crumb, :id, :latitude, :longitude, :user_id, :timestamp, :message
+
+ json.author do
+ json.name crumb.user.name
+ end
+
json.url crumb_url(crumb, format: :json)
end
|
Include author in JSON crumb response
|
diff --git a/Formula/phpdocumentor.rb b/Formula/phpdocumentor.rb
index abc1234..def5678 100644
--- a/Formula/phpdocumentor.rb
+++ b/Formula/phpdocumentor.rb
@@ -0,0 +1,31 @@+require 'formula'
+require File.expand_path("../../Requirements/php-meta-requirement", Pathname.new(__FILE__).realpath)
+require File.expand_path("../../Requirements/phar-requirement", Pathname.new(__FILE__).realpath)
+
+class Phpdocumentor < Formula
+ homepage 'http://www.phpdoc.org'
+ url 'http://www.phpdoc.org/phpDocumentor.phar'
+ sha1 'ca66cc4e95aaefff7bc4341bd9d2d1d25c47eea3'
+ version '2.0.0a12'
+
+ depends_on PhpMetaRequirement
+ depends_on PharRequirement
+
+ def install
+ libexec.install "phpDocumentor.phar"
+ sh = libexec + "phpdoc"
+ sh.write("#!/usr/bin/env bash\n\n/usr/bin/env php -d allow_url_fopen=On -d detect_unicode=Off #{libexec}/phpDocumentor.phar $*")
+ chmod 0755, sh
+ bin.install_symlink sh
+ end
+
+ def caveats; <<-EOS.undent
+ Verify your installation by running:
+ "phpdoc --version".
+
+ You can read more about phpdocumentor by running:
+ "brew home phpdocumentor".
+ EOS
+ end
+
+end
|
Add formula for PhpDocumentor 2
|
diff --git a/test_app/spec/unit/test_app/literal/command_spec.rb b/test_app/spec/unit/test_app/literal/command_spec.rb
index abc1234..def5678 100644
--- a/test_app/spec/unit/test_app/literal/command_spec.rb
+++ b/test_app/spec/unit/test_app/literal/command_spec.rb
@@ -2,7 +2,7 @@
require 'spec_helper'
-RSpec.describe TestApp::Literal, '#string' do
+RSpec.describe TestApp::Literal, '#command' do
subject { object.command(double) }
let(:object) { described_class.new }
|
Use correct metadata for test app
|
diff --git a/lib/bipbip/plugin/monit.rb b/lib/bipbip/plugin/monit.rb
index abc1234..def5678 100644
--- a/lib/bipbip/plugin/monit.rb
+++ b/lib/bipbip/plugin/monit.rb
@@ -1,6 +1,6 @@ require 'monit'
-class MonitStatus < Monit::Status
-end
+#class MonitStatus < Monit::Status
+#end
module Bipbip
@@ -14,7 +14,7 @@ end
def monitor
- status = MonitStatus.new(
+ status = ::Monit::Status.new(
:host => config['host'],
:auth => config['auth']
)
|
Remove hack class and explicit scope
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.