diff stringlengths 65 26.7k | message stringlengths 7 9.92k |
|---|---|
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
@@ -20,4 +20,6 @@ gem.add_development_dependency 'rspec-rails', '~> 2.11'
gem.add_development_dependency 'cucumber', '~> 1.2'
gem.add_development_dependency 'aruba', '~> 0.4'
+
+ gem.add_development_dependency 'activerecord', '~> 3'
end
| Add activerecord to development dependencies
|
diff --git a/ropes.gemspec b/ropes.gemspec
index abc1234..def5678 100644
--- a/ropes.gemspec
+++ b/ropes.gemspec
@@ -23,4 +23,5 @@ spec.add_development_dependency "rake"
spec.add_dependency "debeasy"
spec.add_dependency "gpgme"
+ spec.add_dependency "arr-pm"
end
| Add arr-pm to gem dependencies
|
diff --git a/spec/lib/cli_spec.rb b/spec/lib/cli_spec.rb
index abc1234..def5678 100644
--- a/spec/lib/cli_spec.rb
+++ b/spec/lib/cli_spec.rb
@@ -24,6 +24,17 @@ end
end
+ describe 'given "--help"' do
+ it 'prints help text' do
+ out, err, env = build_command_support
+ expect(Kernel).to receive(:exit).with(1)
+
+ CLI.new(out, err, env).run('--help')
+
+ assert_help_printed err
+ end
+ end
+
describe 'given an unknown command' do
it 'defaults to help text' do
out, err, env = build_command_support
| Add spec for `markdo --help`
|
diff --git a/db/migrate/014_move_to_innodb.rb b/db/migrate/014_move_to_innodb.rb
index abc1234..def5678 100644
--- a/db/migrate/014_move_to_innodb.rb
+++ b/db/migrate/014_move_to_innodb.rb
@@ -20,7 +20,7 @@ @@ver_tbl.each { |tbl|
add_column "current_#{tbl}", "version", :bigint, :limit => 20, :null => false
execute "UPDATE current_#{tbl} SET version = " +
- "(SELECT max(version)+1 FROM #{tbl} WHERE #{tbl}.id = current_#{tbl}.id)"
+ "(SELECT max(version) FROM #{tbl} WHERE #{tbl}.id = current_#{tbl}.id)"
}
end
| api06: Fix the version-numbers-on-current-tables migration: We want the rows
in the current table to have the same version number as the latest one in the
history table (the latest version is kept in both the current and the history
tables.)
|
diff --git a/dta_rapid.gemspec b/dta_rapid.gemspec
index abc1234..def5678 100644
--- a/dta_rapid.gemspec
+++ b/dta_rapid.gemspec
@@ -2,7 +2,7 @@
Gem::Specification.new do |spec|
spec.name = "dta_rapid"
- spec.version = "1.4.2"
+ spec.version = "1.4.3"
spec.authors = ["Gareth Rogers", "Andrew Carr", "Matt Chamberlain"]
spec.email = ["grogers@thoughtworks.com", "andrew@2metres.com", "mchamber@thoughtworks.com"]
| Update gem version to 1.4.3
|
diff --git a/lib/active_set.rb b/lib/active_set.rb
index abc1234..def5678 100644
--- a/lib/active_set.rb
+++ b/lib/active_set.rb
@@ -16,23 +16,23 @@ end
def filter(structure)
- structure.reject { |_, value| value.blank? }
- .reduce(@set) do |set, (key, value)|
- set.select { |item| item.send(key) == value }
- end
+ self.class.new(structure.reject { |_, value| value.blank? }
+ .reduce(@set) do |set, (key, value)|
+ set.select { |item| item.send(key) == value }
+ end)
end
def sort(structure)
- structure.reject { |_, value| value.blank? }
- .reduce(@set) do |set, (key, value)|
- set.sort_by { |item| item.send(key) }
- .tap { |c| c.reverse! if value.to_s == 'desc' }
- end
+ self.class.new(structure.reject { |_, value| value.blank? }
+ .reduce(@set) do |set, (key, value)|
+ set.sort_by { |item| item.send(key) }
+ .tap { |c| c.reverse! if value.to_s == 'desc' }
+ end)
end
def paginate(structure)
pagesize = structure[:size] || 25
- return @set if @set.count < pagesize
- @set.each_slice(pagesize).take(structure[:page]).last
+ return self.class.new(@set) if @set.count < pagesize
+ self.class.new(@set.each_slice(pagesize).take(structure[:page]).last)
end
end
| Allow the ActiveSet instance methods (filter, sort, paginate) to be chainable
|
diff --git a/lib/ci/api/api.rb b/lib/ci/api/api.rb
index abc1234..def5678 100644
--- a/lib/ci/api/api.rb
+++ b/lib/ci/api/api.rb
@@ -25,7 +25,7 @@
format :json
- helpers Helpers
+ helpers ::Ci::API::Helpers
helpers ::API::Helpers
helpers Gitlab::CurrentSettings
| Fix hot reloading for CI API
|
diff --git a/spec/factories/factories.rb b/spec/factories/factories.rb
index abc1234..def5678 100644
--- a/spec/factories/factories.rb
+++ b/spec/factories/factories.rb
@@ -1,20 +1,3 @@ FactoryGirl.define do
to_create(&:save)
-
- trait :with_organization do
- association :organization
- end
-
- # Used with EntityDescriptors, RoleDescriptors etc
- trait :with_key_descriptor do
- after(:create) do |descriptor|
- descriptor.add_key_descriptor(create :key_descriptor)
- end
- end
-
- trait :with_contact_person do
- after(:create) do |descriptor|
- descriptor.add_contact_person(create :contact_person)
- end
- end
end
| Remove unrequired shared FactoryGirl traits
|
diff --git a/spec/github_gateway_spec.rb b/spec/github_gateway_spec.rb
index abc1234..def5678 100644
--- a/spec/github_gateway_spec.rb
+++ b/spec/github_gateway_spec.rb
@@ -3,14 +3,17 @@
describe GithubGateway do
before(:all) do
- @gateway = GithubGateway.new( {
- :parent_repo => "chrissiedeist"
- })
+ @gateway = GithubGateway.new("chrissiedeist")
+ @repo = "django_blog"
end
it "gets all issues for a particular repo" do
- repo = "django_blog"
- expect(@gateway.issues_for(repo).length).to eq(1)
+ expect(@gateway.issues_for(@repo).length).to eq(1)
end
+ it "can access the title and body of the issue" do
+ issue = @gateway.issues_for(@repo).first
+ expect(issue.title).to eq("Test")
+ expect(issue.body).to eq("This is a test.")
+ end
end
| Fix argument to GithubGateway test
|
diff --git a/spec/models/holding_spec.rb b/spec/models/holding_spec.rb
index abc1234..def5678 100644
--- a/spec/models/holding_spec.rb
+++ b/spec/models/holding_spec.rb
@@ -3,6 +3,28 @@ let(:service_response) { create(:service_response) }
subject(:holding) { Holding.new(service_response) }
it { should be_a Holding }
+ describe '#ill?' do
+ subject { holding.ill? }
+ context 'when it is an ILL service response' do
+ let(:service_response) { build(:ill_service_response) }
+ it { should be_true }
+ end
+ context 'when it is not an ILL service response' do
+ let(:service_response) { build(:available_service_response) }
+ it { should be_false }
+ end
+ end
+ describe '#available?' do
+ subject { holding.available? }
+ context 'when it is an available service response' do
+ let(:service_response) { build(:available_service_response) }
+ it { should be_true }
+ end
+ context 'when it is not an available service response' do
+ let(:service_response) { build(:ill_service_response) }
+ it { should be_false }
+ end
+ end
context 'when initialized without any arguments' do
it 'should raise an ArgumentError' do
expect { Holding.new }.to raise_error ArgumentError
| Add holding state examples to the holding specification
|
diff --git a/spec/msgr/msgr/pool_spec.rb b/spec/msgr/msgr/pool_spec.rb
index abc1234..def5678 100644
--- a/spec/msgr/msgr/pool_spec.rb
+++ b/spec/msgr/msgr/pool_spec.rb
@@ -2,7 +2,6 @@
class Runner
def test_method(*args)
- puts "test_method => #{args}"
end
end
@@ -44,7 +43,7 @@ it 'should dispatch message to runner' do
expect_any_instance_of(Runner).to receive(:test_method).with(5, 3.2, 'hello').once
pool.dispatch :test_method, 5, 3.2, 'hello'
- sleep 1
+ sleep 1 # TODO: Asynchronous time-boxed assertion
end
end
end
| Add TODO to sleep in spec.
|
diff --git a/lib/moped/bson.rb b/lib/moped/bson.rb
index abc1234..def5678 100644
--- a/lib/moped/bson.rb
+++ b/lib/moped/bson.rb
@@ -11,8 +11,6 @@
module Moped
module BSON
- class InvalidKeyName < Exception; end
-
EOD = NULL_BYTE = "\u0000".freeze
INT32_PACK = 'l'.freeze
@@ -20,7 +18,5 @@ FLOAT_PACK = 'E'.freeze
START_LENGTH = [0].pack(INT32_PACK).freeze
-
- OrderedHash = Hash
end
end
| Remove unused BSON::OrderedHash and InvalidKeyName
|
diff --git a/config/initializers/juggernaut.rb b/config/initializers/juggernaut.rb
index abc1234..def5678 100644
--- a/config/initializers/juggernaut.rb
+++ b/config/initializers/juggernaut.rb
@@ -0,0 +1,13 @@+module Juggernaut
+ def self.[](key)
+ unless @config
+ raw_config = File.read(RAILS_ROOT + "/config/juggernaut.yml")
+ @config = YAML.load(raw_config)[RAILS_ENV].symbolize_keys
+ end
+ @config[key]
+ end
+
+ def self.[]=(key, value)
+ @config[key.to_sym] = value
+ end
+end | Add an initializer to include a Harmony-like config store.
|
diff --git a/spec/models/config/go_spec.rb b/spec/models/config/go_spec.rb
index abc1234..def5678 100644
--- a/spec/models/config/go_spec.rb
+++ b/spec/models/config/go_spec.rb
@@ -15,7 +15,11 @@ enabled: true
EOS
commit = instance_double("Commit", file_content: raw_content)
- hound_config = double("HoundConfig", commit: commit, content: content)
+ hound_config = instance_double(
+ "HoundConfig",
+ commit: commit,
+ content: content,
+ )
owner = instance_double("Owner", config_content: {})
allow(ConfigContent).to receive(:new).and_return(config_content)
config = Config::Go.new(hound_config, owner: owner)
| Make HoundConfig double an instance double
|
diff --git a/sucker_punch.gemspec b/sucker_punch.gemspec
index abc1234..def5678 100644
--- a/sucker_punch.gemspec
+++ b/sucker_punch.gemspec
@@ -11,6 +11,7 @@ gem.description = %q{Asynchronous processing library for Ruby}
gem.summary = %q{Sucker Punch is a Ruby asynchronous processing using Celluloid, heavily influenced by Sidekiq and girl_friday.}
gem.homepage = "https://github.com/brandonhilkert/sucker_punch"
+ gem.license = "MIT"
gem.files = `git ls-files`.split($/)
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
| Add missing license to gemspec, is MIT
See
- https://github.com/bf4/gemproject/issues/1
- http://guides.rubygems.org/specification-reference/#license=
- http://www.benjaminfleischer.com/2013/07/12/make-the-world-a-better-place-put-a-license-in-your-gemspec/ |
diff --git a/app/mailers/user_mailer.rb b/app/mailers/user_mailer.rb
index abc1234..def5678 100644
--- a/app/mailers/user_mailer.rb
+++ b/app/mailers/user_mailer.rb
@@ -1,4 +1,7 @@ class UserMailer < ApplicationMailer
+ def welcome_email(user, organization)
+ build_email user, :welcome, 'welcome', organization
+ end
def we_miss_you_reminder(user, cycles)
build_email user, :we_miss_you, "#{cycles.ordinalize}_reminder"
| Add welcome email to mailer
|
diff --git a/app/models/access_token.rb b/app/models/access_token.rb
index abc1234..def5678 100644
--- a/app/models/access_token.rb
+++ b/app/models/access_token.rb
@@ -12,6 +12,10 @@ end
def after_create
+ store_api_credentials
+ end
+
+ def store_api_credentials
base_key = "rails:oauth_access_tokens:#{token}"
$api_credentials.hset base_key, "consumer_key", client_application.key
| Move access token credentials storage to a method
|
diff --git a/app/models/user_session.rb b/app/models/user_session.rb
index abc1234..def5678 100644
--- a/app/models/user_session.rb
+++ b/app/models/user_session.rb
@@ -3,7 +3,7 @@ pds_url Settings.pds.login_url
redirect_logout_url Settings.pds.logout_url
aleph_url Exlibris::Aleph::Config.base_url
- calling_system "umlaut"
+ calling_system "getit"
institution_param_key "umlaut.institution"
# (Re-)Set verification and Aleph permissions to user attributes
| Use getit name for PDS :sunflower:
|
diff --git a/lib/cancan/inherited_resource.rb b/lib/cancan/inherited_resource.rb
index abc1234..def5678 100644
--- a/lib/cancan/inherited_resource.rb
+++ b/lib/cancan/inherited_resource.rb
@@ -3,7 +3,8 @@ class InheritedResource < ControllerResource # :nodoc:
def load_resource_instance
if parent?
- @controller.send :parent
+ @controller.send :association_chain
+ @controller.instance_variable_get("@#{instance_name}")
elsif new_actions.include? @params[:action].to_sym
@controller.send :build_resource
else
| Fix for deeply nested resources when using inherited resources
|
diff --git a/lib/ext/heroku/command/deploy.rb b/lib/ext/heroku/command/deploy.rb
index abc1234..def5678 100644
--- a/lib/ext/heroku/command/deploy.rb
+++ b/lib/ext/heroku/command/deploy.rb
@@ -6,6 +6,7 @@ # deploy a ref (usually, the current HEAD)
#
# -m, --migrate # run migrations after deploy
+ # -b, --backup # perform a backup before migrating
#
def index
push && pushed
@@ -27,6 +28,7 @@
def migrate
with_maintenance {
+ backup
run_command 'run', %w(rake db:migrate)
run_command 'restart'
} if migrate?
@@ -34,6 +36,16 @@
def migrate?
options[:migrate]
+ end
+
+ # Backup
+
+ def backup
+ run_command 'pgbackups:capture', %w(--expire)
+ end
+
+ def backup?
+ options[:backup]
end
# Utils
| Allow performing a backup before migrating.
|
diff --git a/did_you_mean.gemspec b/did_you_mean.gemspec
index abc1234..def5678 100644
--- a/did_you_mean.gemspec
+++ b/did_you_mean.gemspec
@@ -15,7 +15,7 @@
spec.files = `git ls-files`.split($/)
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
+ spec.test_files = spec.files.grep(%r{^(test)/})
spec.require_paths = ["lib"]
spec.required_ruby_version = '>= 2.3.0'
| Remove spec/ and features/ from test files spec
|
diff --git a/spec/models/api_sampler/endpoint_spec.rb b/spec/models/api_sampler/endpoint_spec.rb
index abc1234..def5678 100644
--- a/spec/models/api_sampler/endpoint_spec.rb
+++ b/spec/models/api_sampler/endpoint_spec.rb
@@ -8,6 +8,7 @@
it { is_expected.to validate_presence_of(:path) }
it { is_expected.to validate_uniqueness_of(:path) }
+ it { is_expected.to have_db_index(:path) }
it { is_expected.to have_many(:samples) }
end
end
| Test the presence of an index on api_sampler_endpoint(path)
|
diff --git a/db/migrate/20180831134926_create_daily_reports.rb b/db/migrate/20180831134926_create_daily_reports.rb
index abc1234..def5678 100644
--- a/db/migrate/20180831134926_create_daily_reports.rb
+++ b/db/migrate/20180831134926_create_daily_reports.rb
@@ -1,5 +1,10 @@ class CreateDailyReports < ActiveRecord::Migration[5.1]
def change
+ reversible do |direction|
+ direction.up { connection.execute("SET SEARCH_PATH=renalware,public;") }
+ direction.down { connection.execute("SET SEARCH_PATH=renalware,public;") }
+ end
+
create_view :reporting_daily_pathology
create_view :reporting_daily_letters
end
| Put reporting_daily views into the correct schema
|
diff --git a/app/views/subjects/show.json.jbuilder b/app/views/subjects/show.json.jbuilder
index abc1234..def5678 100644
--- a/app/views/subjects/show.json.jbuilder
+++ b/app/views/subjects/show.json.jbuilder
@@ -1 +1 @@-json.extract! @subject, :name, :neighborhood_id, :type, :created_at, :updated_at, :lat, :long, :property_info_set
+json.extract! @subject, :name, :neighborhood_id, :type, :created_at, :updated_at, :lat, :long
| Remove property_info_set from JSON rep of subject (not needed, only lat long necessary)
|
diff --git a/nodejs.rb b/nodejs.rb
index abc1234..def5678 100644
--- a/nodejs.rb
+++ b/nodejs.rb
@@ -1,5 +1,5 @@ dep 'nodejs', :version, :template => 'src' do
- version.default!('0.10.21')
+ version.default!('0.12.0')
source "http://nodejs.org/dist/v#{version}/node-v#{version}.tar.gz"
provides "node ~> #{version}"
end
| Update node.js version to 0.12.0 |
diff --git a/app/controllers/milestones_controller.rb b/app/controllers/milestones_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/milestones_controller.rb
+++ b/app/controllers/milestones_controller.rb
@@ -41,7 +41,7 @@
def destroy
@milestone = current_project.milestones.find(params[:id])
- @milestone.try :destroy
+ @milestone.destroy
redirect_to project_milestones_url
end
end
| Remove pointless try, since find will throw anyway.
|
diff --git a/src/order_parser.rb b/src/order_parser.rb
index abc1234..def5678 100644
--- a/src/order_parser.rb
+++ b/src/order_parser.rb
@@ -10,8 +10,8 @@ end
def description
- lines[6..-1].map(&:strip).each_slice(2).map do |s|
- "#{s[1].split.first} #{s[0]}"
+ items_in_order.map do |item|
+ "#{item[1].split.first} #{item[0]}"
end.join(", ")
end
@@ -21,6 +21,10 @@
def summary
lines[3]
+ end
+
+ def items_in_order
+ lines[(lines.find_index("Ordered") + 1)..-1].map(&:strip).each_slice(2)
end
def lines
| Fix order parser for shipped orders
|
diff --git a/griddler-mandrill.gemspec b/griddler-mandrill.gemspec
index abc1234..def5678 100644
--- a/griddler-mandrill.gemspec
+++ b/griddler-mandrill.gemspec
@@ -13,7 +13,7 @@ spec.homepage = 'https://github.com/wingrunr21/griddler-mandrill'
spec.license = 'MIT'
- spec.files = `git ls-files -z`.split('\x0')
+ spec.files = `git ls-files -z`.split("\x0")
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ['lib']
| Fix null byte in gemspec
|
diff --git a/email_center_api.gemspec b/email_center_api.gemspec
index abc1234..def5678 100644
--- a/email_center_api.gemspec
+++ b/email_center_api.gemspec
@@ -9,9 +9,9 @@ gem.version = EmailCenterApi::VERSION
gem.authors = ["Ed Robinson"]
gem.email = Base64.decode64("ZWQucm9iaW5zb25AcmVldm9vLmNvbQ==\n")
- gem.description = %q{TODO: Write a gem description}
- gem.summary = %q{TODO: Write a gem summary}
- gem.homepage = ""
+ gem.description = "A RubyGem That wraps EmailCenter's maxemail JSON Api"
+ gem.summary = "A RubyGem That wraps EmailCenter's maxemail JSON Api"
+ gem.homepage = "https://github.com/reevoo/email_center_api"
gem.files = `git ls-files`.split($/)
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
| Update gem spec so bundle doesn't complain.
|
diff --git a/cookbooks/universe_ubuntu/attributes/default.rb b/cookbooks/universe_ubuntu/attributes/default.rb
index abc1234..def5678 100644
--- a/cookbooks/universe_ubuntu/attributes/default.rb
+++ b/cookbooks/universe_ubuntu/attributes/default.rb
@@ -1,4 +1,5 @@ default['universe']['user'] = 'vagrant'
+default['universe']['gpu'] = false # Change to 'true' to enable gpu processing
user = default['universe']['user']
default['universe']['home'] = automatic['etc']['passwd'][user]['dir']
| Add gpu flag to attributes file
|
diff --git a/db/migrate/20170202090345_devise_token_auth_create_users.rb b/db/migrate/20170202090345_devise_token_auth_create_users.rb
index abc1234..def5678 100644
--- a/db/migrate/20170202090345_devise_token_auth_create_users.rb
+++ b/db/migrate/20170202090345_devise_token_auth_create_users.rb
@@ -16,8 +16,12 @@ dir.up do
remove_column :users, :authentication_token
+ User.reset_column_information
+
User.all.each do |user|
- user.update_attribute :uid, user.email
+ user.uid = user.email
+ user.tokens = nil
+ user.save!
end
end
| Fix devise token auth migration
https://github.com/lynndylanhurley/devise_token_auth/issues/121
|
diff --git a/acts-as-dag.gemspec b/acts-as-dag.gemspec
index abc1234..def5678 100644
--- a/acts-as-dag.gemspec
+++ b/acts-as-dag.gemspec
@@ -20,6 +20,7 @@
# As specified in test/dag_test.rb
s.add_development_dependency 'activerecord', '~> 3.0.3'
+ s.add_development_dependency 'rake'
s.add_development_dependency 'sqlite3'
s.add_runtime_dependency 'activemodel'
s.add_runtime_dependency 'activerecord'
| Add rake as a development dependency so that "bundle exec rake" works.
|
diff --git a/app/models/repositories/bower.rb b/app/models/repositories/bower.rb
index abc1234..def5678 100644
--- a/app/models/repositories/bower.rb
+++ b/app/models/repositories/bower.rb
@@ -14,18 +14,18 @@ def self.projects
@projects ||= begin
projects = {}
- # p1 = get("https://bower-component-list.herokuapp.com")
+ p1 = get("https://bower-component-list.herokuapp.com")
p2 = get("https://bower.herokuapp.com/packages")
p2.each do |hash|
projects[hash['name'].downcase] = hash.slice('name', 'url', 'hits')
end
- # p1.each do |hash|
- # if projects[hash['name'].downcase]
- # projects[hash['name'].downcase].merge! hash.slice('description', "owner", "website", "forks", "stars", "created", "updated","keywords")
- # end
- # end
+ p1.each do |hash|
+ if projects[hash['name'].downcase]
+ projects[hash['name'].downcase].merge! hash.slice('description', "owner", "website", "forks", "stars", "created", "updated","keywords")
+ end
+ end
projects
end
end
| Revert "Bower search server is offline"
This reverts commit b2165e3900e82b9a9f9f6e3a7ea66dcd44412957.
|
diff --git a/gem_rake_helper.rb b/gem_rake_helper.rb
index abc1234..def5678 100644
--- a/gem_rake_helper.rb
+++ b/gem_rake_helper.rb
@@ -17,11 +17,11 @@ end
Cucumber::Rake::Task.new(:test, 'Run features that should pass') do |t|
- exempt_tags = ""
+ exempt_tags = ["--tags ~@wip"]
exempt_tags << "--tags ~@nojava" if RUBY_PLATFORM == "java"
exempt_tags << "--tags ~@encoding" unless Object.const_defined?(:Encoding)
- t.cucumber_opts = "--color --tags ~@wip #{exempt_tags} --strict --format #{ENV['CUCUMBER_FORMAT'] || 'Fivemat'}"
+ t.cucumber_opts = "--color #{exempt_tags.join(" ")} --strict --format #{ENV['CUCUMBER_FORMAT'] || 'Fivemat'}"
end
YARD::Rake::YardocTask.new
| Fix cucumber flags in jruby
|
diff --git a/spec/unit/hanami/utils/file_list_spec.rb b/spec/unit/hanami/utils/file_list_spec.rb
index abc1234..def5678 100644
--- a/spec/unit/hanami/utils/file_list_spec.rb
+++ b/spec/unit/hanami/utils/file_list_spec.rb
@@ -3,11 +3,11 @@ RSpec.describe Hanami::Utils::FileList do
describe '.[]' do
it 'returns consistent file list across operating systems' do
- list = Hanami::Utils::FileList['test/fixtures/file_list/*.rb']
+ list = Hanami::Utils::FileList['spec/support/fixtures/file_list/*.rb']
expect(list).to eq [
- 'test/fixtures/file_list/a.rb',
- 'test/fixtures/file_list/aa.rb',
- 'test/fixtures/file_list/ab.rb'
+ 'spec/support/fixtures/file_list/a.rb',
+ 'spec/support/fixtures/file_list/aa.rb',
+ 'spec/support/fixtures/file_list/ab.rb'
]
end
end
| Update fixtures reference in specs
|
diff --git a/IBMWatsonCompareComplyV1.podspec b/IBMWatsonCompareComplyV1.podspec
index abc1234..def5678 100644
--- a/IBMWatsonCompareComplyV1.podspec
+++ b/IBMWatsonCompareComplyV1.podspec
@@ -1,7 +1,7 @@ Pod::Spec.new do |s|
s.name = 'IBMWatsonCompareComplyV1'
- s.version = '1.1.1'
+ s.version = '1.2.0'
s.summary = 'Client framework for the IBM Watson Compare & Comply service'
s.description = <<-DESC
IBM Watson™ Compare and Comply analyzes governing documents to provide details about critical aspects of the documents.
| chore(CompareComplyV1): Update CompareComplyV1 podspec to the most recent version of the SDK (1.2.0)
Somehow C&C's version lagged behind the others
|
diff --git a/app/services/jira/work_logger.rb b/app/services/jira/work_logger.rb
index abc1234..def5678 100644
--- a/app/services/jira/work_logger.rb
+++ b/app/services/jira/work_logger.rb
@@ -2,26 +2,63 @@ class WorkLogger
include HTTParty
- attr_accessor :issue_key, :time_entries
+ attr_accessor :username, :password, :time_entries
base_uri 'https://hranswerlink.atlassian.net/rest/api/2'
- def initialize(issue_key, time_entries)
- @issue_key = issue_key
+ def initialize(username:, password:, time_entries:)
+ @username = username
+ @password = password
@time_entries = time_entries
end
- def log
+ def log_all
time_entries.each do |entry|
- self.class.post("/issue/#{issue_key}/worklog", payload(entry))
+ log(entry)
end
end
private
- def payload(entry)
+ def log(entry)
+binding.pry
+ issue_key = parse_issue_key(entry)
+ payload = build_payload(entry)
+ # @TODO fix this - still doesn't connect properly -- getting this error:
+ # {"errorMessages"=>
+ # ["Unexpected character ('c' (code 115)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')\n at [Source: org.apache.catalina.connector.CoyoteInputStream@11d429d; line: 1, column: 2]"]}
+ # The 'c' is from 'comment' in the payload
+ self.class.post("/issue/#{issue_key}/worklog", basic_auth: auth, headers: headers, body: payload)
+ end
- JIRA::PayloadBuilder.new(entry)
+ def auth
+ {
+ username: username,
+ password: password
+ }
+ end
+
+ def headers
+ { 'Content-Type' => 'application/json' }
+ end
+
+ def build_payload(entry)
+ JIRA::PayloadBuilder.new(
+ start: entry['start'],
+ duration_in_seconds: entry['dur'],
+ comment: comment(entry)
+ ).build
+ end
+
+ # @TODO figure out how to capture both of this in one .match call with one set of regex
+ def parse_issue_key(entry)
+ matches = entry['description'].match(/(\[(?<issue_key>[^\]]*)\])/)
+ matches['issue_key'] if matches.present?
+ end
+
+ def comment(entry)
+ matches = entry['description'].match(/(\{(?<comment>[^\}]*)\})/)
+ matches['comment'] if matches.present?
end
end
end
| Tweak work logger to get it almost working
|
diff --git a/app/services/redirect_service.rb b/app/services/redirect_service.rb
index abc1234..def5678 100644
--- a/app/services/redirect_service.rb
+++ b/app/services/redirect_service.rb
@@ -12,9 +12,6 @@ attr_reader :token
def link
- if @link
- return @link
- end
- Link.where(token: token).first || NoLink.new
+ @link ||= Link.where(token: token).first || NoLink.new
end
end
| Fix redirect service link memoization
Summary
-------
While examining code coverage metrics, it seems that the memoization
inside the RedirectService object was not implemented correctly. The
"Link" value would never have been set, the condition to determine if
we've previously loaded the link would always fail, and we'd attempt
another lookup via ActiveRecord. This aims to fix all of that using
the mallot operator instead to assign the RedirectService's "Link".
|
diff --git a/homebrew/chruby.rb b/homebrew/chruby.rb
index abc1234..def5678 100644
--- a/homebrew/chruby.rb
+++ b/homebrew/chruby.rb
@@ -14,7 +14,7 @@ def caveats; <<-EOS.undent
Add the following to the ~/.bashrc or ~/.zshrc file:
- source #{opt_prefix}/share/chruby/chruby.sh
+ source #{opt_share}/chruby/chruby.sh
By default chruby will search for Rubies installed into /opt/rubies/ or
~/.rubies/. For non-standard installation locations, simply set the RUBIES
@@ -34,7 +34,7 @@ To enable auto-switching of Rubies specified by .ruby-version files,
add the following to ~/.bashrc or ~/.zshrc:
- source #{opt_prefix}/share/chruby/auto.sh
+ source #{opt_share}/chruby/auto.sh
EOS
end
end
| Update brew formula opt shortcut.
|
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
@@ -1,5 +1,13 @@ if ENV['SIMPLECOV']
require 'simplecov'
+
+ SimpleCov.start :rails do
+ if ENV['CI_BUILD_NAME']
+ coverage_dir "coverage/#{ENV['CI_BUILD_NAME']}"
+ command_name ENV['CI_BUILD_NAME']
+ merge_timeout 7200
+ end
+ end
end
ENV['RAILS_ENV'] = 'test'
| Add simplecov to spinach tests
|
diff --git a/lib/mws/orders/parsers/model.rb b/lib/mws/orders/parsers/model.rb
index abc1234..def5678 100644
--- a/lib/mws/orders/parsers/model.rb
+++ b/lib/mws/orders/parsers/model.rb
@@ -22,7 +22,8 @@ end
def text_at_xpath(path)
- at_xpath(path).text
+ node = at_xpath(path)
+ node.text if node
end
def time_at_xpath(path)
| Return nil if can't parse text at a node
|
diff --git a/lib/nfl_live_update/schedule.rb b/lib/nfl_live_update/schedule.rb
index abc1234..def5678 100644
--- a/lib/nfl_live_update/schedule.rb
+++ b/lib/nfl_live_update/schedule.rb
@@ -4,8 +4,8 @@
attr_reader :_data, :_xml, :games, :updated_at, :week, :year
- def initialize
- @_xml = open(BASE_URL + FEED_URL).read
+ def initialize(path = nil)
+ @_xml = open(path || (BASE_URL + FEED_URL)).read
@updated_at = Time.now
@_data = Hash.from_xml(_xml).deep_symbolize_keys!
parse
| Allow alternate path to XML file be provided
|
diff --git a/lib/raven/integrations/rails.rb b/lib/raven/integrations/rails.rb
index abc1234..def5678 100644
--- a/lib/raven/integrations/rails.rb
+++ b/lib/raven/integrations/rails.rb
@@ -11,13 +11,6 @@ ActiveSupport.on_load :action_controller do
require 'raven/integrations/rails/controller_methods'
include Raven::Rails::ControllerMethods
- end
- end
-
- initializer 'raven.active_job' do
- ActiveSupport.on_load :active_job do
- require 'raven/integrations/rails/active_job'
- include Raven::Rails::ActiveJob
end
end
| Revert "Add support for ActiveJob."
This reverts commit dfe26167b1f26c165db1b9832233e25d3e7060fc.
|
diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/home_controller.rb
+++ b/app/controllers/home_controller.rb
@@ -10,7 +10,7 @@
tree = groups.sort_by(&:name).map do |group|
- servers = Group.accessible_by(current_ability)
+ servers = group.servers.accessible_by(current_ability)
children = servers.sort_by(&:name).map do |server|
| Fix : Bad cancan validation example
|
diff --git a/lib/shopify_login_protection.rb b/lib/shopify_login_protection.rb
index abc1234..def5678 100644
--- a/lib/shopify_login_protection.rb
+++ b/lib/shopify_login_protection.rb
@@ -4,10 +4,10 @@ if session[:shopify]
begin
# session[:shopify] set in LoginController#finalize
- ActiveResource::Base.site = session[:shopify].site
+ Shopify::Base.site = session[:shopify].site
yield
ensure
- ActiveResource::Base.site = nil
+ ShopifyAPI::Base.site = nil
end
else
session[:return_to] = request.request_uri
| Use ShopifyAPI instead of ActiveResource
|
diff --git a/lib/stacks/standalone_server.rb b/lib/stacks/standalone_server.rb
index abc1234..def5678 100644
--- a/lib/stacks/standalone_server.rb
+++ b/lib/stacks/standalone_server.rb
@@ -4,10 +4,10 @@ class Stacks::StandaloneServer < Stacks::MachineDef
attr_reader :environment
- def initialize(base_hostname, location, networks=[:mgmt, :prod], &block)
+ def initialize(base_hostname, location, &block)
@base_hostname = base_hostname
@location = location
- @networks = networks
+ @networks = [:mgmt, :prod]
block.call unless block.nil?
end
| Revert "rpearce/grichards/tanderson: Fixing hard coded networks for standalone servers"
This reverts commit c99de0dc128768e09bada69bd9b79de778a0f372.
|
diff --git a/language/spec/quickstart_spec.rb b/language/spec/quickstart_spec.rb
index abc1234..def5678 100644
--- a/language/spec/quickstart_spec.rb
+++ b/language/spec/quickstart_spec.rb
@@ -20,8 +20,8 @@ it "detect sentiment" do
language = Google::Cloud::Language.new
expect(Google::Cloud::Language).to receive(:new).
- with(project: "YOUR_PROJECT_ID").
- and_return(language)
+ with(project: "YOUR_PROJECT_ID").
+ and_return(language)
expect {
load File.expand_path("../quickstart.rb", __dir__)
| Change alignment of client instantiation mocking
|
diff --git a/cuprum.gemspec b/cuprum.gemspec
index abc1234..def5678 100644
--- a/cuprum.gemspec
+++ b/cuprum.gemspec
@@ -22,8 +22,8 @@ gem.files = Dir['lib/**/*.rb', 'LICENSE', '*.md']
gem.add_development_dependency 'rspec', '~> 3.6'
- gem.add_development_dependency 'rspec-sleeping_king_studios', '>= 2.3.0'
+ gem.add_development_dependency 'rspec-sleeping_king_studios', '~> 2.3'
gem.add_development_dependency 'rubocop', '~> 0.49.1'
- gem.add_development_dependency 'rubocop-rspec', '~> 1.15.1'
+ gem.add_development_dependency 'rubocop-rspec', '~> 1.15'
gem.add_development_dependency 'simplecov', '~> 0.15'
end # gemspec
| Clean up gemspec dependency versions.
|
diff --git a/app/models/channels/web_channel.rb b/app/models/channels/web_channel.rb
index abc1234..def5678 100644
--- a/app/models/channels/web_channel.rb
+++ b/app/models/channels/web_channel.rb
@@ -14,23 +14,28 @@ end
def client
- @@client ||= RSS::Parser.parse(service_identifier)
+ @client ||=
+ begin
+ f = Feedjira::Feed
+ # f.add_common_feed_entry_element('guid', as: 'guida')
+ f.fetch_and_parse(service_identifier)
+ end
end
def refresh_items
- web_items = client.items
+ web_items = client.entries
web_items.each do |web_item|
- unless items.where(guid: web_item.guid.content).exists?
+ unless items.where(guid: web_item.entry_id).exists?
item = items.create(
- guid: web_item.guid.content,
+ guid: web_item.entry_id,
title: web_item.title,
- content: web_item.content_encoded,
- description: web_item.description,
- link: web_item.link,
- published_at: web_item.pubDate
+ content: web_item.content,
+ description: web_item.summary,
+ link: web_item.url,
+ published_at: web_item.published
)
- item.tag_names = (web_item.categories.map(&:content)) if web_item.categories
+ item.tag_names = (web_item.categories) if web_item.categories
end
end
super
| Replace RSS with Feedjira for web channel
|
diff --git a/Casks/dockertoolbox.rb b/Casks/dockertoolbox.rb
index abc1234..def5678 100644
--- a/Casks/dockertoolbox.rb
+++ b/Casks/dockertoolbox.rb
@@ -1,6 +1,6 @@ cask :v1_1 => 'dockertoolbox' do
- version '1.9.0a'
- sha256 '45c9447345a5b91aa8b120172a5b3621e0cce34a76e9e577beda29364d8367a0'
+ version '1.9.0b'
+ sha256 'dc8c2df85154e0604aca331dda5b6a0711d79f7f7fcd8df0a92bd712bf704811'
url "https://github.com/docker/toolbox/releases/download/v#{version}/DockerToolbox-#{version}.pkg"
appcast 'https://github.com/docker/toolbox/releases.atom'
| Update Docker Toolbox to 1.9.0b
|
diff --git a/lib/active_set/structure/path.rb b/lib/active_set/structure/path.rb
index abc1234..def5678 100644
--- a/lib/active_set/structure/path.rb
+++ b/lib/active_set/structure/path.rb
@@ -34,7 +34,7 @@ end
def value_for(item:)
- @path.reduce(item, :try)
+ resource_for(item: item).send(attribute)
rescue
nil
end
| Fix a bug in getting at the value for a Structure::Path
|
diff --git a/app/workers/daily_import_worker.rb b/app/workers/daily_import_worker.rb
index abc1234..def5678 100644
--- a/app/workers/daily_import_worker.rb
+++ b/app/workers/daily_import_worker.rb
@@ -4,6 +4,7 @@
def perform
client = ClinicalTrials::Client.new
+ client.download_xml_files
client.populate_studies
end
end
| Add download method to import worker.
|
diff --git a/lib/fluid_table/class_methods.rb b/lib/fluid_table/class_methods.rb
index abc1234..def5678 100644
--- a/lib/fluid_table/class_methods.rb
+++ b/lib/fluid_table/class_methods.rb
@@ -1,7 +1,9 @@ class FluidTable
module ClassMethods
- def define_column(identity, alt_name = nil, options = {}, &proc)
+ def define_column(*args, &proc)
+ options = args.extract_options!
+ identity, alt_name = *args
(self.columns ||= Array.new).push(Column.new(identity, alt_name, options, &proc))
end
| Make defining columns much simpler by not needing to pass in nil to alt_name when wanting options. |
diff --git a/app/uploaders/image_uploader.rb b/app/uploaders/image_uploader.rb
index abc1234..def5678 100644
--- a/app/uploaders/image_uploader.rb
+++ b/app/uploaders/image_uploader.rb
@@ -19,6 +19,10 @@
version :hero do
process :resize_to_fill => [800, 300]
+ end
+
+ def filename
+ Time.now.to_i.to_s + File.extname(@filename) if @filename
end
# Provide a default URL as a default if there hasn't been a file uploaded:
| Rename uploaded images with a timestamp
|
diff --git a/google-id-token.gemspec b/google-id-token.gemspec
index abc1234..def5678 100644
--- a/google-id-token.gemspec
+++ b/google-id-token.gemspec
@@ -15,7 +15,7 @@
Gem::Specification.new do |s|
s.name = 'google-id-token'
- s.version = '1.3.2'
+ s.version = '1.3.1'
s.homepage = 'https://github.com/google/google-id-token/'
s.license = 'APACHE-2.0'
| Revert "bump up version for RubyGem"
|
diff --git a/lib/smart_energy_group/client.rb b/lib/smart_energy_group/client.rb
index abc1234..def5678 100644
--- a/lib/smart_energy_group/client.rb
+++ b/lib/smart_energy_group/client.rb
@@ -26,7 +26,7 @@
def send_data(node_name, options)
time = options[:when] || Time.now
- time = time.strftime('%FT%T')
+ time = time.utc.strftime('%FT%T')
data = generate_data(options)
msg = "(site #{@site_token} (node #{node_name} #{time} #{data}))"
| Make sure we send UTC time
|
diff --git a/lib/syncer/listeners/fsevents.rb b/lib/syncer/listeners/fsevents.rb
index abc1234..def5678 100644
--- a/lib/syncer/listeners/fsevents.rb
+++ b/lib/syncer/listeners/fsevents.rb
@@ -7,7 +7,7 @@
def initialize(absolute_path, excludes, settings, callback)
@absolute_path = absolute_path
- @settings = settings
+ @settings = settings.merge!(no_defer: false)
@callback = callback
# rb-fsevent does not support excludes
end
| Disable rb-fsevent no_defer, force it explicitly to false
See https://github.com/thibaudgg/rb-fsevent#nodefer for details on the changed behaviour..
|
diff --git a/glpk.rb b/glpk.rb
index abc1234..def5678 100644
--- a/glpk.rb
+++ b/glpk.rb
@@ -0,0 +1,12 @@+require 'brewkit'
+
+class Glpk <Formula
+ url 'http://ftp.gnu.org/gnu/glpk/glpk-4.39.tar.gz'
+ homepage 'http://www.gnu.org/software/glpk/'
+ md5 '95f276ef6c94c6de1eb689f161f525f3'
+
+ def install
+ system "./configure", "--prefix=#{prefix}", "--disable-debug", "--disable-dependency-tracking"
+ system "make install"
+ end
+end
| Add formula for GNU Linear Programming Kit
Provides a library and stand-alone tool for solving linear programs (LPs) and
integer linear programs (ILPs). Doesn't depend on anything else.
|
diff --git a/test/initial_test_data_test.rb b/test/initial_test_data_test.rb
index abc1234..def5678 100644
--- a/test/initial_test_data_test.rb
+++ b/test/initial_test_data_test.rb
@@ -3,6 +3,8 @@ require 'initial-test-data'
class InitialTestDataTest < ActiveSupport::TestCase
+ include InitialTestData::Utilities
+
test "should load data into test database" do
InitialTestData.load
assert User.count, 3
@@ -19,4 +21,13 @@ InitialTestData.load
assert User.count, 3
end
+
+ test "should load and fetch test records" do
+ InitialTestData.load
+
+ user1 = fetch(:user, :bob)
+ user2 = fetch(:user, :cate)
+ assert user1.name, 'bob'
+ assert user2.name, 'cate'
+ end
end
| Add test for fetch method
|
diff --git a/spec/models/track_thing_spec.rb b/spec/models/track_thing_spec.rb
index abc1234..def5678 100644
--- a/spec/models/track_thing_spec.rb
+++ b/spec/models/track_thing_spec.rb
@@ -3,10 +3,30 @@ describe TrackThing, "when tracking changes" do
fixtures :track_things, :users
+ before do
+ @track_thing = track_things(:track_fancy_dog_search)
+ end
+
+ it "requires a type" do
+ @track_thing.track_type = nil
+ @track_thing.should have(2).errors_on(:track_type)
+ end
+
+ it "requires a valid type" do
+ @track_thing.track_type = 'gibberish'
+ @track_thing.should have(1).errors_on(:track_type)
+ end
+
+ it "requires a valid medium" do
+ @track_thing.track_medium = 'pigeon'
+ @track_thing.should have(1).errors_on(:track_medium)
+ end
+
it "will find existing tracks which are the same" do
track_thing = TrackThing.create_track_for_search_query('fancy dog')
found_track = TrackThing.find_by_existing_track(users(:silly_name_user), track_thing)
- found_track.should == track_things(:track_fancy_dog_search)
+ found_track.should == @track_thing
end
end
+
| Add some new TrackThing tests
|
diff --git a/app/mailers/user_mailer.rb b/app/mailers/user_mailer.rb
index abc1234..def5678 100644
--- a/app/mailers/user_mailer.rb
+++ b/app/mailers/user_mailer.rb
@@ -1,6 +1,7 @@ class UserMailer < ApplicationMailer
def welcome_email(user, organization)
- build_email user, :welcome, 'welcome', organization
+ template = organization.welcome_email_template.try { |it| { inline: it } } || 'welcome'
+ build_email user, :welcome, template, organization
end
def we_miss_you_reminder(user, cycles)
@@ -13,7 +14,7 @@
private
- def build_email(user, subject, template_name, organization = nil)
+ def build_email(user, subject, template, organization = nil)
@user = user
@unsubscribe_code = User.unsubscription_verifier.generate(user.id)
@organization = organization || user.last_organization
@@ -21,7 +22,8 @@ I18n.with_locale(@organization.locale) do
mail to: user.email,
subject: t(subject),
- template_name: template_name
+ content_type: 'text/html',
+ body: render(template)
end
end
end
| Allow rendering html directly in mailer
|
diff --git a/lib/axiom/types/type.rb b/lib/axiom/types/type.rb
index abc1234..def5678 100644
--- a/lib/axiom/types/type.rb
+++ b/lib/axiom/types/type.rb
@@ -16,13 +16,8 @@
def self.constraint(constraint = Undefined, &block)
constraint = block if constraint.equal?(Undefined)
- current = @constraint
- return current if constraint.nil?
- @constraint = if current
- lambda { |object| current.call(object) && constraint.call(object) }
- else
- constraint
- end
+ return @constraint if constraint.nil?
+ add_constraint(constraint)
self
end
@@ -51,6 +46,17 @@ frozen?
end
+ def self.add_constraint(constraint)
+ current = @constraint
+ @constraint = if current
+ lambda { |object| current.call(object) && constraint.call(object) }
+ else
+ constraint
+ end
+ end
+
+ private_class_method :add_constraint
+
end # class Type
end # module Types
end # module Axiom
| Refactor constraint method so adding the constraint is separate
|
diff --git a/points_api/lib/corenlp_client.rb b/points_api/lib/corenlp_client.rb
index abc1234..def5678 100644
--- a/points_api/lib/corenlp_client.rb
+++ b/points_api/lib/corenlp_client.rb
@@ -7,23 +7,11 @@ @http_client = Net::HTTP.new(@uri.host, @uri.port)
end
- def request_parse(sentence)
+ def request_parse(text)
req = Net::HTTP::Post.new(@uri)
- req.body = sentence
- response = JSON.parse(@http_client.request(req).body)['sentences'].first
-
- [response['tokens'], response['collapsed-ccprocessed-dependencies']]
- end
-
- def write_sentence_fixture(sentence)
- parse = request_parse(sentence)
- expected = Graph.new(*parse).nodes.map do |node|
- node.point_strings
- end.flatten
-
- filename = sentence.downcase.gsub(/\s+/,'-').gsub(/[^-\w]/, '') + '.json'
- File.open('test/fixtures/' + filename, 'w') do |f|
- f.write({ parse: parse, expected: expected }.to_json)
+ req.body = text
+ JSON.parse(@http_client.request(req).body)['sentences'].map do |sentence|
+ [sentence['tokens'], sentence['collapsed-ccprocessed-dependencies']]
end
end
end
| Return parses for all sentences
Motivation:
-in a move to handling groups of sentences at a time
Change Explanation:
-return the array of sentence parses, not only the first
|
diff --git a/brew/cask/awsaml.rb b/brew/cask/awsaml.rb
index abc1234..def5678 100644
--- a/brew/cask/awsaml.rb
+++ b/brew/cask/awsaml.rb
@@ -1,6 +1,6 @@ cask 'awsaml' do
version '1.3.0'
- sha256 '47d6305bad6de41b95832970cf33d0d1c2e287ce7f0658a9bc6e4b9da307f0b6'
+ sha256 '4f4459551c3991aed287b02486b8bf0562f6d2fb99e45e93cbe1ee21bc099e0d'
url "https://github.com/rapid7/awsaml/releases/download/v#{version}/awsaml-v#{version}-darwin-x64.zip"
appcast 'https://github.com/rapid7/awsaml/releases.atom',
| Update the SHA256 checksum in the Homebrew cask with the v1.3.0 release.
|
diff --git a/spec/conway_spec.rb b/spec/conway_spec.rb
index abc1234..def5678 100644
--- a/spec/conway_spec.rb
+++ b/spec/conway_spec.rb
@@ -21,15 +21,15 @@ end
describe "when a game is started" do
- it "should have X cells that are alive" do
- conway.start
+ it "should have 50 cells that are alive" do
+ conway.start
number_of_alive_cells = 0
@conway.grid.each do |row|
row.each do |cell|
number_of_alive_cells += 1 if cell.empty?
end
end
- expect(number_of_alive_cells).to be >= X # TODO replace X
+ expect(number_of_alive_cells).to be >= 50
end
end
end
| Add concrete number of alive cells after start in test.
|
diff --git a/spec/sequel_spec.rb b/spec/sequel_spec.rb
index abc1234..def5678 100644
--- a/spec/sequel_spec.rb
+++ b/spec/sequel_spec.rb
@@ -13,7 +13,7 @@ params = if RUBY_PLATFORM == 'java'
RawConnectionFactory::CONFIG
else
- config.slice(:adapter, :host, :database, :username, :password).merge(:user => config[:username])
+ config.slice(:adapter, :host, :database, :username, :password).merge(:user => (config[:user] || config[:username]))
end
Sequel.connect(params)
end
| Fix sequel spec connection error
|
diff --git a/RPInstantAlpha.podspec b/RPInstantAlpha.podspec
index abc1234..def5678 100644
--- a/RPInstantAlpha.podspec
+++ b/RPInstantAlpha.podspec
@@ -3,7 +3,7 @@ s.version = "0.1.0"
s.summary = "Easily allow users to remove the background from an image"
s.homepage = "https://github.com/RobotsAndPencils/RPInstantAlpha"
- s.screenshots = "www.example.com/screenshots_1"
+ s.screenshots = "http://f.cl.ly/items/3t1Q32101W1j1p251J0Z/demo.gif"
s.license = 'MIT'
s.author = { "Brandon Evans" => "brandon.evans@robotsandpencils.com" }
s.source = { :git => "http://github.com/RobotsAndPencils/RPInstantAlpha.git", :tag => s.version.to_s }
| Update screenshot URL in podspec
|
diff --git a/lib/fakefs/fake/file.rb b/lib/fakefs/fake/file.rb
index abc1234..def5678 100644
--- a/lib/fakefs/fake/file.rb
+++ b/lib/fakefs/fake/file.rb
@@ -41,7 +41,6 @@ end
def content=(str)
- @mtime = Time.now
@inode.content = str
end
| Remove unneeded @mtime update in FakeFile
|
diff --git a/lib/fb/configuration.rb b/lib/fb/configuration.rb
index abc1234..def5678 100644
--- a/lib/fb/configuration.rb
+++ b/lib/fb/configuration.rb
@@ -15,7 +15,7 @@ # convention is to use [Fb.configure].
#
# @example
- # Fb.configuration.fb_client_id = 1234
+ # Fb.configuration.client_id = 1234
def self.configuration
@configuration ||= Configuration.new
end
@@ -25,7 +25,7 @@ #
# @example
# Fb.configure do |config|
- # config.fb_client_id = 1234
+ # config.client_id = 1234
# end
def self.configure
yield(configuration) if block_given?
| Fix variable name in the comment
|
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
@@ -16,3 +16,11 @@ path = File.join(File.dirname(__FILE__), 'fixtures', "#{csv_file}.csv")
File.read(path)
end
+
+def json(body)
+ JSON.parse(body)
+end
+
+def xml(xml)
+ Hash.from_xml(xml)
+end
| Add content_type related helper methods
|
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 "codeclimate-test-reporter"
CodeClimate::TestReporter.start
+
+WebMock.disable_net_connect!(:allow => "codeclimate.com")
ENV["RACK_ENV"] ||= 'test'
| Allow WebMock to connect to Code Climate
|
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,7 +1,7 @@ require 'simplecov'
require 'simplecov-rcov'
SimpleCov.formatter = SimpleCov::Formatter::RcovFormatter
-SimpleCov.minimum_coverage 100
+SimpleCov.minimum_coverage 99
RSpec.configure do |config|
config.expect_with :rspec do |expectations|
| Set code coverage to 99% to enable deployment
|
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,6 +1,12 @@ $LOAD_PATH.unshift File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib'))
require 'simplecov'
+
+# save to CircleCI's artifacts directory if we're on CircleCI
+if ENV['CIRCLE_ARTIFACTS']
+ dir = File.join(ENV['CIRCLE_ARTIFACTS'], "coverage")
+ SimpleCov.coverage_dir(dir)
+end
SimpleCov.start do
add_filter '/spec/'
| Add code coverage to Circle.
|
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,4 +17,4 @@ end
end
-Dir[File.dirname(__FILE__) + '/support/*.rb'].each { |f| load f }
+Dir[File.dirname(__FILE__) + '/support/*.rb'].each { |f| require f }
| Use a require instead of a 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
@@ -1,5 +1,7 @@ require 'simplecov'
-SimpleCov.start 'rails'
+SimpleCov.start 'rails' do
+ add_filter "/vendor/"
+end
Encoding.default_external = "UTF-8" if defined? Encoding
Encoding.default_internal = "UTF-8" if defined? Encoding
| spec: Add filter for simplecov to filter vendor directory
|
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,12 +1,17 @@-require 'nyny'
require 'rack'
require 'securerandom'
if ENV['TRAVIS']
require 'coveralls'
Coveralls.wear!
+else
+ require 'simplecov'
+ SimpleCov.start do
+ add_filter "spec"
+ end
end
+require 'nyny'
include NYNY
class Rack::MockRequest
| Add offline coverage report using simplecov
|
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
@@ -30,6 +30,19 @@ config.after do
Test.remove_constants
end
+
+ config.after do
+ [
+ Dry::View,
+ Dry::View::PartBuilder,
+ Dry::View::Path,
+ Dry::View::Renderer,
+ Dry::View::ScopeBuilder,
+ Dry::View::Tilt,
+ ].each do |klass|
+ klass.cache.clear
+ end
+ end
end
RSpec::Matchers.define :part_including do |data|
| Clear all caches after each spec example
This should ensure our tests run faithfully regardless of order
|
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
@@ -10,10 +10,6 @@ require 'have_attributes'
require 'openssl'
require 'socket'
-require 'simplecov'
-
-SimpleCov.start
-
def errback
@errback ||= Proc.new { |e| fail 'cannot connect to slanger. your box might be too slow. try increasing sleep value in the before block' }
| Revert "simplecov start in spec helper". slanger runs in a forked process so simple cannot know about what code is executed.
This reverts commit c66da5beb65d722f0eaca194b7664dade7a52bb5.
|
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
@@ -9,7 +9,7 @@ # Print the 10 slowest examples and example groups at the
# end of the spec run, to help surface which specs are running
# particularly slow.
- config.profile_examples = 10
+ # config.profile_examples = 10
config.order = :random
Kernel.srand config.seed
| Disable tracking for slower specs.
|
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
@@ -47,7 +47,7 @@ config.include(CompressHelper)
config.include(ParserHelper)
config.include(Mutant::NodeHelpers)
- config.mock_with :rspec do |rspec|
+ config.expect_with :rspec do |rspec|
rspec.syntax = [:expect, :should]
end
end
| Fix rspec configuration to use expect_with, not mock_with
|
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
@@ -20,9 +20,9 @@ SimpleCov.at_exit do
SimpleCov.result.format!
# do not change the coverage percentage, instead add more unit tests to fix coverage failures.
- if SimpleCov.result.covered_percent < 71
+ if SimpleCov.result.covered_percent < 81
print "ERROR::BAD_COVERAGE\n"
- print "Coverage is less than acceptable limit(71%). Please add more tests to improve the coverage"
+ print "Coverage is less than acceptable limit(81%). Please add more tests to improve the coverage"
exit(1)
end
end
| Increase test coverage threshold to 81%
We currently have 83.5% coverage. So increase by 10%.
|
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
@@ -7,15 +7,15 @@ GFS_FS_MOUNT = ENV['GFS_FS_MOUNT'] || '/mnt/dist-volume'
# Settings for stress tests
-GFS_MEM_DIR_ITERATIONS = ENV['MEM_DIR_ITERATIONS'] || 50
-GFS_MEM_FILE_ITERATIONS = ENV['MEM_FILE_ITERATIONS'] || 50
-GFS_MEM_VOL_ITERATIONS = ENV['MEM_VOL_ITERATIONS'] || 50
+GFS_MEM_DIR_ITERATIONS = (ENV['MEM_DIR_ITERATIONS'] || 50).to_i
+GFS_MEM_FILE_ITERATIONS = (ENV['MEM_FILE_ITERATIONS'] || 50).to_i
+GFS_MEM_VOL_ITERATIONS = (ENV['MEM_VOL_ITERATIONS'] || 50).to_i
GFS_MEM_PRINT = ENV['MEM_PRINT'] || false
-GFS_PERF_NATIVE_ITERATIONS = ENV['PERF_NATIVE_ITERATIONS'] || 10
-GFS_PERF_MOUNT_ITERATIONS = ENV['PERF_MOUNT_ITERATIONS'] || 10
-GFS_PERF_API_ITERATIONS = ENV['PERF_API_ITERATIONS'] || 10
+GFS_PERF_NATIVE_ITERATIONS = (ENV['PERF_NATIVE_ITERATIONS'] || 10).to_i
+GFS_PERF_MOUNT_ITERATIONS = (ENV['PERF_MOUNT_ITERATIONS'] || 10).to_i
+GFS_PERF_API_ITERATIONS = (ENV['PERF_API_ITERATIONS'] || 10).to_i
RSpec.configure do |config|
config.color_enabled = true
| Convert env values to integers
|
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,3 +5,4 @@ require 'terraforming/dnsimple'
require 'webmock/rspec'
+WebMock.disable_net_connect!(:allow => "codeclimate.com")
| Allow real connection to CodeClimate
https://github.com/codeclimate/ruby-test-reporter#webmocknetconnectnotallowederror
|
diff --git a/jquery-toastmessage-rails.gemspec b/jquery-toastmessage-rails.gemspec
index abc1234..def5678 100644
--- a/jquery-toastmessage-rails.gemspec
+++ b/jquery-toastmessage-rails.gemspec
@@ -6,7 +6,7 @@ Gem::Specification.new do |spec|
spec.name = "jquery-toastmessage-rails"
spec.version = Jquery::Toastmessage::Rails::VERSION
- spec.authors = ["Reyes Yang\n"]
+ spec.authors = ["Reyes Yang"]
spec.email = ["reyes.yang@gmail.com"]
spec.summary = %q{jQuery Toastmessage Plugin packaged for the Rails asset pipeline}
spec.description = %q{jQuery Toastmessage Plugin's JavaScript, Stylesheet and images packaged for Rails asset pipeline}
| Remove \n from author field in gemspec
|
diff --git a/capture_warnings.rb b/capture_warnings.rb
index abc1234..def5678 100644
--- a/capture_warnings.rb
+++ b/capture_warnings.rb
@@ -1,34 +1,40 @@ # With thanks to @myronmarston
-# http://myronmars.to/n/dev-blog/2011/08/making-your-gem-warning-free
+# https://github.com/vcr/vcr/blob/master/spec/capture_warnings.rb
+require 'rubygems' if RUBY_VERSION =~ /^1\.8/
+require 'rspec/core'
+require 'rspec/expectations'
require 'tempfile'
+
stderr_file = Tempfile.new("cucumber-ruby-core.stderr")
$stderr.reopen(stderr_file.path)
current_dir = Dir.pwd
-at_exit do
- stderr_file.rewind
- lines = stderr_file.read.split("\n").uniq
- stderr_file.close!
+RSpec.configure do |config|
+ config.after(:suite) do
+ stderr_file.rewind
+ lines = stderr_file.read.split("\n").uniq
+ stderr_file.close!
- cucumber_core_warnings, other_warnings = lines.partition { |line| line.include?(current_dir) }
+ cucumber_core_warnings, other_warnings = lines.partition { |line| line.include?(current_dir) }
- if cucumber_core_warnings.any?
- puts
- puts "-" * 30 + " cucumber-ruby-core warnings: " + "-" * 30
- puts
- puts cucumber_core_warnings.join("\n")
- puts
- puts "-" * 75
- puts
+ if cucumber_core_warnings.any?
+ puts
+ puts "-" * 30 + " cucumber-ruby-core warnings: " + "-" * 30
+ puts
+ puts cucumber_core_warnings.join("\n")
+ puts
+ puts "-" * 75
+ puts
+ end
+
+ if other_warnings.any?
+ File.open('tmp/warnings.txt', 'w') { |f| f.write(other_warnings.join("\n")) }
+ puts
+ puts "Non-cucumber-ruby-core warnings written to tmp/warnings.txt"
+ puts
+ end
+
+ # fail the build...
+ exit(1) if cucumber_core_warnings.any?
end
-
- if other_warnings.any?
- File.open('tmp/warnings.txt', 'w') { |f| f.write(other_warnings.join("\n")) }
- puts
- puts "Non-cucumber-ruby-core warnings written to tmp/warnings.txt"
- puts
- end
-
- # fail the build...
- exit(1) if cucumber_core_warnings.any?
end
| Update capture warnings script to use rspec hooks
|
diff --git a/lib/heroku-request-id/railtie.rb b/lib/heroku-request-id/railtie.rb
index abc1234..def5678 100644
--- a/lib/heroku-request-id/railtie.rb
+++ b/lib/heroku-request-id/railtie.rb
@@ -1,7 +1,7 @@ module HerokuRequestId
class Railtie < Rails::Railtie
initializer 'heroku_request_id.add_middleware' do |app|
- app.config.middleware.insert 0, "HerokuRequestId::Middleware"
+ app.config.middleware.insert_before "Rack::Runtime", "HerokuRequestId::Middleware"
end
end
end
| Load the middleware before Rack::Runtime.
|
diff --git a/lib/merb_global/base.rb b/lib/merb_global/base.rb
index abc1234..def5678 100644
--- a/lib/merb_global/base.rb
+++ b/lib/merb_global/base.rb
@@ -5,7 +5,7 @@ module Global
attr_accessor :lang, :provider
def lang #:nodoc:
- @lang ||= (ENV['LC_ALL'] || 'C').split('.')[0]
+ @lang ||= "en"
end
def provider #:nodoc:
@provider ||= Merb::Global::Providers.provider
| Change default language to simply english
|
diff --git a/lib/pragma/decorator.rb b/lib/pragma/decorator.rb
index abc1234..def5678 100644
--- a/lib/pragma/decorator.rb
+++ b/lib/pragma/decorator.rb
@@ -3,9 +3,12 @@
require 'pragma/decorator/version'
require 'pragma/decorator/base'
+require 'pragma/decorator/collection'
module Pragma
# Represent your API resources in JSON with minimum hassle.
+ #
+ # @author Alessandro Desantis
module Decorator
end
end
| Add author to Pragma::Decorator module
|
diff --git a/lib/omniauth/strategies/myecp.rb b/lib/omniauth/strategies/myecp.rb
index abc1234..def5678 100644
--- a/lib/omniauth/strategies/myecp.rb
+++ b/lib/omniauth/strategies/myecp.rb
@@ -23,7 +23,7 @@
info do
{
- :name => raw_info['first_name'] + raw_info['last_name'],
+ :name => raw_info['first_name'] + " " + raw_info['last_name'],
:email => raw_info['mail'],
:nickname => raw_info['login'],
:first_name => raw_info['first_name'],
| Fix space between first and last names
|
diff --git a/lib/sermepa_web_tpv/signature.rb b/lib/sermepa_web_tpv/signature.rb
index abc1234..def5678 100644
--- a/lib/sermepa_web_tpv/signature.rb
+++ b/lib/sermepa_web_tpv/signature.rb
@@ -19,8 +19,7 @@ end
def cipher
- @cipher ||= Mcrypt.new(:tripledes, :cbc, merchant_key,
- iv, :zeros)
+ Mcrypt.new(:tripledes, :cbc, merchant_key, iv, :zeros)
end
def digestor
| Use new Mcrypt instance on every cipher call
|
diff --git a/lib/tasks/orphaned_editions.rake b/lib/tasks/orphaned_editions.rake
index abc1234..def5678 100644
--- a/lib/tasks/orphaned_editions.rake
+++ b/lib/tasks/orphaned_editions.rake
@@ -0,0 +1,53 @@+namespace :orphaned_editions do
+ desc "Destroy editions having an artefact with the state 'archived'"
+
+ QUALIFYING_EDITION_STATES = [
+ "ready",
+ "amends_needed",
+ "fact_check_received",
+ "fact_check",
+ "draft",
+ "in_review",
+ "lined_up"
+ ]
+
+ def orphaned_editions(state)
+ Edition.where(state: state).select { |e|
+ e.artefact.state == 'archived' }
+ end
+
+ def about_edition(edition)
+ "Id: #{edition.id} Type: #{edition._type} Title: #{edition.title}"
+ end
+
+ task :report => :environment do
+ puts "Searching for orphaned editions..."
+ orphans = []
+ QUALIFYING_EDITION_STATES.each do |state|
+ orphans.concat(orphaned_editions(state))
+ end
+ if orphans.any?
+ orphans.each {|o| puts "Found orphan - " + about_edition(o) }
+ else
+ puts "No orphaned editions found"
+ end
+ end
+
+ task :destroy => :environment do
+ puts "Searching for orphaned editions..."
+ orphans = []
+ QUALIFYING_EDITION_STATES.each do |state|
+ orphaned_editions(state).each do |oe|
+ orphans.concat(oe)
+ end
+ end
+ if orphans.any?
+ orphans.each do |o|
+ puts "Destroying orphan - " + about_edition(o)
+ o.destroy
+ end
+ else
+ puts "No orphaned editions found"
+ end
+ end
+end
| Make rake task to delete orphaned editions
|
diff --git a/lib/dolphy/core.rb b/lib/dolphy/core.rb
index abc1234..def5678 100644
--- a/lib/dolphy/core.rb
+++ b/lib/dolphy/core.rb
@@ -41,12 +41,12 @@
if block = router.routes[http_method][path]
@status = 200
- @response = [instance_eval(&block)]
+ @response = instance_eval(&block)
else
@status = 404
- @response = ["Page not found."]
+ @response = "Page not found."
end
- [status, headers, response]
+ [status, headers, [response]]
end
private
| Convert to an array in return statement.
|
diff --git a/lib/hawk/linker.rb b/lib/hawk/linker.rb
index abc1234..def5678 100644
--- a/lib/hawk/linker.rb
+++ b/lib/hawk/linker.rb
@@ -0,0 +1,94 @@+module Hawk
+
+ # Allows adding to any Ruby object an accessor referencing an {Hawk::Model}.
+ #
+ # Example, assuming Bar is defined and Foo responds_to `bar_id`:
+ #
+ # class Foo
+ # include Hawk::Linker
+ #
+ # resource_accessor :bar
+ # end
+ #
+ # Now, Foo#bar will call Bar.find(bar_id) and memoize it
+ #
+ module Linker
+ def self.included(base)
+ base.extend(ClassMethods)
+ end
+
+ module ClassMethods
+ def resource_accessor(entity, options = {}) # Let's start simple.
+ if options[:polymorphic]
+ _polymorphic_resource_accessor(entity, options)
+ else
+ _monomorphic_resource_accessor(entity, options)
+ end
+ end
+
+ private
+ def _monomorphic_resource_accessor(entity, options)
+ klass = options[:class_name] || entity.to_s.camelize
+ key = options[:primary_key] || [entity, :id].join('_')
+
+ class_eval <<-RUBY, __FILE__, __LINE__ -1 # Getter
+ def #{entity}
+ return nil unless self.#{key}.present?
+
+ @_#{entity} ||= #{parent}::#{klass}.find(self.#{key})
+ end
+ RUBY
+
+ class_eval <<-RUBY, __FILE__, __LINE__ -1 # Setter
+ def #{entity}=(object)
+ unless object.respond_to?(:id) && object.class.respond_to?(:find)
+ raise ArgumentError, "Invalid object: \#{object.inspect}"
+ end
+
+ self.#{key} = object.id
+
+ @_#{entity} = object
+ end
+ RUBY
+
+ class_eval <<-RUBY, __FILE__, __LINE__ -1 # Reloader
+ def reload(*)
+ super.tap { @_#{entity} = nil }
+ end
+ RUBY
+ end
+
+ def _polymorphic_resource_accessor(entity, options)
+ key = options[:as] || entity
+
+ class_eval <<-RUBY, __FILE__, __LINE__ -1 # Getter
+ def #{entity}
+ return nil unless self.#{key}_id.present? && self.#{key}_type.present?
+
+ @_#{entity} ||= self.#{key}_type.constantize.find(self.#{key}_id)
+ end
+ RUBY
+
+ class_eval <<-RUBY, __FILE__, __LINE__ -1 # Setter
+ def #{entity}=(object)
+ unless object.respond_to?(:id) && object.class.respond_to?(:find)
+ raise ArgumentError, "Invalid object: \#{object.inspect}"
+ end
+
+ self.#{key}_type = object.class.name
+ self.#{key}_id = object.id
+
+ @_#{entity} = object
+ end
+ RUBY
+
+ class_eval <<-RUBY, __FILE__, __LINE__ -1 # Reloader
+ def reload(*)
+ super.tap { @_#{entity} = nil }
+ end
+ RUBY
+ end
+ end
+ end
+
+end
| Add Linker, for accessors on foreign object
|
diff --git a/app/models/riews/relationship.rb b/app/models/riews/relationship.rb
index abc1234..def5678 100644
--- a/app/models/riews/relationship.rb
+++ b/app/models/riews/relationship.rb
@@ -4,6 +4,6 @@ alias_method :view, :riews_view
validates_presence_of :view
- validates :name, presence: true
+ validates :name, presence: true, inclusion: { in: proc{|r| r.view.klass.reflections.keys }}
end
end
| Validate the associations that can be performed
|
diff --git a/lib/yelp/client.rb b/lib/yelp/client.rb
index abc1234..def5678 100644
--- a/lib/yelp/client.rb
+++ b/lib/yelp/client.rb
@@ -25,8 +25,9 @@ token: @token,
token_secret: @token_secret }
- @connection ||= Faraday.new API_HOST do |conn|
+ @connection = Faraday.new API_HOST do |conn|
conn.request :oauth, keys
+ conn.adapter :net_http
end
end
| Set the adapter to net/http
|
diff --git a/lib/deep_cover/node/exceptions.rb b/lib/deep_cover/node/exceptions.rb
index abc1234..def5678 100644
--- a/lib/deep_cover/node/exceptions.rb
+++ b/lib/deep_cover/node/exceptions.rb
@@ -29,6 +29,11 @@ children[2]
end
alias_method :next_instruction, :body
+
+ def naive_cover
+ # Ruby doesn't cover the rescue clause itself, so skip till the body
+ body.naive_cover if body
+ end
end
class Kwbegin < Node
| Fix naive coverage for rescue clause
|
diff --git a/lib/copy_peste/core/module_mng.rb b/lib/copy_peste/core/module_mng.rb
index abc1234..def5678 100644
--- a/lib/copy_peste/core/module_mng.rb
+++ b/lib/copy_peste/core/module_mng.rb
@@ -0,0 +1,49 @@+require_relative '../modules.rb'
+
+module CopyPeste
+ class Core
+
+ class ModuleMng
+ attr_accessor :modules_list
+
+ def initialize
+ @modules_list = { :graphics => {}, :analysis => {} }
+
+ modules_base = Core::Modules::Base.new
+ Core::Utils.hook_method(:inherited, on: Core::Modules::Analysis, to: modules_base, with: :register_mod_type)
+ Core::Utils.hook_method(:inherited, on: Core::Modules::Graphics, to: modules_base, with: :register_mod_type)
+
+ modules_base.customize
+
+ graphics_mod_classes = modules_base.get_graphics_classes
+ graphics_mod_classes.each do |mod|
+ begin
+ @modules_list[:graphics][mod.first] = mod.last.new
+ rescue
+ puts "Badly formatted"
+ end
+ end
+
+ analysis_mod_classes = modules_base.get_analysis_classes
+ analysis_mod_classes.each do |mod|
+ begin
+ @modules_list[:analysis][mod.first] = mod.last.new
+ rescue
+ puts "Badly formatted"
+ end
+ end
+ end
+
+ def get name
+ if @modules_list[:analysis].has_key? name
+ return @modules_list[:analysis][name]
+ elsif @modules_list[:graphics].has_key? name
+ return @modules_list[:graphics][name]
+ end
+ nil
+ end
+
+ end
+
+ end
+end
| Change modules loading and storing method
|
diff --git a/lib/daimon_skycrawlers/crawler.rb b/lib/daimon_skycrawlers/crawler.rb
index abc1234..def5678 100644
--- a/lib/daimon_skycrawlers/crawler.rb
+++ b/lib/daimon_skycrawlers/crawler.rb
@@ -1,37 +1,44 @@-require 'net/http'
+require 'faraday'
require 'uri'
module DaimonSkycrawlers
class Crawler
- def fetch(url)
- res = request(url)
+ def initialize(url, options = {})
+ @connection = Faraday.new(url, options) do |faraday|
+ if block_given?
+ yield faraday
+ end
+ end
+ end
- # TODO Use raw response header
- yield url, nil, res.body
+ # TODO Support POST when we need
+ def fetch(url, params = {})
+ response = get(url)
- urls = retrieve_links(res.body)
+ yield url, response
+
+ urls = retrieve_links(response.body)
enqueue_next_urls urls
end
+ def get(url, params = {})
+ @connection.get(url, params)
+ end
+
+ def post(url, params = {})
+ @connection.post(url, params)
+ end
+
private
- # TODO Support HTTP methods other than GET ?
- def request(url)
- uri = URI(url)
-
- # TODO Support HTTPS
- Net::HTTP.start(uri.host, uri.port) {|http|
- path = uri.path
- path = '/' + path unless path.start_with?('/')
-
- http.get(path)
- }
- end
-
def retrieve_links(html)
- # TODO Implement this
- []
+ links = []
+ html = Nokogiri::HTML(html)
+ html.search("a").each do |element|
+ links << element["href"]
+ end
+ links
end
def enqueue_next_urls(urls)
| Use Faraday instead of net/http
Still use net/http as Faraday backend.
|
diff --git a/api/spec/support/controller_hacks.rb b/api/spec/support/controller_hacks.rb
index abc1234..def5678 100644
--- a/api/spec/support/controller_hacks.rb
+++ b/api/spec/support/controller_hacks.rb
@@ -25,7 +25,14 @@
def api_process(action, params = {}, session = nil, flash = nil, method = "get")
scoping = respond_to?(:resource_scoping) ? resource_scoping : {}
- process(action, method, params.merge(scoping).reverse_merge!(format: :json), session, flash)
+ process(
+ action,
+ method: method,
+ params: params.merge(scoping),
+ session: session,
+ flash: flash,
+ format: :json
+ )
end
end
| Fix keyword argument warnings in API specs
Rails 5.0 deprecated non keyword arguments on testing controllers. This
commit updates the controller_hacks file to remove the deprecation
warning by using only keyword arguments.
|
diff --git a/spec/features/home_page_spec.rb b/spec/features/home_page_spec.rb
index abc1234..def5678 100644
--- a/spec/features/home_page_spec.rb
+++ b/spec/features/home_page_spec.rb
@@ -0,0 +1,22 @@+require "rails_helper"
+
+describe "Home page" do
+ before do
+ visit '/'
+ end
+
+ it "has a link redirecting to About page" do
+ click_link 'About RubyGameDev.com'
+ expect(current_path).to eq '/about'
+ end
+
+ it "has a link redirecting to signup page" do
+ click_link 'Sign in'
+ expect(current_path).to eq '/sign_in'
+ end
+
+ it "has a link to create a new post, which redirects to the signup page" do
+ click_link 'New'
+ expect(current_path).to eq '/sign_in'
+ end
+end | Add tests for checking Home page links
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.