diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/lib/event_store/messaging/controls/writer.rb b/lib/event_store/messaging/controls/writer.rb index abc1234..def5678 100644 --- a/lib/event_store/messaging/controls/writer.rb +++ b/lib/event_store/messaging/controls/writer.rb @@ -5,7 +5,7 @@ def self.write(count=nil, stream_name=nil, stream_metadata: nil) count ||= 1 - stream_name = Controls::StreamName.get stream_name + stream_name ||= Controls::StreamName.get stream_name path = "/streams/#{stream_name}" writer = EventStore::Messaging::Writer.build
Correct mistake where stream_name is always set
diff --git a/middleman-title.gemspec b/middleman-title.gemspec index abc1234..def5678 100644 --- a/middleman-title.gemspec +++ b/middleman-title.gemspec @@ -9,6 +9,7 @@ spec.authors = ['Justin Cypret'] spec.email = ['jcypret@gmail.com'] spec.summary = 'A Middleman extension for setting the page title' + spec.description = 'A Middleman extension for setting the page title' spec.homepage = 'https://github.com/jcypret/middleman-title' spec.license = 'MIT' @@ -20,6 +21,6 @@ spec.add_dependency 'middleman-core', '~> 3.2' spec.add_development_dependency 'bundler', '~> 1.6' - spec.add_development_dependency 'rake', '~> 10.3.1' - spec.add_development_dependency 'rspec', '~> 2.14.1' + spec.add_development_dependency 'rake', '~> 10.3', '>= 10.3.1' + spec.add_development_dependency 'rspec', '~> 2.14', '>= 2.14.1' end
Update Rake and Rspec dependancies
diff --git a/metadata.rb b/metadata.rb index abc1234..def5678 100644 --- a/metadata.rb +++ b/metadata.rb @@ -5,6 +5,7 @@ description "Installs and configures Rundeck 2.0" long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) version "2.0.4" +depends "runit" depends "sudo" depends "java" depends "apache2"
Revert "remove the runit dependency" This reverts commit 4916eef5d50edaf84ec39f2e87026e080e3d1315 [formerly d6a5d91d367b9aa6bac0144542660d5a3d94d7ae] [formerly 4b48d64dcf39560f4696fe824cf335c79701a25f [formerly 586cd3dd624dfcb538acd30b7c2e19f46670025f]] [formerly ee9b210ca3b650b96206da89acb500f290462487 [formerly af115ebbd470e41bafe71b11b2d0bb3027de5a2d] [formerly fd15bb55ad044adac5059c75e15a16264ba1e562 [formerly c970574c6323d61ba71ea27e770b5b5188217344]]] [formerly 7a5952920fce533423e1f24ee82a40494f93e193 [formerly 59202dcd3eab007885bba0dea6e19918da82ccd0] [formerly f8d471bf4501a66f8d8364014e77e497c2ab6597 [formerly 469683351893a6b105540c1027c2a2cc3727ab89]] [formerly 4e765732d3537356e066967e5285d01a893df14b [formerly 807498777539e8ccb0c08b4c5dbe377e387ab421] [formerly ea25cec66fc36b028fe88d6defd4a60413072a4a [formerly 22f0fef602c93cdf7224d09a1d3ffbccd53ae458]]]]. Former-commit-id: 6213ab53718192e50121eff248f7cb2ad2c59444 Former-commit-id: 6c99cbf3bf7eba825deafe6b7ae3ada234e22c3c [formerly 2716fecbf984da67dc186ff3f41132f5c935000a] [formerly 84a7dfdc6e511e892349b4d0b7966ea67d5d4daf [formerly 6faeca459057ea4261a03bab82d1e16da0d80bfd]] Former-commit-id: ec9342c619f28ddbc083e2aec9da92869acbfea2 [formerly 4f0044d33cd2fa88dc8f307b6403949ad8531257] Former-commit-id: e7748e5422024008416689a682aec908a7ece44a
diff --git a/metadata.rb b/metadata.rb index abc1234..def5678 100644 --- a/metadata.rb +++ b/metadata.rb @@ -10,4 +10,5 @@ supports platform end +depends 'erlang', '>= 0.9' depends 'rabbitmq', '~>3.7.0'
Add dependency for erlang cookbook
diff --git a/metadata.rb b/metadata.rb index abc1234..def5678 100644 --- a/metadata.rb +++ b/metadata.rb @@ -1,7 +1,7 @@-maintainer "Chris Roberts" -maintainer_email "chrisroberts.code@gmail.com" +maintainer "Heavy Water" +maintainer_email "support@hw-ops.com" license "Apache 2.0" description "Provides and configures cgroups" long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version "0.0.1" +version "0.1.0"
Update and bump version to 0.1.0
diff --git a/metadata.rb b/metadata.rb index abc1234..def5678 100644 --- a/metadata.rb +++ b/metadata.rb @@ -6,6 +6,6 @@ long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) version "1.2.7" -%w{redhat centos scientific fedora amazon debian ubuntu}.each do |os| +%w{redhat centos scientific fedora amazon debian ubuntu raspbian}.each do |os| supports os end
[COOK-3452] Add support for raspbian platform Signed-off-by: Seth Vargo <81550dbf04dfd8537ff7b3c014c6fbf86e0889dc@gmail.com>
diff --git a/metadata.rb b/metadata.rb index abc1234..def5678 100644 --- a/metadata.rb +++ b/metadata.rb @@ -7,4 +7,4 @@ version '1.1.1' recipe 'ssh_known_hosts', 'Provides an LWRP for managing SSH known hosts. Also includes a recipe for automatically adding all nodes to the SSH known hosts.' -depends "partial_search" +recommends "partial_search"
[COOK-4328] Change depends on Partial Search to recommends. If its not there, you just can't use it as a recipe, but the provider is still useful.
diff --git a/spec/controllers/event_wines_controller_spec.rb b/spec/controllers/event_wines_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/event_wines_controller_spec.rb +++ b/spec/controllers/event_wines_controller_spec.rb @@ -0,0 +1,18 @@+require 'rails_helper' + +describe EventWinesController do + def stub_current_user user + ApplicationController.any_instance.stub(:current_user) { user } + end + + let(:user) {User.create(name: "jane doe", email: "jane@example.com", password: "test", password_confirmation: "test")} + + context 'GET #edit' do + it "renders the :edit template" do + stub_current_user(user) + new_event_wine = EventWine.create() + get :edit, id: new_event_wine + expect(response).to render_template :edit + end + end +end
Add event_wine controller spec with edit render test
diff --git a/spec/factories/calculated_adjustment_factory.rb b/spec/factories/calculated_adjustment_factory.rb index abc1234..def5678 100644 --- a/spec/factories/calculated_adjustment_factory.rb +++ b/spec/factories/calculated_adjustment_factory.rb @@ -1,12 +1,23 @@-attach_per_item_trait = proc do - trait :per_item do - transient { amount 1 } - calculator { build(:calculator_per_item, preferred_amount: amount) } +FactoryBot.define do + factory :calculator_flat_rate, class: Spree::Calculator::FlatRate do + preferred_amount { generate(:calculator_amount) } end end FactoryBot.modify do - factory :payment_method, &attach_per_item_trait - factory :shipping_method, &attach_per_item_trait - factory :enterprise_fee, &attach_per_item_trait + attach_calculator_traits = proc do + trait :flat_rate do + transient { amount 1 } + calculator { build(:calculator_flat_rate, preferred_amount: amount) } + end + + trait :per_item do + transient { amount 1 } + calculator { build(:calculator_per_item, preferred_amount: amount) } + end + end + + factory :payment_method, &attach_calculator_traits + factory :shipping_method, &attach_calculator_traits + factory :enterprise_fee, &attach_calculator_traits end
Add flat rate calculator traits to related factories
diff --git a/db/migrate/20150501003216_create_submissions.rb b/db/migrate/20150501003216_create_submissions.rb index abc1234..def5678 100644 --- a/db/migrate/20150501003216_create_submissions.rb +++ b/db/migrate/20150501003216_create_submissions.rb @@ -1,3 +1,5 @@+# Encoding: utf-8 +# Create submission class CreateSubmissions < ActiveRecord::Migration def change create_table :submissions do |t|
Clean up submission migration script
diff --git a/dcs-debian.gemspec b/dcs-debian.gemspec index abc1234..def5678 100644 --- a/dcs-debian.gemspec +++ b/dcs-debian.gemspec @@ -20,6 +20,7 @@ spec.add_runtime_dependency "thor", "~> 0.19.1" spec.add_runtime_dependency "colored", "~> 1.2" + spec.add_runtime_dependency "nokogiri", "~> 1.6.4" spec.add_development_dependency "bundler", "~> 1.7" spec.add_development_dependency "rake", "~> 10.0" end
Add missing run-time dependency to nokogiri
diff --git a/demo/cheatsheet.rb b/demo/cheatsheet.rb index abc1234..def5678 100644 --- a/demo/cheatsheet.rb +++ b/demo/cheatsheet.rb @@ -0,0 +1,30 @@+# Cheet sheet for SolveBio API +require 'solvebio' + +# Load the Dataset object +dataset = SolveBio::Dataset.retrieve('ClinVar/2.0.0-1/Variants') + +# Print the Dataset +puts dataset.query() + +# Get help (fields/facets) +dataset.help() + +# Query the dataset (filterless) +q = dataset.query() + +filters = SolveBio::Filter.new :gene_symbols => "BRCA2" + +puts dataset.query(:filters => filters) + +# Multiple keyword filter (boolean 'or') +filters = SolveBio::Filter.new :gene_symbols => "BRCA2" +filters |= SolveBio::Filter.new :gene_symbols => "BRCA1" + +# Same as above 'or' in one go using 'in' +filters = SolveBio::Filter.new :gene_symbols__in => ["BRCA2", "BRCA1"] + +puts dataset.query(:filters => filters) + +dataset.query(filters => + SolveBio::RangeFilter.new('hg38', "13", 32200000, 32200500))
Add SolveBio Ruby cheet sheet
diff --git a/db/migrate/20140724134601_fix_yaml_encoding.rb b/db/migrate/20140724134601_fix_yaml_encoding.rb index abc1234..def5678 100644 --- a/db/migrate/20140724134601_fix_yaml_encoding.rb +++ b/db/migrate/20140724134601_fix_yaml_encoding.rb @@ -6,6 +6,7 @@ fix_encoding(Profile, 'data') fix_encoding(ActionTracker::Record, 'params') fix_encoding(Article, 'setting') + fix_encoding(Task, 'data') end def self.down
Add Task model to fix yaml encoding migration
diff --git a/lib/user.rb b/lib/user.rb index abc1234..def5678 100644 --- a/lib/user.rb +++ b/lib/user.rb @@ -7,24 +7,23 @@ page += 1 end until a.empty? - remain = 0 - forks = [] EventMachine.run do - repos.each do |current| + http = EventMachine::MultiRequest.new + repos.each_with_index do |current,i| if current["fork"] - remain += 1 - http = EventMachine::HttpRequest.new( + http.add i, EventMachine::HttpRequest.new( "https://api.github.com/repos/#{current["owner"]["login"]}/#{current["name"]}" ).get - http.callback do - remain -= 1 - source = JSON.parse( http.response )["source"] - forks << { :owner => source["owner"]["login"], :name => source["name"] } - EventMachine.stop if remain <= 0 - end end end + http.callback do + forks = http.responses[:callback].collect do |n,resp| + source = JSON.parse( resp.response )["source"] + { :owner => source["owner"]["login"], :name => source["name"] } + end + EventMachine.stop + return forks + end end - forks end end
Refactor to use multi-request interface
diff --git a/public/plugin/lokka-pygmentize/lib/lokka/pygmentize.rb b/public/plugin/lokka-pygmentize/lib/lokka/pygmentize.rb index abc1234..def5678 100644 --- a/public/plugin/lokka-pygmentize/lib/lokka/pygmentize.rb +++ b/public/plugin/lokka-pygmentize/lib/lokka/pygmentize.rb @@ -16,11 +16,11 @@ end class Entry - alias_method :original_long_body, :long_body - def highlighted_long_body - syntax_highlight(self.original_long_body) + alias_method :original_body, :body + def highlighted_body + syntax_highlight(self.original_body) end - alias_method :long_body, :highlighted_long_body + alias_method :body, :highlighted_body alias_method :original_short_body, :short_body def highlighted_short_body @@ -30,7 +30,7 @@ def syntax_highlight(body) doc = Nokogiri::HTML.fragment(body) - doc.search("//pre").each do |pre| + doc.css("pre").each do |pre| code = pre.css("code")[0] lexer = if pre[:class].present? pre[:class]
Stop using Nokogiri::HTML.search, instead use Nokogiri::HTML.css
diff --git a/db/seeds.rb b/db/seeds.rb index abc1234..def5678 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -6,6 +6,16 @@ The street is dusty and unkept. There is a small tavern to the west. DESCRIPTION ) + + Monster.find_or_create_by(name: "Rat").tap do |rat| + Spawn.find_or_create_by(base: rat, room: room).tap do |spawn| + spawn.update( + activates_at: Time.current, + duration: 2.minutes, + frequency: 1.minute + ) + end + end end Room.find_or_initialize_by(x: -1, y: 0, z: 0).tap do |room| @@ -28,7 +38,3 @@ DESCRIPTION ) end - -Monster.find_or_create_by(name: "Rat").tap do |rat| - Spawn.find_or_create_by(base: rat, entity: rat.dup, room: Room.find_by(x: 0, y: 0, z: 0)) -end
Add duration and frequency to spawn seed, and activate immediately.
diff --git a/spec/controllers/comments_controller_spec.rb b/spec/controllers/comments_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/comments_controller_spec.rb +++ b/spec/controllers/comments_controller_spec.rb @@ -1,26 +1,26 @@-require 'rails_helper' +# require 'rails_helper' -RSpec.describe Comment, type: :controller do +# RSpec.describe Comment, type: :controller do - let(:duck_user1) { double("User", name: "Daffy", password_digest: "123")} - let(:duck_user2) { double("User", name: "Plucky", password_digest: "123")} - let(:duck_question) { double("Question", title: "Does it quack?", - content: "I have a duck I need to assess.", - user: :duck_user1)} - let(:duck_answer) { double("Answer", content: "It quacks.", - user: :duck_user2)} +# let(:duck_user1) { double("User", name: "Daffy", password_digest: "123")} +# let(:duck_user2) { double("User", name: "Plucky", password_digest: "123")} +# let(:duck_question) { double("Question", title: "Does it quack?", +# content: "I have a duck I need to assess.", +# user: :duck_user1)} +# let(:duck_answer) { double("Answer", content: "It quacks.", +# user: :duck_user2)} - it 'creates a new comment that knows precisely which Question or Answer it is a response to' - duck_params = { - commentable_id: duck_question.id - commentable_type: "Question", - content: "I like ducks.", - user_id: duck_user.id - } - # This isn't really what we need to test: - expect { - post :create, duck_params - }.to change{Comment.count}.by(1) - end +# it 'creates a new comment that knows precisely which Question or Answer it is a response to' +# duck_params = { +# commentable_id: duck_question.id +# commentable_type: "Question", +# content: "I like ducks.", +# user_id: duck_user.id +# } +# # This isn't really what we need to test: +# expect { +# post :create, duck_params +# }.to change{Comment.count}.by(1) +# end -end +# end
Comment out comments_controller spec file
diff --git a/spec/features/actions_from_dashboard_spec.rb b/spec/features/actions_from_dashboard_spec.rb index abc1234..def5678 100644 --- a/spec/features/actions_from_dashboard_spec.rb +++ b/spec/features/actions_from_dashboard_spec.rb @@ -0,0 +1,19 @@+require 'rails_helper' + +describe 'actions from dashboard' do + before :each do + @user = FactoryGirl.create(:user) + @project = FactoryGirl.create(:project) + FactoryGirl.create(:contract, hiwi: @user) + @project.users << @user + login_as @user + visit dashboard_path + end + + it 'should be possible to add working hours for a project from the dashboard' do + click_link(I18n.t('dashboard.actions.enter_work_hours', project_name: @project.title)) + expect(current_path).to eq(new_work_day_path) + expect(page).to have_content(@project.title) + end + +end
Add acceptance test of dashboard links.
diff --git a/no-style-please.gemspec b/no-style-please.gemspec index abc1234..def5678 100644 --- a/no-style-please.gemspec +++ b/no-style-please.gemspec @@ -2,7 +2,7 @@ Gem::Specification.new do |spec| spec.name = "no-style-please" - spec.version = "0.1.1" + spec.version = "0.1.2" spec.authors = ["Riccardo Graziosi"] spec.email = ["riccardo.graziosi97@gmail.com"]
Update gem version to 0.1.2
diff --git a/spec/easemob/chatlog_spec.rb b/spec/easemob/chatlog_spec.rb index abc1234..def5678 100644 --- a/spec/easemob/chatlog_spec.rb +++ b/spec/easemob/chatlog_spec.rb @@ -1,4 +1,5 @@ require 'spec_helper' +require 'date' RSpec.describe Easemob::Chatlog do describe '#chatmessages' do @@ -8,5 +9,12 @@ h1 = JSON.parse res.to_s expect(h1['count']).not_to be nil end + + it 'get chat messages today only using after' do + res = Easemob.chatmessages(after: Date.today.to_time) + expect(res.code).to eq 200 + h1 = JSON.parse res.to_s + expect(h1['count']).not_to be nil + end end end
Add rspec case to using after for chatmessages
diff --git a/spec/models/user_ban_spec.rb b/spec/models/user_ban_spec.rb index abc1234..def5678 100644 --- a/spec/models/user_ban_spec.rb +++ b/spec/models/user_ban_spec.rb @@ -0,0 +1,64 @@+# frozen_string_literal: true + +require "rails_helper" + +RSpec.describe UserBan, type: :model do + describe "validations" do + it { should belong_to(:user) } + it { should belong_to(:banned_by).class_name("User").optional } + end + + describe "scopes" do + describe ".current" do + let(:user) { FactoryBot.create(:user) } + let!(:current_ban) { UserBan.create(user: user, expires_at: Time.now.utc + 1.day) } + let!(:expired_ban) { UserBan.create(user: user, expires_at: Time.now.utc - 1.day) } + + it "returns only current bans" do + expect(UserBan.current).to eq([current_ban]) + end + end + end + + describe "#permanent?" do + let(:user) { FactoryBot.create(:user) } + let(:ban) { UserBan.create(user: user, expires_at: expires_at) } + + context "ban is permanent" do + let(:expires_at) { nil } + + it "returns true" do + expect(ban.permanent?).to eq(true) + end + end + + context "ban is not permanent" do + let(:expires_at) { Time.now.utc + 1.day } + + it "returns false" do + expect(ban.permanent?).to be false + end + end + end + + describe "#current?" do + let(:user) { FactoryBot.create(:user) } + let(:ban) { UserBan.create(user: user, expires_at: expires_at) } + + context "ban is current" do + let(:expires_at) { Time.now.utc + 1.day } + + it "returns true" do + expect(ban.current?).to eq(true) + end + end + + context "ban is not current" do + let(:expires_at) { Time.now.utc - 1.day } + + it "returns false" do + expect(ban.current?).to eq(false) + end + end + end +end
Add tests for `UserBan` model
diff --git a/app/models/effective/snippets/effective_asset.rb b/app/models/effective/snippets/effective_asset.rb index abc1234..def5678 100644 --- a/app/models/effective/snippets/effective_asset.rb +++ b/app/models/effective/snippets/effective_asset.rb @@ -0,0 +1,37 @@+if defined?(EffectiveAssets) + module Effective + module Snippets + class EffectiveAsset < Snippet + # attr_accessor :asset_id #, Integer + # attr_accessor :html_class #, String + # attr_accessor :link_title #, String + # attr_accessor :private_url # , Boolean + + def snippet_attributes + super + [:asset_id, :html_class, :link_title, :private_url] + end + + def asset + @asset ||= (Effective::Asset.where(:id => asset_id).first if asset_id) + end + + def snippet_tag + :span + end + + def private_url + super || aws_private? + end + + def is_private? + [true, 'true', '1'].include?(private_url) + end + + def aws_private? + (asset.try(:aws_acl) == EffectiveAssets::AWS_PRIVATE) + end + + end + end + end +end
Move asset snippet from effective assets
diff --git a/spec/unit/puppet/parser/functions/validate_cmd_spec.rb b/spec/unit/puppet/parser/functions/validate_cmd_spec.rb index abc1234..def5678 100644 --- a/spec/unit/puppet/parser/functions/validate_cmd_spec.rb +++ b/spec/unit/puppet/parser/functions/validate_cmd_spec.rb @@ -1,4 +1,7 @@ require 'spec_helper' + +TESTEXE = File.exists?('/usr/bin/test') ? '/usr/bin/test' : '/bin/test' +TOUCHEXE = File.exists?('/usr/bin/touch') ? '/usr/bin/touch' : '/bin/touch' describe Puppet::Parser::Functions.function(:validate_cmd) do let(:scope) { PuppetlabsSpec::PuppetInternals.scope } @@ -19,8 +22,8 @@ describe "on validation failure" do it "includes the command error output" do expect { - subject.call ['', '/bin/touch /cant/touch/this'] - }.to raise_error Puppet::ParseError, /cannot touch/ + subject.call ['', "#{TOUCHEXE} /cant/touch/this"] + }.to raise_error Puppet::ParseError, /(cannot touch|o such file or)/ end it "includes the command return value" do @@ -32,12 +35,12 @@ describe "when performing actual validation" do it "can positively validate file content" do - expect { subject.call ["non-empty", "/usr/bin/test -s"] }.to_not raise_error + expect { subject.call ["non-empty", "#{TESTEXE} -s"] }.to_not raise_error end it "can negatively validate file content" do expect { - subject.call ["", "/usr/bin/test -s"] + subject.call ["", "#{TESTEXE} -s"] }.to raise_error Puppet::ParseError, /failed to validate.*test -s/ end end
Fix the tests on osx
diff --git a/spec/controllers/admin/extensions_controller_spec.rb b/spec/controllers/admin/extensions_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/admin/extensions_controller_spec.rb +++ b/spec/controllers/admin/extensions_controller_spec.rb @@ -26,7 +26,7 @@ end it "should list all extensions" do - assigns[:extensions].should == Radiant::Extension.descendants.sort_by(&:name) + assigns[:extensions].sort_by(&:name).should == Radiant::Extension.descendants.sort_by(&:name) end it "should pre-set the template name" do
Test fails when extension sort does not match Signed-off-by: Radiant CMS dev team <f73d9485a052e9e946f26c8e2a718dc9d93fdd45@prime-motif.com>
diff --git a/cc-tool.rb b/cc-tool.rb index abc1234..def5678 100644 --- a/cc-tool.rb +++ b/cc-tool.rb @@ -0,0 +1,19 @@+class CcTool < Formula + desc "Support for Texas Instruments CC Debugger." + homepage "https://sourceforge.net/projects/cctool" + head "https://github.com/dashesy/cc-tool.git" + + depends_on "boost" => :build + depends_on "pkg-config" => :build + depends_on "libusb" + + def install + pkgconfig = Formulary.factory 'pkg-config' + + ENV['PKG_CONFIG'] = "#{pkgconfig.opt_prefix}/bin/pkg-config" + + system "./configure", "--prefix=#{prefix}", "--disable-debug" + system "make" + system "make", "install" + end +end
Add CLI tool for Texas Instrument CC Debugger
diff --git a/week-8/ruby/numbers_to_words/nums_to_words.rb b/week-8/ruby/numbers_to_words/nums_to_words.rb index abc1234..def5678 100644 --- a/week-8/ruby/numbers_to_words/nums_to_words.rb +++ b/week-8/ruby/numbers_to_words/nums_to_words.rb @@ -0,0 +1,72 @@+# Numbers to English Words + +=begin + +PSEUDOCODE +Input: An integer. +Output: A string. +Steps: +1. Define method 'in_words' with a parameter that takes an integer +2. Define an 'single_nums' array that goes from 0-9. +3. string_num = integer.to_s +4. IF string_num.length == 1 +5. return single_nums[integer] +6. ELSIF string_num.length == 3 +7. return 'One Hundred' +8. ELSE + +=end + +# Initial Solution + +def in_words(number) + single_nums = ["zero","one","two","three","four","five","six","seven","eight","nine"] + double_nums = ["zero","ten","twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"] + split_num = number.to_s.split("") + first_digit = split_num[0].to_i + second_digit = split_num[1].to_i + if split_num.length == 1 + return single_nums[number] + elsif split_num.length == 3 + return "one hundred" + elsif number == 16 || number == 17 || number == 14 || number == 19 + return single_nums[second_digit] << "teen" + elsif number == 11 + return "eleven" + elsif number == 12 + return "twelve" + elsif number == 13 + return "thirteen" + elsif number == 15 + return "fifteen" + elsif number == 18 + return "eighteen" + else + if second_digit == 0 + return double_nums[first_digit] + else + word = double_nums[first_digit] << " " << single_nums[second_digit] + end + end +end + + +# DRIVER CODDE + +p in_words(9) +p in_words(10) +p in_words(11) +p in_words(12) +p in_words(13) +p in_words(14) +p in_words(15) +p in_words(16) +p in_words(17) +p in_words(18) +p in_words(19) +p in_words(20) +p in_words(21) +p in_words(22) +p in_words(23) +p in_words(24) +p in_words(25)
Complete the Numbers to Words Challenge
diff --git a/dynamo_kickstarter.gemspec b/dynamo_kickstarter.gemspec index abc1234..def5678 100644 --- a/dynamo_kickstarter.gemspec +++ b/dynamo_kickstarter.gemspec @@ -14,4 +14,6 @@ gem.name = "dynamo_kickstarter" gem.require_paths = ["lib"] gem.version = DynamoKickstarter::VERSION + + gem.add_dependency 'rails', '3.2.8' end
Add Rails as a dependency
diff --git a/test/apps/queue_wait.ru b/test/apps/queue_wait.ru index abc1234..def5678 100644 --- a/test/apps/queue_wait.ru +++ b/test/apps/queue_wait.ru @@ -0,0 +1,38 @@+require 'bundler/setup' +require 'librato-rack' + +# Simulate the environment variables Heroku passes along +# with each request +# +class QueueWait + def initialize(app) + @app = app + end + + def call(env) + case env['PATH_INFO'] + when '/milli' + env['HTTP_X_REQUEST_START'] = (Time.now.to_f * 1000).to_i.to_s + sleep 0.005 + when '/micro' + env['HTTP_X_REQUEST_START'] = (Time.now.to_f * 1000000).to_i.to_s + sleep 0.01 + when '/queue_start' + env['HTTP_X_QUEUE_START'] = (Time.now.to_f * 1000).to_i.to_s + sleep 0.015 + when '/with_t' + env['HTTP_X_REQUEST_START'] = "t=#{(Time.now.to_f * 1000000).to_i}".to_s + sleep 0.02 + end + @app.call(env) + end +end + +use QueueWait +use Librato::Rack + +def application(env) + [200, {"Content-Type" => 'text/html'}, ["Hello!"]] +end + +run method(:application)
Add a test app simulating queuing time
diff --git a/lib/chef/provisioning/driver_init/docker.rb b/lib/chef/provisioning/driver_init/docker.rb index abc1234..def5678 100644 --- a/lib/chef/provisioning/driver_init/docker.rb +++ b/lib/chef/provisioning/driver_init/docker.rb @@ -1,3 +1,3 @@ require 'chef/provisioning/docker_driver/driver' -ChefMetal.register_driver_class('docker', Chef::Provisioning::DockerDriver::Driver) +Chef::Provisioning.register_driver_class('docker', Chef::Provisioning::DockerDriver::Driver)
Update from ChefMetal to Chef::Provisioning Signed-off-by: David Crosby <f7d7cb7f72d0fb8b54dea8a8286127a99c2eb292@gmail.com>
diff --git a/test/factories/users.rb b/test/factories/users.rb index abc1234..def5678 100644 --- a/test/factories/users.rb +++ b/test/factories/users.rb @@ -1,6 +1,10 @@ FactoryGirl.define do + sequence :name do |n| + "user-#{n}" + end + factory :user do - name "Daaaaaaave" + name end factory :policy_writer, parent: :user, aliases: [:author, :fact_check_requestor] do
Use different names for each test user I found it confusing when a test comparing two users failed, and both user names were Daaaaaave
diff --git a/lib/rpush/daemon/dispatcher/apnsp8_http2.rb b/lib/rpush/daemon/dispatcher/apnsp8_http2.rb index abc1234..def5678 100644 --- a/lib/rpush/daemon/dispatcher/apnsp8_http2.rb +++ b/lib/rpush/daemon/dispatcher/apnsp8_http2.rb @@ -8,6 +8,7 @@ URLS = { production: 'https://api.push.apple.com', development: 'https://api.sandbox.push.apple.com', + sandbox: 'https://api.sandbox.push.apple.com' } DEFAULT_TIMEOUT = 60
Add sandbox because it is allowed in the client validation
diff --git a/lib/smart_answer/calculators/rates_query.rb b/lib/smart_answer/calculators/rates_query.rb index abc1234..def5678 100644 --- a/lib/smart_answer/calculators/rates_query.rb +++ b/lib/smart_answer/calculators/rates_query.rb @@ -14,7 +14,7 @@ end def rates(date = nil) - date = date || date_from_environment_variable || Date.today + date = date || SmartAnswer::DateHelper.current_day relevant_rates = data.find do |rates_hash| rates_hash[:start_date] <= date && rates_hash[:end_date] >= date end @@ -22,12 +22,5 @@ OpenStruct.new(relevant_rates) end - - private - - def date_from_environment_variable - return nil if ENV['RATES_QUERY_DATE'].blank? - Date.parse(ENV['RATES_QUERY_DATE']) - end end end
Use DateHelper to retrieve the reference date Refactor to use the new current_day function in DateHelper to reduce duplication of code.
diff --git a/bosh-director/db/migrations/director/20160210201838_denormalize_compiled_package_stemcell_id_to_stemcell_name_and_version.rb b/bosh-director/db/migrations/director/20160210201838_denormalize_compiled_package_stemcell_id_to_stemcell_name_and_version.rb index abc1234..def5678 100644 --- a/bosh-director/db/migrations/director/20160210201838_denormalize_compiled_package_stemcell_id_to_stemcell_name_and_version.rb +++ b/bosh-director/db/migrations/director/20160210201838_denormalize_compiled_package_stemcell_id_to_stemcell_name_and_version.rb @@ -16,11 +16,15 @@ ) end - if [:mysql2, :mysql].include?(adapter_scheme) - foreign_key = foreign_key_list(:compiled_packages).find { |constraint| constraint.fetch(:columns) == [:stemcell_id] }.fetch(:name) - alter_table(:compiled_packages) do - drop_constraint(foreign_key, {type: :foreign_key}) - end + foreign_key = foreign_key_list(:compiled_packages).find { |constraint| constraint.fetch(:columns) == [:stemcell_id] }.fetch(:name) + build_index = indexes(:compiled_packages).find { |_, value| value.fetch(:columns) == [:package_id, :stemcell_id, :build] }.first + dependency_key_index = indexes(:compiled_packages).find { |_, value| value.fetch(:columns) == [:package_id, :stemcell_id, :dependency_key_sha1] }.first + alter_table(:compiled_packages) do + drop_constraint(foreign_key, :type=>:foreign_key) + drop_constraint(build_index) + add_index [:package_id, :stemcell_os, :stemcell_version, :build], unique: true, name: 'package_stemcell_build_idx' + add_index [:package_id, :stemcell_os, :stemcell_version, :dependency_key_sha1], unique: true, name: 'package_stemcell_dependency_idx' + drop_index(nil, :name=>dependency_key_index) end alter_table(:compiled_packages) do
Fix foreign key and unique constraints [#113954017](https://www.pivotaltracker.com/story/show/113954017) Signed-off-by: Danny Berger <8efccf38e9d8f361e1973ad644e1b1e50ad8ecfe@pivotal.io>
diff --git a/robot_sweatshop.gemspec b/robot_sweatshop.gemspec index abc1234..def5678 100644 --- a/robot_sweatshop.gemspec +++ b/robot_sweatshop.gemspec @@ -12,6 +12,8 @@ gem.test_files = `git ls-files -- kintama/**/*`.split("\n") gem.executables = `git ls-files -- bin/sweatshop`.split("\n").map { |f| File.basename(f) } + gem.required_ruby_version = '~> 2.1' + gem.add_runtime_dependency 'sinatra' gem.add_runtime_dependency 'ezmq' gem.add_runtime_dependency 'faker'
Make sure we can use the syntax we need
diff --git a/tests/hp/requests/storage/object_tests.rb b/tests/hp/requests/storage/object_tests.rb index abc1234..def5678 100644 --- a/tests/hp/requests/storage/object_tests.rb +++ b/tests/hp/requests/storage/object_tests.rb @@ -0,0 +1,64 @@+Shindo.tests('Fog::Storage[:hp] | object requests', [:hp]) do + + @directory = Fog::Storage[:hp].directories.create(:key => 'fogobjecttests') + @dir_name = @directory.identity + + tests('success') do + + tests("#put_object(#{@dir_name}, 'fog_object')").succeeds do + Fog::Storage[:hp].put_object(@dir_name, 'fog_object', lorem_file) + end + + tests("#get_object(#{@dir_name}, 'fog_object')").succeeds do + Fog::Storage[:hp].get_object(@dir_name, 'fog_object') + end + + tests("#get_object(#{@dir_name}, 'fog_object', &block)").returns(lorem_file.read) do + data = '' + Fog::Storage[:hp].get_object(@dir_name, 'fog_object') do |chunk, remaining_bytes, total_bytes| + data << chunk + end + data + end + + tests("#head_object(#{@dir_name}, 'fog_object')").succeeds do + Fog::Storage[:hp].head_object(@dir_name, 'fog_object') + end + + tests("#delete_object(#{@dir_name}, 'fog_object')").succeeds do + Fog::Storage[:hp].delete_object(@dir_name, 'fog_object') + end + + end + + tests('failure') do + + tests("#get_object(#{@dir_name}, 'fog_non_object')").raises(Fog::Storage::HP::NotFound) do + Fog::Storage[:hp].get_object(@dir_name, 'fog_non_object') + end + + tests("#get_object('fognoncontainer', 'fog_non_object')").raises(Fog::Storage::HP::NotFound) do + Fog::Storage[:hp].get_object('fognoncontainer', 'fog_non_object') + end + + tests("#head_object(#{@dir_name}, 'fog_non_object')").raises(Fog::Storage::HP::NotFound) do + Fog::Storage[:hp].head_object(@dir_name, 'fog_non_object') + end + + tests("#head_object('fognoncontainer', 'fog_non_object')").raises(Fog::Storage::HP::NotFound) do + Fog::Storage[:hp].head_object('fognoncontainer', 'fog_non_object') + end + + tests("#delete_object(#{@dir_name}, 'fog_non_object')").raises(Fog::Storage::HP::NotFound) do + Fog::Storage[:hp].delete_object(@dir_name, 'fog_non_object') + end + + tests("#delete_object('fognoncontainer', 'fog_non_object')").raises(Fog::Storage::HP::NotFound) do + Fog::Storage[:hp].delete_object('fognoncontainer', 'fog_non_object') + end + + end + + @directory.destroy + +end
Add object tests for storage.
diff --git a/app/serializers/api/admin/customer_serializer.rb b/app/serializers/api/admin/customer_serializer.rb index abc1234..def5678 100644 --- a/app/serializers/api/admin/customer_serializer.rb +++ b/app/serializers/api/admin/customer_serializer.rb @@ -14,7 +14,8 @@ end def balance - OpenFoodNetwork::UserBalanceCalculator.new(object.email, object.enterprise).balance + balance = OpenFoodNetwork::UserBalanceCalculator.new(object.email, object.enterprise).balance + Spree::Money.new(balance, { currency: Spree::Config[:currency] }).to_s end def tags
Make customer balance serialize with the currency
diff --git a/app/controllers/admin/locations_controller.rb b/app/controllers/admin/locations_controller.rb index abc1234..def5678 100644 --- a/app/controllers/admin/locations_controller.rb +++ b/app/controllers/admin/locations_controller.rb @@ -1,5 +1,5 @@ class Admin::LocationsController < AdminController - before_action :set_location, only: [:edit, :destroy, :update] + before_action :set_location, only: [:edit, :update] def index @locations = Location.order('created_at desc').paginate(:page => params[:page])
Remove before_action on action forbidding in routing
diff --git a/app/controllers/authentications_controller.rb b/app/controllers/authentications_controller.rb index abc1234..def5678 100644 --- a/app/controllers/authentications_controller.rb +++ b/app/controllers/authentications_controller.rb @@ -3,7 +3,7 @@ def create if person = Person.authenticate(params[:authentication][:email], params[:authentication][:password]) - render xml: person.to_xml(except: %w(salt encrypted_password feed_code api_key)), status: 201 + render xml: person.to_xml(except: %w(salt encrypted_password password_salt password_hash feed_code api_key)), status: 201 elsif person.nil? render plain: t('session.email_not_found'), status: 404 else
Exclude password fields from authentication api
diff --git a/app/models/applicant.rb b/app/models/applicant.rb index abc1234..def5678 100644 --- a/app/models/applicant.rb +++ b/app/models/applicant.rb @@ -40,8 +40,14 @@ when /^LL(\d+)(.*)$/ index = $1.to_i - 1 delegate_field_to landlords[index], $2 + when "Today" + Date.today + when "Now" + now = Time.now + "%d:%d" % [now.hour, now.sec] else identity.value_for_field(field_name) end end + end
Add fields "Today" and "Now"
diff --git a/test/minitest_helper.rb b/test/minitest_helper.rb index abc1234..def5678 100644 --- a/test/minitest_helper.rb +++ b/test/minitest_helper.rb @@ -9,7 +9,7 @@ # Avoid OpenSSL certificate verify failed error if ENV.has_key?('APPVEYOR') && Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.4') require 'openssl' - OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NON + OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE end VCR.configure do |c|
[CI] Fix typo for AppVeyor OpenSSL error
diff --git a/lib/salesforce_bulk/batch_result_collection.rb b/lib/salesforce_bulk/batch_result_collection.rb index abc1234..def5678 100644 --- a/lib/salesforce_bulk/batch_result_collection.rb +++ b/lib/salesforce_bulk/batch_result_collection.rb @@ -1,35 +1,28 @@ module SalesforceBulk class BatchResultCollection < Array - attr_reader :client - attr_reader :currentIndex attr_reader :batchId attr_reader :jobId - attr_reader :resultIds - def initialize(client, jobId, batchId, resultIds) #previousResultId, nextResultId, currentResultId - @client = client + def initialize(jobId, batchId) @jobId = jobId @batchId = batchId - @resultIds = resultIds - @currentIndex = resultIds.first - end - def next? - + def any_failures? + self.any? { |result| result.error.length > 0 } end - def next - + def failed + self.select { |result| result.error.length > 0 } end - def previous? - + def completed + self.select { |result| result.success } end - def previous - + def created + self.select { |result| result.success && result.created } end end
Remove unnecessary properties and methods. Add possible helper methods. Not sure yet if we'll stick with using this class. Might not really be necessary or all that helpful if we have the right helpers on the BatchResult class.
diff --git a/Casks/font-fontawesome.rb b/Casks/font-fontawesome.rb index abc1234..def5678 100644 --- a/Casks/font-fontawesome.rb +++ b/Casks/font-fontawesome.rb @@ -1,8 +1,8 @@ cask :v1 => 'font-fontawesome' do - version '4.2.0' - sha256 'b68b47c5e6da744fc78393eeae0cb16e3844a76b505855c99ff50e99c680b5c0' + version '4.3.0' + sha256 '8c3a524adc9a57b4d545fb3565d94cdb956dc13306ff94ba1c3fee6fffc7a60e' - url "https://github.com/FortAwesome/Font-Awesome/archive/v4.2.0.zip" + url "https://github.com/FortAwesome/Font-Awesome/archive/v#{version}.zip" homepage 'http://fortawesome.github.io/Font-Awesome/' license :oss
Update font-awesome to version 4.3.0 from 4.2.0
diff --git a/beerded_happiness/spec/controllers/event_spec.rb b/beerded_happiness/spec/controllers/event_spec.rb index abc1234..def5678 100644 --- a/beerded_happiness/spec/controllers/event_spec.rb +++ b/beerded_happiness/spec/controllers/event_spec.rb @@ -2,6 +2,8 @@ require 'spec_helper' describe EventsController do + let(:user) { User.create(name: "numichuu", password: "test", password_confirmation: "test", phone_number: "123-123-1234", email:"numichuu@gmail.com")} + let(:new_event) { Event.create(title: "BeerFest", status: "Active", creator_id: user.id) } describe "#index" do it "renders the index template" do
Add one test for event show
diff --git a/app/tasks/fetch_feed.rb b/app/tasks/fetch_feed.rb index abc1234..def5678 100644 --- a/app/tasks/fetch_feed.rb +++ b/app/tasks/fetch_feed.rb @@ -13,7 +13,7 @@ def fetch begin - raw_feed = @parser.fetch_and_parse(@feed.url, user_agent: "Stringer") + raw_feed = @parser.fetch_and_parse(@feed.url, user_agent: "Stringer", if_modified_since: @feed.last_fetched) new_entries_from(raw_feed).each do |entry| StoryRepository.add(entry, @feed)
Use If-Modified-Since Header when refreshing feeds Fetch feeds with the If-Modified-Since HTTP header set to the last refresh timestamp. This should save us (and the feed providers) quite some traffic since we don't have the fetch the whole feed when the content hasn't changed
diff --git a/dataflow.rb b/dataflow.rb index abc1234..def5678 100644 --- a/dataflow.rb +++ b/dataflow.rb @@ -1,4 +1,4 @@-require 'thread' +require 'monitor' module Dataflow def self.included(cls) @@ -22,28 +22,30 @@ end class Variable - MUTEX = Mutex.new instance_methods.each { |m| undef_method m unless m =~ /^__/ } + LOCK = Monitor.new def initialize - @__requesters__ = [] + @__binding__ = LOCK.new_cond end def __unify__(value) - MUTEX.synchronize do - raise UnificationError if @__value__ && @__value__ != value - @__value__ = value - while r = @__requesters__.shift - r.wakeup if r.status == 'sleep' + LOCK.synchronize do + if @__value__ + raise UnificationError if @__value__ != value + else + @__value__ = value + @__binding__.broadcast # wakeup all method callers + @__binding__ = nil # garbage collect condition end - @__value__ end + @__value__ end def method_missing(name, *args, &block) - MUTEX.synchronize do - @__requesters__ << Thread.current unless @__value__ - end - sleep unless @__value__ + # double-checked race condition to avoid going into synchronize + LOCK.synchronize do + @__binding__.wait unless @__value__ + end unless @__value__ @__value__.__send__(name, *args, &block) end end
Use monitors for handling locking and waiting
diff --git a/spec/integration/auth_spec.rb b/spec/integration/auth_spec.rb index abc1234..def5678 100644 --- a/spec/integration/auth_spec.rb +++ b/spec/integration/auth_spec.rb @@ -31,10 +31,12 @@ it 'should show registration page at /register' do visit '/register' + expect(page).to have_content 'Register new account' end it 'should show login page at /login' do visit '/login' + expect(page).to have_content 'Log in' end it 'should refuse registration with a bad key' do
Make sure login and register pages have certain words
diff --git a/spec/features/admin/groups_spec.rb b/spec/features/admin/groups_spec.rb index abc1234..def5678 100644 --- a/spec/features/admin/groups_spec.rb +++ b/spec/features/admin/groups_spec.rb @@ -39,4 +39,18 @@ flash_notice!("The selected group has been deleted.") end end + + context "removing user from the group" do + before do + user = FactoryGirl.create(:user) + group = FactoryGirl.create(:group) + group.members << user + visit admin_group_path(Forem::Group.find_by_id(group.id)) + end + + specify do + click_link "Remove member" + flash_notice!("The selected user has been removed from the group.") + end + end end
Test for removing users from groups
diff --git a/spec/features/submit_paper_spec.rb b/spec/features/submit_paper_spec.rb index abc1234..def5678 100644 --- a/spec/features/submit_paper_spec.rb +++ b/spec/features/submit_paper_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -feature "Submitting a paper", js: true do +feature "Submitting a paper", js: true, selenium: true do before do sign_in_page = SignInPage.visit sign_in_page.sign_in author
Tag addtional spec with selenium
diff --git a/test/integration/user-install/serverspec/rvm_spec.rb b/test/integration/user-install/serverspec/rvm_spec.rb index abc1234..def5678 100644 --- a/test/integration/user-install/serverspec/rvm_spec.rb +++ b/test/integration/user-install/serverspec/rvm_spec.rb @@ -1,14 +1,18 @@ require 'spec_helper' -rvm_init_script = File.join('', 'home', 'vagrant', '.profile' ) +rvm_init_script = File.join('', 'home', 'vagrant', '.rvm', 'scripts', 'rvm' ) +rvm_home_profile = File.join('', 'home', 'vagrant', '.profile' ) rvm_default_ruby = 'ruby-2.2.2' -describe file( rvm_init_script ) do - it { should be_file } - it { should be_owned_by 'vagrant' } - it { should be_grouped_into 'vagrant' } - it { should be_mode 664 } - its(:content) { should match /RVM/ } +[ rvm_init_script, + rvm_home_profile +].each do |rvm_file| + describe file( rvm_file ) do + it { should be_file } + it { should be_owned_by 'vagrant' } + it { should be_grouped_into 'vagrant' } + its(:content) { should match /RVM/ } + end end describe command("su - vagrant -c 'rvm version'") do
Fix RVM single-user install file spec tests
diff --git a/govuk_template.gemspec b/govuk_template.gemspec index abc1234..def5678 100644 --- a/govuk_template.gemspec +++ b/govuk_template.gemspec @@ -25,5 +25,4 @@ spec.add_development_dependency 'gem_publisher', '1.3.0' spec.add_development_dependency 'gemfury', '0.4.17' spec.add_development_dependency 'rspec', '2.14.1' - spec.add_development_dependency 'pry-debugger', '0.2.2' end
Remove pry-debugger as a dev dependency. It's not a required dependency, so probaboy shouldn't be listed here...
diff --git a/test/lib/generators/jsonapi/resource_generator_test.rb b/test/lib/generators/jsonapi/resource_generator_test.rb index abc1234..def5678 100644 --- a/test/lib/generators/jsonapi/resource_generator_test.rb +++ b/test/lib/generators/jsonapi/resource_generator_test.rb @@ -14,7 +14,12 @@ test "resource is created" do run_generator ["post"] - assert_file 'app/resources/post_resource.rb' + assert_file 'app/resources/post_resource.rb', /class PostResource < JSONAPI::Resource/ + end + + test "resource is created with namespace" do + run_generator ["api/v1/post"] + assert_file 'app/resources/api/v1/post_resource.rb', /class Api::V1::PostResource < JSONAPI::Resource/ end end end
Add tests to check for regex
diff --git a/db/seeds.rb b/db/seeds.rb index abc1234..def5678 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -11,19 +11,38 @@ unless Rails.env == 'production' dummy = User.create( username: 'dummy', - email: 'email@example.com', + email: 'dummy1@example.com', password: 'password', password_confirmation: 'password', confirmed_at: Time.zone.today ) dummy.profile = Profile.new( - name: 'Dummy User', + name: 'Dummy First', bio: 'Dummies do what dummies can', work_company: 'Dummy Corp', work_title: 'Chief Dummy Officer', location: 'Dummisvilee', - twitter_username: 'dumdumdumdu', + twitter_username: 'dumdum1', rate: 1 ) + + dummy2 = User.create( + username: 'dummy2', + email: 'dummy2@example.com', + password: 'password', + password_confirmation: 'password', + confirmed_at: Time.zone.today + ) + + dummy2.profile = Profile.new( + name: 'Dummy First', + bio: 'Dummies do what dummies can', + work_company: 'Dummy Corp', + work_title: 'Chief Dummy Officer', + location: 'Dummisvilee', + twitter_username: 'dumdum2', + rate: 1 + ) + end
Add a second dummy user
diff --git a/services/gecko_board.rb b/services/gecko_board.rb index abc1234..def5678 100644 --- a/services/gecko_board.rb +++ b/services/gecko_board.rb @@ -11,25 +11,21 @@ raise_config_error "Error sending GeckoBoard message: #{$!}" end - def deliver(token, widget_key, count) + def deliver(token, widget_key, value) # http://docs.geckoboard.com/api/push.html res = http_post URI.join("https://push.geckoboard.com/v1/send/", token).to_s do |req| req.headers[:content_type] = 'application/json' req.body = { :api_key => widget_key, - :item => [ - { - :text => "", - :value => count - } - ], - :item => [ - { - :text => "", - :value => count - } - ] + :data => { + :item => [ + { + :text => "", + :value => value + } + ] + } }.to_json end
Adjust in light of lack of state
diff --git a/lib/buoys/link.rb b/lib/buoys/link.rb index abc1234..def5678 100644 --- a/lib/buoys/link.rb +++ b/lib/buoys/link.rb @@ -40,8 +40,8 @@ CONFIG.merge(options_for_config) end - def extract_options_and_config(_options) - options = _options.with_indifferent_access + def extract_options_and_config(opts) + options = opts.with_indifferent_access config = (options.keys & CONFIG.keys).each_with_object({}) {|key, hash| hash[key] = options.delete(key) }
Fix `Do not use prefix _ for a variable that is used.`
diff --git a/lib/buoys/link.rb b/lib/buoys/link.rb index abc1234..def5678 100644 --- a/lib/buoys/link.rb +++ b/lib/buoys/link.rb @@ -1,9 +1,18 @@ module Buoys class Link attr_accessor :text, :url, :options + attr_reader :current def initialize(text, url, options) @text, @url, @options = text, url, options end + + def mark_as_current! + @current = true + end + + def current? + !!@current + end end end
Add methods to Buoys::Link class To judge and decide the Link is the end of breadcrumbs
diff --git a/lib/hato/httpd.rb b/lib/hato/httpd.rb index abc1234..def5678 100644 --- a/lib/hato/httpd.rb +++ b/lib/hato/httpd.rb @@ -23,13 +23,17 @@ class App < Sinatra::Base enable :logging - before do - if settings.api_key != params[:api_key] + before '/.+' do + if settings.api_key && (settings.api_key != params[:api_key]) halt 403, JSON.dump( status: :error, message: 'API key is wrong. Confirm your API key setting of server/client.', ) end + end + + get '/' do + 'Hato https://github.com/kentaro/hato' end post "/notify" do
Allow users to visit to '/' without API key;;
diff --git a/lib/keen/async.rb b/lib/keen/async.rb index abc1234..def5678 100644 --- a/lib/keen/async.rb +++ b/lib/keen/async.rb @@ -0,0 +1,6 @@+require 'keen/async/storage/base_storage_handler' +require 'keen/async/storage/redis_handler' +require 'keen/async/storage/flat_file_handler' +require 'keen/async/job' +require 'keen/async/worker' +
Add a package manager file for Async
diff --git a/lib/space_cats.rb b/lib/space_cats.rb index abc1234..def5678 100644 --- a/lib/space_cats.rb +++ b/lib/space_cats.rb @@ -7,7 +7,7 @@ def get_cat_url begin - parse_url_from_string(File.open(get_random_space_cat_file)) + parse_url_from_file(File.open(get_random_space_cat_file)) rescue return pizza_cat_url end @@ -23,7 +23,7 @@ Dir["#{ File.join(File.dirname(File.dirname(__FILE__)), 'omgcatsinspace') }/*"] end - def parse_url_from_string(file) + def parse_url_from_file(file) file.read.split.grep(/http[s]?:\/\/\w/).first end
Rename method so it's more descriptive.
diff --git a/lib/tasks/db.rake b/lib/tasks/db.rake index abc1234..def5678 100644 --- a/lib/tasks/db.rake +++ b/lib/tasks/db.rake @@ -0,0 +1,53 @@+namespace :db do + desc 'Dump the database to db/<time>._<name>.pgsql_dump' + task dump: :environment do + cmd = nil + f_name = nil + with_config do |_app, host, db, user, pass| + f_name = "#{Rails.root}/db/#{Time.now.strftime('%Y%m%d%H%M%S')}_#{db}.psql_dump" + cmd = "PGPASSWORD='#{pass}' pg_dump -F c -v -h '#{host}' -U '#{user}' -f '#{f_name}' #{db}" + end + puts "Backing up to #{f_name} ..." + puts cmd + exec cmd + end + + desc 'Restore the database dump; NOTE: The current database will be dropped!' + task :restore, [:date] => :environment do |_task, args| + cmd = nil + f_name = nil + date = args.date + with_config do |_app, host, db, user, pass| + unless date.present? + STDERR.puts 'ERROR: Please choose a date from the available backup files:' + system("set -o pipefail && ls -1 #{Rails.root}/db/*_#{db}.psql_dump | sed -E 's/.+\\/([0-9]+)_.+/ \\1/'") || + fail_with_msg("Failed to list files. Check in #{Rails.root}/db/ for your available dumps") + print 'Date: ' + date = STDIN.gets.strip + end + f_name = "#{Rails.root}/db/#{date}_#{db}.psql_dump" + cmd = "PGPASSWORD='#{pass}' pg_restore -F c -v -h '#{host}' -U '#{user}' -d #{db} -c -C #{f_name}" + end + puts 'Dropping the current database first...' + Rake::Task['db:drop'].invoke + Rake::Task['db:create'].invoke + puts "Restoring database from #{f_name} ..." + puts cmd + exec cmd + end + + private + + def with_config + yield Rails.application.class.parent_name.underscore, + ActiveRecord::Base.connection_config[:host], + ActiveRecord::Base.connection_config[:database], + ActiveRecord::Base.connection_config[:username], + ActiveRecord::Base.connection_config[:password] + end + + def fail_with_msg(msg, code = 1) + STDERR.puts('ERROR: ' + msg) + exit code + end +end
Add database backup rake task
diff --git a/lib/turbo_urls.rb b/lib/turbo_urls.rb index abc1234..def5678 100644 --- a/lib/turbo_urls.rb +++ b/lib/turbo_urls.rb @@ -22,6 +22,13 @@ def self.i_m_your_turbo_lover! mod = Rails.application.routes.named_routes.path_helpers_module mod.prepend TurboUrls::Interceptor + + (mod.public_instance_methods - Module.instance_methods).each do |meth| + TurboUrls::Interceptor.module_eval do + define_method meth, TurboUrls::Interceptor::CACHE_LOOKUP + end + end + def mod.method_added(meth) TurboUrls::Interceptor.module_eval do define_method meth, TurboUrls::Interceptor::CACHE_LOOKUP
Prepend the cache lookup to already defined _path methods
diff --git a/web.rb b/web.rb index abc1234..def5678 100644 --- a/web.rb +++ b/web.rb @@ -8,11 +8,18 @@ post '/possible-matches' do begin + if params[:peptide_sequence] == "" + return { 'possible_sequences' => 'missing peptide sequence' }.to_json + end + if params[:weight] == "NaN" + return { 'possible_sequences' => 'missing weight' }.to_json + end + mass_type = MassTypes.parse params[:mass_type] # TODO: Reject if no tolerance value given tolerance = params[:tolerance].to_f if tolerance < 5 - { 'possible_sequences' => 'error: tolerance below 5 Da' }.to_json + { 'possible_sequences' => 'error: tolerance below 5 Da' }.to_json end residues = AminoAcids.new(mass_type).residues p = Peptide.new params[:peptide_sequence], residues, params[:wildcards] || {}
Check for peptide sequence and found weight
diff --git a/PactConsumerSwift.podspec b/PactConsumerSwift.podspec index abc1234..def5678 100644 --- a/PactConsumerSwift.podspec +++ b/PactConsumerSwift.podspec @@ -19,7 +19,7 @@ s.source_files = 'PactConsumerSwift/**/*.swift' s.resources = 'scripts/start_server.sh', 'scripts/stop_server.sh' s.requires_arc = true - s.frameworks = 'Foundation', 'UIKit' + s.frameworks = 'Foundation', 'UIKit', 'XCTest' s.requires_arc = true
Add XCTest framework to podspec.
diff --git a/PactConsumerSwift.podspec b/PactConsumerSwift.podspec index abc1234..def5678 100644 --- a/PactConsumerSwift.podspec +++ b/PactConsumerSwift.podspec @@ -16,7 +16,7 @@ s.platform = :ios, "8.0" s.source = { :git => "https://github.com/DiUS/pact-consumer-swift.git", :tag => s.version } - s.source_files = 'PactConsumerSwift/**/*.swift' + s.source_files = 'PactConsumerSwift/**/*.swift', 'scripts/start_server.sh', 'scripts/stop_server.sh' s.requires_arc = true s.frameworks = 'Foundation', 'UIKit'
Include pact server scripts in cocoapod.
diff --git a/RCDraggableButton.podspec b/RCDraggableButton.podspec index abc1234..def5678 100644 --- a/RCDraggableButton.podspec +++ b/RCDraggableButton.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |s| s.name = "RCDraggableButton" - s.version = “0.2” - s.summary = "A draggable button that appears in your view.” + s.version = "0.2" + s.summary = "A draggable button that appears in your view." s.homepage = "https://github.com/RidgeCorn/RCDraggableButton" s.license = { :type => "MIT", :file => "LICENSE" } s.authors = { "Looping" => "www.looping@gmail.com" } @@ -9,7 +9,7 @@ s.platform = :ios, '5.0' s.ios.deployment_target = '5.0' - s.source = { :git => "https://github.com/RidgeCorn/RCDraggableButton.git", :tag => “0.2” } + s.source = { :git => "https://github.com/RidgeCorn/RCDraggableButton.git", :tag => "0.2" } s.source_files = 'RCDraggableButton' s.public_header_files = 'RCDraggableButton/*.h'
Fix fancy quotes that cause Travis CI build failed while submit to CocoaPods.
diff --git a/SHOmniAuthTwitter.podspec b/SHOmniAuthTwitter.podspec index abc1234..def5678 100644 --- a/SHOmniAuthTwitter.podspec +++ b/SHOmniAuthTwitter.podspec @@ -19,8 +19,8 @@ s.source_files = 'SHOmniAuthTwitter/**/*.{h,m}' s.requires_arc = true - s.dependency 'TWReverseAuth' - s.dependency 'AFOAuth1Client' + s.dependency 'TWReverseAuth', '~>0.1.0' + s.dependency 'AFOAuth1Client', '~> 0.2.0' s.dependency 'SHOmniAuth', '~> 0.1.0' end
Fix breaking changes (use scope) Set dependency versions
diff --git a/little_printer.rb b/little_printer.rb index abc1234..def5678 100644 --- a/little_printer.rb +++ b/little_printer.rb @@ -1,9 +1,15 @@+require 'httparty' + class LittlePrinter + def initialize(code) @code = code end def message(msg) - `curl -X POST -d "html=<html><head><meta charset='utf-8'></head><body><p>#{msg}</p></body></html>" http://remote.bergcloud.com/playground/direct_print/#{@code}` + url = "http://remote.bergcloud.com/playground/direct_print/#{@code}" + HTTParty.post(url, :body => {:html => "<html><head><meta charset='utf-8'></head><body><p>#{msg}</p></body></html>"}) + puts "Sent message: #{msg}" + #`curl -X POST -d "html=<html><head><meta charset='utf-8'></head><body><p>#{msg}</p></body></html>" http://remote.bergcloud.com/playground/direct_print/#{@code}` end end
Use HTTPParty instead of CURL
diff --git a/test-gir.rb b/test-gir.rb index abc1234..def5678 100644 --- a/test-gir.rb +++ b/test-gir.rb @@ -1,27 +1,33 @@ require 'ffi' module GLib - extend FFI::Library - - class GType + private + module Lib extend FFI::Library ffi_lib "gobject-2.0" attach_function :g_type_init, [], :void - def self.init; g_type_init; end + end + + public + class GType + def self.init; Lib::g_type_init; end end end -module GObjectIntrospection - extend FFI::Library +module GI + private - ffi_lib "girepository-1.0" + module Lib + extend FFI::Library + ffi_lib "girepository-1.0" + attach_function :g_irepository_get_default, [], :pointer + end + + public class Repository - extend FFI::Library - - attach_function :g_irepository_get_default, [], :pointer def self.get_default - @@singleton ||= Repository.new(g_irepository_get_default) + @@singleton ||= Repository.new(Lib::g_irepository_get_default) end private @@ -34,5 +40,5 @@ GLib::GType.init -gir = GObjectIntrospection::Repository.get_default +gir = GI::Repository.get_default p gir
Put FFI stuff in private modules.
diff --git a/spec/factories/turns.rb b/spec/factories/turns.rb index abc1234..def5678 100644 --- a/spec/factories/turns.rb +++ b/spec/factories/turns.rb @@ -3,6 +3,5 @@ association :player, factory: :user association :round, factory: :round seconds_remaining 60 - cards_won 0 end end
Fix tests for turn to reflect deletion of cards_won
diff --git a/spec/middleware_spec.rb b/spec/middleware_spec.rb index abc1234..def5678 100644 --- a/spec/middleware_spec.rb +++ b/spec/middleware_spec.rb @@ -16,5 +16,18 @@ middleware.should_receive(:serve_from_escrow?).with(env_pass) middleware.call env_pass end + + context 'when request is not served from escrow' do + it 'should check whether to serve a request from escrow' do + middleware.should_receive(:keep_in_escrow?).with(env_pass) + middleware.call env_pass + end + + context 'when request does not interact with escrow' do + it 'should return response from app' do + middleware.call(env_pass).should == app.call(env_pass) + end + end + end end
Test pass-through to Rails application
diff --git a/spec/controllers/locales_controller_spec.rb b/spec/controllers/locales_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/locales_controller_spec.rb +++ b/spec/controllers/locales_controller_spec.rb @@ -8,14 +8,14 @@ context 'tries not supported fr locale' do it 'falls back do default locale' do - get :index, locale: 'fr' + get :index, params: { locale: 'fr' } expect(I18n.locale).to eq :en end end context 'tries supported es locale' do it 'takes this locale' do - get :index, locale: 'es' + get :index, params: { locale: 'es' } expect(I18n.locale).to eq :es end end
Fix failed build on master
diff --git a/sprockets-rails.gemspec b/sprockets-rails.gemspec index abc1234..def5678 100644 --- a/sprockets-rails.gemspec +++ b/sprockets-rails.gemspec @@ -11,8 +11,10 @@ s.add_dependency "sprockets", [">= 2.8", "< 4.0"] s.add_dependency "actionpack", ">= 3.0" s.add_dependency "activesupport", ">= 3.0" + s.add_development_dependency "railties", ">= 3.0" s.add_development_dependency "rake" - s.add_development_dependency "railties", ">= 3.0" + s.add_development_dependency "sass" + s.add_development_dependency "uglifier" s.author = "Joshua Peek" s.email = "josh@joshpeek.com"
Load sass and uglifier as test deps
diff --git a/providers/apt_key.rb b/providers/apt_key.rb index abc1234..def5678 100644 --- a/providers/apt_key.rb +++ b/providers/apt_key.rb @@ -17,7 +17,7 @@ action :add do newkey = new_resource.key - execute "Adding APT repository key #{newkey}" do + execute "Adding APT repository key" do command "echo '#{newkey}' | apt-key add -" end end @@ -25,7 +25,7 @@ action :remove do keyid = new_resource.key - execute "Remove APT repository key #{keyid}" do + execute "Remove APT repository key" do command "apt-key del #{keyid}" ignore_failure true # If the key does not exist, it should not break the chef run end
Remove repository key contents from chef output
diff --git a/app/helpers/spree/products_helper_decorator.rb b/app/helpers/spree/products_helper_decorator.rb index abc1234..def5678 100644 --- a/app/helpers/spree/products_helper_decorator.rb +++ b/app/helpers/spree/products_helper_decorator.rb @@ -3,7 +3,8 @@ def property_value_for(product, property) return nil unless property = product.properties.find_by_name(property) - property.value + return nil unless product_properties = product.product_properties.find_by_property_id(proterty.id) + product_properties.value end end
Add brand to product title.
diff --git a/app/importers/file_importers/csv_downloader.rb b/app/importers/file_importers/csv_downloader.rb index abc1234..def5678 100644 --- a/app/importers/file_importers/csv_downloader.rb +++ b/app/importers/file_importers/csv_downloader.rb @@ -15,7 +15,7 @@ log("file_contents.size: #{file_contents.size}") if file_contents.size == 0 - raise "CsvDownloader: size of #{remote_file_name} is 0 bytes" + raise "CsvDownloader: size of #{@remote_file_name} is 0 bytes" end log('Transforming...')
Raise on zero byte CSV
diff --git a/db/migrate/20090803194614_add_pcguid_to_sites.rb b/db/migrate/20090803194614_add_pcguid_to_sites.rb index abc1234..def5678 100644 --- a/db/migrate/20090803194614_add_pcguid_to_sites.rb +++ b/db/migrate/20090803194614_add_pcguid_to_sites.rb @@ -1,9 +1,9 @@ class AddPcguidToSites < ActiveRecord::Migration def self.up - add_column :sites, :pc_guid, :string, :default => "0" + add_column :sites, :external_guid, :string, :default => "0" end def self.down - remove_column :sites, :pc_guid + remove_column :sites, :external_guid end end
Update migration for external_guid in sites table Signed-off-by: Tim Morgan <5ee0edb9e2229c0838f1959779f1949031de0123@timmorgan.org>
diff --git a/webapp/config/deploy.rb b/webapp/config/deploy.rb index abc1234..def5678 100644 --- a/webapp/config/deploy.rb +++ b/webapp/config/deploy.rb @@ -8,6 +8,7 @@ set :scm, :none set :deploy_via, :copy set :copy_exclude, [".git"] +set :copy_compression, :zip depend :remote, :command, "rake" depend :remote, :command, "bundle"
Use zip compression rather than tar + gzip which will default to following symlinks rather than adding the actual symlink to the archive
diff --git a/app.rb b/app.rb index abc1234..def5678 100644 --- a/app.rb +++ b/app.rb @@ -10,7 +10,8 @@ get '/' do headers "Content-Type" => "application/json" Oj.dump({ - "version" => "1.0" + "version" => "1.0", + "source" => "https://github.com/keichan34/premailer-api" }) end
Add link to GitHub page in /
diff --git a/peg.rb b/peg.rb index abc1234..def5678 100644 --- a/peg.rb +++ b/peg.rb @@ -13,4 +13,10 @@ def ==(other_peg) @color_index == other_peg.color_index end + + def hash + @color_index.hash ^ Peg.hash + end + + alias_method :eql?, :== end
Add hash equality to Peg class
diff --git a/spec/controllers/challenges_controller_spec.rb b/spec/controllers/challenges_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/challenges_controller_spec.rb +++ b/spec/controllers/challenges_controller_spec.rb @@ -11,14 +11,14 @@ describe "GET 'show'" do it "returns http success" do - get 'show' + get 'show', id: 1 response.should be_success end end - describe "GET 'answer'" do + describe "POST 'answer'" do it "returns http success" do - get 'answer' + post 'answer', id: 1 response.should be_success end end
Fix controller spec for challenges.
diff --git a/spec/replication/util/schema_structure_spec.rb b/spec/replication/util/schema_structure_spec.rb index abc1234..def5678 100644 --- a/spec/replication/util/schema_structure_spec.rb +++ b/spec/replication/util/schema_structure_spec.rb @@ -4,8 +4,8 @@ expect(ret).to be_nil, <<-EOS.gsub!(/^ +/, "") #{Rails.configuration.database_configuration[Rails.env]["database"]} is not structured as expected. - #{ret} + Refer to http://talk.manageiq.org/t/new-schema-specs-for-new-replication/1404 for detail EOS end end
Add href to explain schema validation spec in error message
diff --git a/rails-footnotes.gemspec b/rails-footnotes.gemspec index abc1234..def5678 100644 --- a/rails-footnotes.gemspec +++ b/rails-footnotes.gemspec @@ -17,6 +17,7 @@ s.add_dependency "rails", ">= 3.2" s.add_development_dependency "rspec-rails", '~> 2.14.0' + s.add_development_dependency "test-unit" s.add_development_dependency "capybara" s.files = `git ls-files`.split("\n")
Add test-unit to dev dependencies in order to run tests with rails 3.2 and ruby 2.2
diff --git a/test/fluffy_paws_test.rb b/test/fluffy_paws_test.rb index abc1234..def5678 100644 --- a/test/fluffy_paws_test.rb +++ b/test/fluffy_paws_test.rb @@ -12,26 +12,19 @@ end def test_index_response_is_ok - get '/' + get '/login' assert last_response.ok? end def test_index_body_contains_custom_title - get '/' - assert_includes last_response.body, 'Holy Smokes!' + get '/login' + assert_includes last_response.body, 'Fluffy Paws' end def test_logout_redirects_to_index get '/logout' follow_redirect! assert last_response.ok? - assert_equal 'http://example.org/', last_request.url - end - - def test_login_redirects_to_index - post '/login' - follow_redirect! - assert last_response.ok? - assert_equal 'http://example.org/', last_request.url + assert_equal 'http://example.org/login', last_request.url end end
Adjust tests for user authorisation changes
diff --git a/spec/output_spec.rb b/spec/output_spec.rb index abc1234..def5678 100644 --- a/spec/output_spec.rb +++ b/spec/output_spec.rb @@ -13,7 +13,7 @@ subject.sources.should match /source 'http:\/\/rubygems\.org'/ end - it '.source returns sources even as symbols' do + it '.source returns sources as symbols' do subject.sources.should match /source \:rubygems/ end
Remove the sound of surprise from the spec.
diff --git a/spec/plugin_spec.rb b/spec/plugin_spec.rb index abc1234..def5678 100644 --- a/spec/plugin_spec.rb +++ b/spec/plugin_spec.rb @@ -17,6 +17,18 @@ expect(subclasses).to eq([TestPluginA, TestPluginB]) end end + + context 'when a plugin supports a list of events' do + before do + allow(subject).to receive(:supported_events).and_return( + [:before_site_generation] + ) + end + + it 'returns true for an event' do + expect(subject.supports_event?(:before_site_generation)).to eq(true) + end + end end describe '#supports_event?' do
Add a test for supported events
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -23,3 +23,24 @@ PuppetlabsSpec::Files.cleanup end end + +require 'pathname' +dir = Pathname.new(__FILE__).parent +Puppet[:modulepath] = File.join(dir, 'fixtures', 'modules') + +# There's no real need to make this version dependent, but it helps find +# regressions in Puppet +# +# 1. Workaround for issue #16277 where default settings aren't initialised from +# a spec and so the libdir is never initialised (3.0.x) +# 2. Workaround for 2.7.20 that now only loads types for the current node +# environment (#13858) so Puppet[:modulepath] seems to get ignored +# 3. Workaround for 3.5 where context hasn't been configured yet, +# ticket https://tickets.puppetlabs.com/browse/MODULES-823 +# +ver = Gem::Version.new(Puppet.version.split('-').first) +if Gem::Requirement.new("~> 2.7.20") =~ ver || Gem::Requirement.new("~> 3.0.0") =~ ver || Gem::Requirement.new("~> 3.5") =~ ver + puts "augeasproviders: setting Puppet[:libdir] to work around broken type autoloading" + # libdir is only a single dir, so it can only workaround loading of one external module + Puppet[:libdir] = "#{Puppet[:modulepath]}/augeasproviders_core/lib" +end
Use modulesync to manage meta files
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -17,7 +17,10 @@ if RUBY_VERSION >= '1.9' and ENV['COVERAGE'] == 'true' require 'simplecov' - SimpleCov.start + SimpleCov.start do + command_name 'spec:unit' + add_filter 'spec' + end end # change the heckle timeout to be 5 seconds
Add simplecov configuration to filter out the spec folder
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -13,10 +13,6 @@ require 'support/database_cleaner' require 'capybara/rspec' require 'capybara/rails' - -Capybara.register_driver :selenium do |app| - Capybara::Selenium::Driver.new(app, :browser => :chrome) -end RSpec.configure do |config| Netzke::Testing.rspec_init(config)
Revert "Move to Chrome for tests" Will have to get to Travis CI later. This reverts commit c1c9edffbce89bbd39249d8fe5e4287c8b94af5f.
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,5 +1,7 @@ require "simplecov" -SimpleCov.start +SimpleCov.start do + add_filter "/spec/" +end # Configure Rails Environment ENV["RAILS_ENV"] = "test"
Remove the files in spec/ dir from coverage result
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -6,7 +6,6 @@ require 'ptilinopus' RSpec.configure do |config| - config.treat_symbols_as_metadata_keys_with_true_values = true config.run_all_when_everything_filtered = true config.filter_run :focus
Remove deprecation warning regarding rspec configuration
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -5,7 +5,6 @@ # # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration RSpec.configure do |config| - config.treat_symbols_as_metadata_keys_with_true_values = true config.run_all_when_everything_filtered = true config.filter_run :focus
Remove deprecated setting, rspec3 forces this true. RSpec::Core::Configuration#treat_symbols_as_metadata_keys_with_true_values= is deprecated. Called from /Users/sane/work/ruby-study/tachikoma/spec/spec_helper.rb:8:in `block in <top (required)>'. Deprecate config.treat_symbols_as_metadata_keys_with_true_values = false. RSpec 3 will not support having this option set to false. (Myron Marston) http://myronmars.to/n/dev-blog/2013/11/rspec-2-99-and-3-0-betas-have-been-released
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -3,6 +3,7 @@ # Uncomment to use ChefSpec's Berkshelf extension require 'chefspec/berkshelf' +require_relative 'support/shared_context' RSpec.configure do |config| # Specify the path for Chef Solo to find cookbooks @@ -22,6 +23,7 @@ # Specify the operating version to mock Ohai data from # config.version = '12.04' + + # Specify examples order config.order = :random - require 'support/shared_context' end
Use require_relative in shared_context load
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -28,8 +28,7 @@ include ROM -ROM_ENV = Environment.setup(test: 'memory://test') -ROM_ADAPTER = ENV.fetch('ROM_ADAPTER', :in_memory).to_sym +ROM_ENV = Environment.setup(test: 'memory://test') Bogus.configure do |config| config.search_modules << ROM
Remove unused constant from spec env
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -40,4 +40,10 @@ example.run end end + + config.before(:each) do |s| + md = s.metadata + x = md[:example_group] + STDERR.puts "==>>> #{x[:file_path]}:#{x[:line_number]} #{md[:description_args]}" + end end
Print running example groups to ease debugging
diff --git a/test/test_tori_define.rb b/test/test_tori_define.rb index abc1234..def5678 100644 --- a/test/test_tori_define.rb +++ b/test/test_tori_define.rb @@ -4,8 +4,9 @@ class Dammy extend Tori::Define tori :test_image + bird = "piyo" tori :def_image do |model| - "foo/#{__tori__}/bar" + "foo/#{__tori__}/bar/#{bird}" end end @@ -29,6 +30,6 @@ test "define name" do dammy = Dammy.new assert_instance_of Tori::File, dammy.def_image - assert { "foo/def_image/bar" == dammy.def_image.name } + assert { "foo/def_image/bar/piyo" == dammy.def_image.name } end end
Add test for out of block should be able to call
diff --git a/test/acceptance/test_init.rb b/test/acceptance/test_init.rb index abc1234..def5678 100644 --- a/test/acceptance/test_init.rb +++ b/test/acceptance/test_init.rb @@ -1,24 +1,63 @@ require 'helper' +require 'pty' +require 'expect' class TestInit < Test::Pwm::AppTestCase # # Tests that initing with two passwords that don't match fails # - def test_init_unmatching_passwords + # A session is expected to look like this (using s3cretPassw0rd at the first and secr3tPassw0rd at the second password prompt): + # + # $ bin/pwm init --force --verbose + # Enter new master password: + # ************** + # Enter master password again: + # ************** + # Passwords do not match. + # $ + # + def test_unmatching_passwords + cmd = "bin/pwm init --force --verbose --file \"#{store_file}\"" + + PTY.spawn(cmd){|pwm_out, pwm_in, pid| + pwm_out.expect(/Enter new master password:/, 1){|r| + pwm_in.printf("s3cretPassw0rd\n") + } + + pwm_out.expect(/Enter master password again:/, 1){|r| + pwm_in.printf("secr3tPassw0rd\n") + } + + assert_response('Passwords do not match\.', pwm_out) + } + end + + # + # Tests that initing an existing store without --force does not touch the existing store + # + def test_exists + assert_error('already exists', "init") + end + + # + # Tests that force-initing an existing store results in a valid store + # + def test_force # TODO end # - # Tests that force-initing an existing store results in a valid store + # Tests that cancelling a forced re-init does not change the store file # - def test_init + def test_cancel # TODO end - - # - # Tests that cancelling a re-init does not change the store file - # - def test_init_cancel - # TODO + + private + + def assert_response(expected, actual_io) + if !actual_io.expect(/#{expected}/, 1) + raise StandardError.new("Expected response '#{expected}' was not matched") + end end end
Use pty and expect to test interactive init dialog
diff --git a/init.rb b/init.rb index abc1234..def5678 100644 --- a/init.rb +++ b/init.rb @@ -1,4 +1,14 @@ require 'redmine' + +# Patches! +require 'dispatcher' + +Dispatcher.to_prepare :overview_view_page_forward do + gem 'lockfile' + + require_dependency 'projects_helper' + ProjectsHelper.send(:include, OverviewProjectsHelperPatch) +end Redmine::Plugin.register :overview_view_page_forward do name 'Overview->View page forward'
Patch the change in, instead.
diff --git a/site-cookbooks/meta/recipes/ruby_development.rb b/site-cookbooks/meta/recipes/ruby_development.rb index abc1234..def5678 100644 --- a/site-cookbooks/meta/recipes/ruby_development.rb +++ b/site-cookbooks/meta/recipes/ruby_development.rb @@ -2,8 +2,8 @@ include_recipe "wel_station::gem_setup" include_recipe "wel_station::mysql" include_recipe "wel_station::postgres" -include_recipe "wel_station::imagemagick" -include_recipe "wel_station::node_js" +include_recipe "wel-osx-apps::imagemagick" +include_recipe "wel-osx-apps::node_js" include_recipe "wel_station::qt" include_recipe "wel_station::mongodb" include_recipe "wel_station::redis"
Switch over to wel-osx-apps for imagemagick and nodejs This commit switches wel_station to wel-osx-apps as it is being slowly deprecated.
diff --git a/attributes/default.rb b/attributes/default.rb index abc1234..def5678 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -18,6 +18,10 @@ normal[:apache][:listen_ports] = ['80'] normal[:apache][:project_web_path] = node[:core][:workspace_path] +# PHP Settings +normal[:php][:directives]['date.timezone'] = 'America/Los_Angeles'; +normal[:php][:directives]['short_open_tag'] = 'Off'; + # MySQL Settings default['mysql']['server_root_password'] = 'vagrant' default['mysql']['server_repl_password'] = 'vagrant'
Define PHP's directives needed by Symfony
diff --git a/attributes/default.rb b/attributes/default.rb index abc1234..def5678 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -3,7 +3,7 @@ default['racktables']['source']['version'] = "0.20.4" default['racktables']['source']['checksum'] = "cbd1e2...2b4f65" default['racktables']['source']['install_dir'] = "/var/www/html/racktables" -default['racktables']['source']['url'] = "https://github.com/RackTables/racktables/archive/" +default['racktables']['source']['url'] = "https://github.com/RackTables/racktables/archive" default['racktables']['server_aliases'] = [node['fqdn']] default['racktables']['redirect_http'] = false
Fix source recipe looking up URL with double slash Introduced in 503926c7.
diff --git a/attributes/default.rb b/attributes/default.rb index abc1234..def5678 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -3,8 +3,6 @@ default['boulder']['config']['boulder-config']['va']['portConfig']['tlsPort'] = 443 default['boulder']['config']['boulder-config']['syslog']['network'] = 'udp' default['boulder']['config']['boulder-config']['syslog']['server'] = 'localhost:514' -# Default 8000 port is needed by Atlassian apps. -default['boulder']['config']['boulder-config']['wfe']['debugAddr'] = 'localhost:7999' default['boulder']['config']['issuer-ocsp-responder']['syslog']['network'] = 'udp' default['boulder']['config']['issuer-ocsp-responder']['syslog']['server'] = 'localhost:514'
Remove personal customization from attributes.