diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/lib/board_data_file.rb b/lib/board_data_file.rb index abc1234..def5678 100644 --- a/lib/board_data_file.rb +++ b/lib/board_data_file.rb @@ -13,5 +13,52 @@ def random self[rand(size)] end + + def self.export_sparse_data(board) + [board.row_size].pack('C') + + if board.row_size < 16 + board.row_size.times.map do |row| + board.row_size.times.map do |col| + cell = board[row, col] + next if cell == 0 + [col << 4 | Board::BITMASK_TO_NUM[cell]].pack('C') + end.compact.join('') + "\0" + end.join('') + else + board.row_size.times.map do |row| + board.row_size.times.map do |col| + cell = board[row, col] + next if cell == 0 + [col, Board::BITMASK_TO_NUM[cell]].pack('CC') + end.compact.join('') + "\0" + end.join('') + end + end + + def self.import_sparse_data(data) + row_size, data = data.unpack('Ca*') + if row_size < 16 + row_size.times.map do |row| + row_data, data = data.unpack('Z*a*') + line = [0] * row_size + col_data = row_data.unpack('C*') + col_data.each do |packed_col| + line[packed_col >> 4] = packed_col & 0xf + end + line + end + else + row_size.times.map do |row| + row_data, data = data.unpack('Z*a*') + line = [0] * row_size + col_data = row_data.unpack('S*') + col_data.each do |packed_col| + line[packed_col >> 8] = packed_col & 0xff + end + line + end + end + end + end
Add sparse data format support
diff --git a/lib/sendmark/render.rb b/lib/sendmark/render.rb index abc1234..def5678 100644 --- a/lib/sendmark/render.rb +++ b/lib/sendmark/render.rb @@ -14,7 +14,7 @@ end end - def list_item(text, list_type) + def list_item(text, _list_type) if css_defined_with?("li") "<li style=\"#{css_style("li")}\">#{text}</li>" else @@ -30,7 +30,7 @@ end end - def link(link, title, content) + def link(link, _title, content) if css_defined_with?("a") "<a style=\"#{css_style("a")}\" href=\"#{link}\">#{content}</a>" else
Change unuse method argument name
diff --git a/lib/tasks/one_off.rake b/lib/tasks/one_off.rake index abc1234..def5678 100644 --- a/lib/tasks/one_off.rake +++ b/lib/tasks/one_off.rake @@ -23,4 +23,16 @@ end end end + + desc "delete all hidden maven projects missing a group id" + task delete_groupless_maven_projects: :environment do + Project. + where(platform: "Maven"). + where(status: "Hidden"). + where("name NOT LIKE '%:%'"). + find_each do |p| + puts "Deleting Maven project #{p.name} (#{p.id})" + p.destroy! + end + end end
Add a task to remove hidden maven projects with no group id.
diff --git a/aws-lambda-runner.gemspec b/aws-lambda-runner.gemspec index abc1234..def5678 100644 --- a/aws-lambda-runner.gemspec +++ b/aws-lambda-runner.gemspec @@ -3,7 +3,7 @@ Gem::Specification.new do |s| s.name = 'aws-lambda-runner' - s.version = '1.0.0' + s.version = '1.1.0' s.date = '2015-01-09' s.summary = 'AWS Lambda testing helper' s.description = 'Trigger AWS Lambda functions without deploying to AWS'
Create a release for 1.1.0
diff --git a/app/controllers/auth.rb b/app/controllers/auth.rb index abc1234..def5678 100644 --- a/app/controllers/auth.rb +++ b/app/controllers/auth.rb @@ -1,5 +1,6 @@ get '/' do - erb :index + yourvalues = current_user ? Uservalue.values_of_user(current_user.id) : nil + erb :'index', locals: {yourvalues: yourvalues} end post '/login' do
Debug for an undefined variable in its corresponding view file.
diff --git a/config/initializers/sidekiq.rb b/config/initializers/sidekiq.rb index abc1234..def5678 100644 --- a/config/initializers/sidekiq.rb +++ b/config/initializers/sidekiq.rb @@ -13,8 +13,6 @@ config.redis = { url: redis_url, namespace: 'sidekiq', size: 1 } end -Sidekiq::Logging.initialize_logger('log/sidekiq.log') - Sidekiq.default_worker_options = { 'retry' => false, 'backtrace' => true
Remove superfluous Sidekiq logging config
diff --git a/app/models/fuel_type.rb b/app/models/fuel_type.rb index abc1234..def5678 100644 --- a/app/models/fuel_type.rb +++ b/app/models/fuel_type.rb @@ -1,16 +1,29 @@ class FuelType < ActiveRecord::Base belongs_to :market has_many :generator_types - has_many :generators, :through => :generator_types + has_many :generators, :through => :generator_types do + def find_by_game game + # Raw SQL to get around the fact that rails doesn't create the double + # join here properly. + find(:all, :joins => "INNER JOIN cities ON technical_component_instances.city_id = cities.id INNER JOIN states ON cities.state_id = states.id", + :conditions => {:states => {:game_id => game}}) + end + end has_many :market_prices, :through => :market has_friendly_id :name, :use_slug => true validates :name, :presence => true def average_demand game, time=nil + generators.find_by_game(game).inject(0) {|demand, generator| + demand + generator.average_fuel_burn_rate(time) + } end def demand game + generators.find_by_game(game).inject(0) {|demand, generator| + demand + generator.fuel_burn_rate + } end def to_s
Implement demand helpers for FuelType.
diff --git a/app/models/pie_piece.rb b/app/models/pie_piece.rb index abc1234..def5678 100644 --- a/app/models/pie_piece.rb +++ b/app/models/pie_piece.rb @@ -1,5 +1,6 @@ class PiePiece < ActiveRecord::Base belongs_to :pie + validates_uniqueness_of :title, scope: :pie_id has_one :users, through: :pie scope :user, ->(id) { joins(:users)
Add validation to enforce uniqueness of pie piece title
diff --git a/gir_ffi-tracker.gemspec b/gir_ffi-tracker.gemspec index abc1234..def5678 100644 --- a/gir_ffi-tracker.gemspec +++ b/gir_ffi-tracker.gemspec @@ -2,7 +2,7 @@ Gem::Specification.new do |s| s.name = "gir_ffi-tracker" - s.version = "0.1.1" + s.version = "0.1.2" s.summary = "GirFFI-based binding to Tracker" @@ -16,7 +16,7 @@ s.extra_rdoc_files = ["README.rdoc"] s.test_files = `git ls-files -z -- test`.split("\0") - s.add_runtime_dependency(%q<gir_ffi>, ["~> 0.3.0"]) + s.add_runtime_dependency(%q<gir_ffi>, ["~> 0.4.0"]) s.add_development_dependency('minitest', [">= 2.0.2"]) s.add_development_dependency('rake', ["~> 0.9.2"])
Update dependency on GirFFI and bump version
diff --git a/lib/ifuture.rb b/lib/ifuture.rb index abc1234..def5678 100644 --- a/lib/ifuture.rb +++ b/lib/ifuture.rb @@ -2,11 +2,10 @@ require 'ichannel' class IFuture - def initialize serializer = Marshal, &block + def initialize serializer = Marshal @channel = IChannel.new serializer - @pid = fork do - @channel.put block.call + @channel.put yield end end
Raise a LocalJumpError when no block is given.
diff --git a/app/values/seniority.rb b/app/values/seniority.rb index abc1234..def5678 100644 --- a/app/values/seniority.rb +++ b/app/values/seniority.rb @@ -31,7 +31,7 @@ end def next - raise "There is no next for #{ self }" if @seniority == (NAMES.size + 1) + return self if @seniority == (NAMES.size - 1) self.class.new(@seniority + 1) end end
Make this work for heroes. Heroes next level is self.
diff --git a/database/seed_dummy_data.rb b/database/seed_dummy_data.rb index abc1234..def5678 100644 --- a/database/seed_dummy_data.rb +++ b/database/seed_dummy_data.rb @@ -0,0 +1,46 @@+require 'date' +require 'sequel' +require 'pg' +require 'yaml' + +settings = YAML.load(File.open('config.yml')) + +environment = settings['environment'] +env_settings = settings[environment] + +case environment +when 'development' + db_host = env_settings['db_host'] + db_name = env_settings['db_name'] + db_user = env_settings['db_user'] + + DB = Sequel.postgres(db_name, + host: db_host, + user: db_user) +when 'production' + db_host = env_settings['db_host'] + db_name = env_settings['db_name'] + db_user = env_settings['db_user'] + db_password = env_settings['db_password'] + + DB = Sequel.postgres(db_name, + host: db_host, + user: db_user, + password: db_password) +end + +Sequel::Model.plugin :validation_helpers +Dir.glob('./models/*.rb').each { |file| require file } + +tables = [ + 'types', + 'categories', + 'performances', + # 'medias', + ] + +tables.each do |table| + puts "Populating dummy data into #{table}..." + require "./database/dummy_data_packs/dummy_#{table}.rb" + puts "done" +end
Add seed dummy data logic
diff --git a/ruby/suzuki.rb b/ruby/suzuki.rb index abc1234..def5678 100644 --- a/ruby/suzuki.rb +++ b/ruby/suzuki.rb @@ -0,0 +1,7 @@+def lineup_students(students) + arr = students.split(' ') + arr.sort_by! { |name| [name.length, name] } + arr.reverse +end + +lineup_students('Tadashi Takahiro Takao Takashi Takayuki Takehiko Takeo Takeshi Takeshi')
Write solution for Suzuki sorter
diff --git a/mongoid_search.gemspec b/mongoid_search.gemspec index abc1234..def5678 100644 --- a/mongoid_search.gemspec +++ b/mongoid_search.gemspec @@ -19,7 +19,7 @@ s.add_dependency("mongoid", [">= 3.0.0"]) s.add_dependency("fast-stemmer", ["~> 1.0.0"]) s.add_development_dependency("database_cleaner", [">= 0.8.0"]) - s.add_development_dependency("rake", ["~> 0.8.7"]) + s.add_development_dependency("rake", ["< 11.0"]) s.add_development_dependency("rspec", ["~> 2.4"]) s.require_path = "lib"
Change rake dependency version, fix CI for Mongoid 3-5
diff --git a/garufa.gemspec b/garufa.gemspec index abc1234..def5678 100644 --- a/garufa.gemspec +++ b/garufa.gemspec @@ -29,4 +29,5 @@ s.add_dependency "cuba" s.add_dependency "signature" s.add_development_dependency "rake" + s.add_development_dependency "minitest", '~> 5.3.1' end
Add minitest version 5.3.1 to development_dependencies.
diff --git a/carpet.gemspec b/carpet.gemspec index abc1234..def5678 100644 --- a/carpet.gemspec +++ b/carpet.gemspec @@ -8,8 +8,8 @@ s.name = "carpet" s.version = Carpet::VERSION s.authors = ["railsrocks"] - s.email = ["railsrocks@users.noreply.github.com"] - s.homepage = "https://github.com/railsrocks/Carpet" + s.email = ["rzig@users.noreply.github.com"] + s.homepage = "https://github.com/rzig/Carpet" # s.summary = "Use redcarpet to render fields in a model." # s.description = "Use redcarpet to render fields in a model, to make your code dry." s.license = "MIT"
Update gemspec with new profile link
diff --git a/nasdaq_scraper.gemspec b/nasdaq_scraper.gemspec index abc1234..def5678 100644 --- a/nasdaq_scraper.gemspec +++ b/nasdaq_scraper.gemspec @@ -18,6 +18,8 @@ spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] + spec.add_dependency 'rest-client', '~> 1.6' + spec.add_development_dependency "bundler", "~> 1.5" spec.add_development_dependency "rake" spec.add_development_dependency "rspec"
Add RestClient to dependency list
diff --git a/db/migrate/20181030143621_another_force_update_broken_manual_published.rb b/db/migrate/20181030143621_another_force_update_broken_manual_published.rb index abc1234..def5678 100644 --- a/db/migrate/20181030143621_another_force_update_broken_manual_published.rb +++ b/db/migrate/20181030143621_another_force_update_broken_manual_published.rb @@ -0,0 +1,22 @@+class AnotherForceUpdateBrokenManualPublished < Mongoid::Migration + def self.up + user = User.find_by(email: "oscar.wyatt@digital.cabinet-office.gov.uk") + if user + manual = Manual.find("99005789-d82b-4045-932b-8ad9752a80bc", user) + if manual + service = Manual::UpdateService.new( + user: user, + manual_id: manual.id, + attributes: { state: "published" } + ) + service.call + # It is incorrectly using the old publish tasks which are all aborted so delete them before republishing + manual.publish_tasks.each(&:delete) + manual.publish + end + end + end + + def self.down + end +end
Add migration to fix broken manual sdfdsf
diff --git a/lib/writer.rb b/lib/writer.rb index abc1234..def5678 100644 --- a/lib/writer.rb +++ b/lib/writer.rb @@ -8,7 +8,6 @@ # Used to write the pages to the output directory class Writer def self.write(pages, output_directory) - # pages.each { |_k, page| puts page } pages.each do |filename, page| path = File.expand_path(filename, output_directory) File.write(path, page)
Remove commented out testing code
diff --git a/lib/active_record_lite/mass_object.rb b/lib/active_record_lite/mass_object.rb index abc1234..def5678 100644 --- a/lib/active_record_lite/mass_object.rb +++ b/lib/active_record_lite/mass_object.rb @@ -1,7 +1,6 @@ class MassObject def self.my_attr_accessible(*attributes) attributes.each do |attribute| - attr_accessor attribute self.attributes << attribute.to_s end end @@ -12,7 +11,12 @@ def self.parse_all(results) results.map do |params| - self.new(params) + obj = self.new + params.each do |k, v| + obj.instance_variable_set("@#{k}", v) + end + + obj end end
Remove creation of accessor methods in attr_accessible
diff --git a/lib/chroot/repository/client/check.rb b/lib/chroot/repository/client/check.rb index abc1234..def5678 100644 --- a/lib/chroot/repository/client/check.rb +++ b/lib/chroot/repository/client/check.rb @@ -7,6 +7,9 @@ class Check < Thor include Chroot::Repository::Client::Helper + + require "chroot/repository/package/groonga" + include Chroot::Repository::Package::Groonga desc "address", "Check upstream address of chroot" def address @@ -20,6 +23,13 @@ desc "build", "Check built packages under chroot" def build + package_dir = File.expand_path(File.dirname(__FILE__) + "/../package") + packages = Dir.glob("#{package_dir}/*.rb").collect do |rb| + File.basename(rb, '.rb') + end + packages.each do |package| + send "check_build_#{package}" if `pwd`.split('/').include?(package) + end end end end
Call external method of package
diff --git a/plugins/guests/suse/cap/change_host_name.rb b/plugins/guests/suse/cap/change_host_name.rb index abc1234..def5678 100644 --- a/plugins/guests/suse/cap/change_host_name.rb +++ b/plugins/guests/suse/cap/change_host_name.rb @@ -6,7 +6,7 @@ machine.communicate.tap do |comm| # Only do this if the hostname is not already set if !comm.test("sudo hostname | grep '#{name}'") - comm.sudo("sed -i 's/\\(HOSTNAME=\\).*/\\1#{name}/' /etc/sysconfig/network") + comm.sudo("echo #{name} > /etc/HOSTNAME") comm.sudo("hostname #{name}") comm.sudo("sed -i 's@^\\(127[.]0[.]0[.]1[[:space:]]\\+\\)@\\1#{name} #{name.split('.')[0]} @' /etc/hosts") end
Fix setting persistent hostname on SLES guests.
diff --git a/activestorage/test/service/azure_storage_service_test.rb b/activestorage/test/service/azure_storage_service_test.rb index abc1234..def5678 100644 --- a/activestorage/test/service/azure_storage_service_test.rb +++ b/activestorage/test/service/azure_storage_service_test.rb @@ -13,7 +13,7 @@ url = @service.url(FIXTURE_KEY, expires_in: 5.minutes, disposition: :inline, filename: ActiveStorage::Filename.new("avatar.png"), content_type: "image/png") - assert_match(/(\S+)&rscd=inline%3B\+filename%3D%22avatar.png%22&rsct=image%2Fpng/, url) + assert_match(/(\S+)&rscd=inline%3B\+filename%3D%22avatar\.png%22%3B\+filename\*%3DUTF-8%27%27avatar\.png&rsct=image%2Fpng/, url) assert_match SERVICE_CONFIGURATIONS[:azure][:container], url end end
Fix `test "signed URL generation"` failure https://travis-ci.org/rails/rails/jobs/281044755#L5582-L5586
diff --git a/spec/localhost/yaml2json_spec.rb b/spec/localhost/yaml2json_spec.rb index abc1234..def5678 100644 --- a/spec/localhost/yaml2json_spec.rb +++ b/spec/localhost/yaml2json_spec.rb @@ -1,4 +1,4 @@-cmd = 'docker run --rm --entrypoint=ash nibdev -c "which yaml2json"' +cmd = 'docker run --rm --entrypoint=ash nibtest -c "which yaml2json"' RSpec.describe command(cmd) do its(:stdout) { should match(/\/usr\/local\/bin\/yaml2json/) }
Use test image when testing yaml2json installation
diff --git a/spec/support/list_spec_helper.rb b/spec/support/list_spec_helper.rb index abc1234..def5678 100644 --- a/spec/support/list_spec_helper.rb +++ b/spec/support/list_spec_helper.rb @@ -0,0 +1,16 @@+shared_examples "a list operation" do + + let(:resource_name) { described_class.to_s.gsub(/^.*::/, '').downcase } + + it "can fetch all resource's occurrences" do + VCR.use_cassette("#{resource_name}/list") do + resources = described_class.all + expect(resources).to be_an(Array) + expect(resources.count).to eq(results_count) + + resource = resources.first + expect(resource).to be_a(described_class) + expect(resource.id).to eq(resource_id) + end + end +end
Create shared example for list operation
diff --git a/code/black_jack.rb b/code/black_jack.rb index abc1234..def5678 100644 --- a/code/black_jack.rb +++ b/code/black_jack.rb @@ -0,0 +1,7 @@+class BlackJack + attr_accessor :deck #this means we can interact with the instance variable @deck + # and we can pretend it is a method: BlackJack.new.deck + def initialize #this runs when BlackJack.new is called + # @deck = + end +end
Create BlackJack class with attr_accessor. Define empty initialize method.
diff --git a/cheffish.gemspec b/cheffish.gemspec index abc1234..def5678 100644 --- a/cheffish.gemspec +++ b/cheffish.gemspec @@ -21,5 +21,6 @@ s.executables = %w( ) s.require_path = 'lib' - s.files = %w(Gemfile Rakefile LICENSE README.md) + Dir.glob("{distro,lib,tasks,spec}/**/*", File::FNM_DOTMATCH).reject {|f| File.directory?(f) } + s.files = %w(Gemfile Rakefile LICENSE README.md) + Dir.glob("*.gemspec") + + Dir.glob("{distro,lib,tasks,spec}/**/*", File::FNM_DOTMATCH).reject {|f| File.directory?(f) } end
Add gemspec files to allow bundler to run from the gem
diff --git a/lib/yummydata/criteria/last_update.rb b/lib/yummydata/criteria/last_update.rb index abc1234..def5678 100644 --- a/lib/yummydata/criteria/last_update.rb +++ b/lib/yummydata/criteria/last_update.rb @@ -4,36 +4,64 @@ module Criteria module LastUpdate - - include Yummydata::Criteria::ServiceDescription include Yummydata::Criteria::VoID - COUNT_QUERY = <<-'SPARQL' -select count (*) where {?s ?p ?o} -SPARQL - - - def initialize(uri) - @client = '' - @uri = uri + def prepare(uri) + @client = SPARQL::Client.new(uri, {'read_timeout': 5 * 60}) if @uri == uri && @client == nil + @uri = uri end def last_modified sd = service_description(@uri) - return sd.dc if sd contains last update + return sd.modified unless sd.modified.nil? - void = void(@uri) - return xxx if void contains last_update + void = void_on_well_known_uri(@uri) + return void.modified unless void.modified.nil? - response = @client.request(MODIFIED_QUERY) - return nil if response.nil? - - response[:last_update] + return nil end - def count_first_last - # DO SOMETHING + def count_statements(uri) + self.prepare(uri) + result = self.query(count_query) + return nil if result.nil? + return result + end + + def first_statement(uri) + self.prepare(uri) + result = self.query(first_statement_query) + return nil if result.nil? + return result + end + + def last_statement(uri, count) + self.prepare(uri) + offset = count - 1 + result = self.query(last_statement_query(offset)) + return nil if result.nil? + return result + end + + def count_query + return "select count (*) AS ?c where {?s ?p ?o}" + end + + def first_statement_query + return "select * where {?s ?p ?o} LIMIT 1" + end + + def offset_statement_query(offset) + return "select * where {?s ?p ?o} OFFSET #{offset} LIMIT 1" + end + + def query(query) + begin + return @client.query(query) + rescue + return nil + end end end
Add the functions that return count of statements and first of statement and arbitrary position of statement
diff --git a/mastermind.rb b/mastermind.rb index abc1234..def5678 100644 --- a/mastermind.rb +++ b/mastermind.rb @@ -2,9 +2,21 @@ class Game #Initialize a new game by setting up a board containing a random code def initialize + protected + @code = "" + 4.times {@code += rand(6).to_s} end #Create a play method to start the game def play + puts "The computer has generated a secret code. Please enter your first guess." + player = Player.new + self.check_guess(player.guess) + end + + #Create a method that checks the guess + def check_guess + #If true: Print the random code and congratulate the player + #If false: Give feedback on the guess end end @@ -13,9 +25,5 @@ #Create a method for the player to enter a guess def guess end -#Create a method that checks the guess - def is_correct? - #If true: Print the random code and congratulate the player - #If false: Give feedback on the guess - end + end
Set up initialize and play methods for Game class
diff --git a/melog.gemspec b/melog.gemspec index abc1234..def5678 100644 --- a/melog.gemspec +++ b/melog.gemspec @@ -9,7 +9,8 @@ gem.files = %w(lib/melog.rb spec/spec_helper.rb spec/melog_spec.rb - README) + README.md + MIT-LICENSE.md) gem.executables << 'melog' gem.homepage = 'http://rubygems.org/gems/melog' end
Add license info to gemspec.
diff --git a/test/test_clone.rb b/test/test_clone.rb index abc1234..def5678 100644 --- a/test/test_clone.rb +++ b/test/test_clone.rb @@ -0,0 +1,21 @@+assert("Namespace.clone") do + begin + system "mkdir -p /tmp/clone.res" + system "rm -rf /tmp/clone.res/*" + + system "ls -l /proc/self/ns/pid > /tmp/clone.res/parent.pid.txt" + system "ls -l /proc/self/ns/mnt > /tmp/clone.res/parent.mnt.txt" + + pid = Namespace.clone(Namespace::CLONE_NEWPID) do + system "ls -l /proc/self/ns/pid > /tmp/clone.res/cloned.pid.txt" + system "ls -l /proc/self/ns/mnt > /tmp/clone.res/cloned.mnt.txt" + end + Process.waitpid pid + + ret = system "diff -q /tmp/clone.res/parent.mnt.txt /tmp/clone.res/cloned.mnt.txt >/dev/null" + assert_true ret + + ret = system "diff -q /tmp/clone.res/parent.pid.txt /tmp/clone.res/cloned.pid.txt >/dev/null" + assert_false ret + end +end
Check that namespaces are in proper status
diff --git a/test/test_query.rb b/test/test_query.rb index abc1234..def5678 100644 --- a/test/test_query.rb +++ b/test/test_query.rb @@ -10,4 +10,12 @@ assert_equal q.respond_to?(:map), true end + def test_order_criteria + q = Query.new(self).order("created_at DESC") + assert_equal "-created_at", q.criteria[:order] + + q = Query.new(self).order("created_at") + assert_equal "created_at", q.criteria[:order] + end + end
[test] Add test case for query order
diff --git a/puppet-lint-no_cron_resources-check.gemspec b/puppet-lint-no_cron_resources-check.gemspec index abc1234..def5678 100644 --- a/puppet-lint-no_cron_resources-check.gemspec +++ b/puppet-lint-no_cron_resources-check.gemspec @@ -18,7 +18,7 @@ EOF spec.add_dependency 'puppet-lint', '>= 1.1', '< 3.0' - spec.add_development_dependency 'rspec', '~> 3.5.0' + spec.add_development_dependency 'rspec', '~> 3.8.0' spec.add_development_dependency 'rspec-its', '~> 1.0' spec.add_development_dependency 'rspec-collection_matchers', '~> 1.0' spec.add_development_dependency 'rubocop', '~> 0.47.1'
Update rspec requirement from ~> 3.5.0 to ~> 3.8.0 Updates the requirements on [rspec](https://github.com/rspec/rspec) to permit the latest version. - [Release notes](https://github.com/rspec/rspec/releases) - [Commits](https://github.com/rspec/rspec/compare/v3.5.0...v3.8.0) Signed-off-by: dependabot-preview[bot] <5bdcd3c0d4d24ae3e71b3b452a024c6324c7e4bb@dependabot.com>
diff --git a/config/initializers/routing.rb b/config/initializers/routing.rb index abc1234..def5678 100644 --- a/config/initializers/routing.rb +++ b/config/initializers/routing.rb @@ -0,0 +1,59 @@+# Adds run route to all satellites +require 'action_dispatch/routing/mapper' + +module ActionDispatch::Routing::Mapper::Resources + def resource(*resources, &block) + options = resources.extract_options!.dup + + if apply_common_behavior_for(:resource, resources, options, &block) + return self + end + + resource_scope(:resource, SingletonResource.new(resources.pop, options)) do + yield if block_given? + + concerns(options[:concerns]) if options[:concerns] + + collection do + post :create if parent_resource.actions.include?(:create) + post :run if @scope[:as] == 'satellites' + end + + new do + get :new + end if parent_resource.actions.include?(:new) + + set_member_mappings_for_resource + end + + self + end + + def resources(*resources, &block) + options = resources.extract_options!.dup + + if apply_common_behavior_for(:resources, resources, options, &block) + return self + end + + resource_scope(:resources, Resource.new(resources.pop, options)) do + yield if block_given? + + concerns(options[:concerns]) if options[:concerns] + + collection do + get :index if parent_resource.actions.include?(:index) + post :create if parent_resource.actions.include?(:create) + post :run if @scope[:as] == 'satellites' + end + + new do + get :new + end if parent_resource.actions.include?(:new) + + set_member_mappings_for_resource + end + + self + end +end
Add run route to all satellite resources
diff --git a/config/initializers/stathat.rb b/config/initializers/stathat.rb index abc1234..def5678 100644 --- a/config/initializers/stathat.rb +++ b/config/initializers/stathat.rb @@ -9,17 +9,15 @@ StatHat::API.ez_post_value("Response Time", ENV["STAT_ACCOUNT"], duration) if duration > 500 StatHat::API.ez_post_count("Slow Requests", ENV["STAT_ACCOUNT"], 1) - end - if duration > 100 instLog.debug("[action] #{payload[:method]} #{payload[:path]} #{duration}ms") end end ActiveSupport::Notifications.subscribe "sql.active_record" do |name, start, finish, id, payload| - if payload[:sql] + if payload[:name] == 'SQL' duration = (finish - start) * 1000 StatHat::API.ez_post_value("DB Query", ENV["STAT_ACCOUNT"], duration) - if duration > 50 + if duration > 500 instLog.debug("[sql] #{payload[:name]} '#{payload[:sql]}' #{duration}ms") end end
Increase logging threshold and revert sql log condition
diff --git a/plink2.rb b/plink2.rb index abc1234..def5678 100644 --- a/plink2.rb +++ b/plink2.rb @@ -7,12 +7,17 @@ sha256 "2f4afc193c288b13af4410e4587358ee0a6f76ed7c98dd77ca1317aac28adf0d" depends_on :fortran - depends_on "openblas" + depends_on "openblas" => :optional + depends_on "homebrew/dupes/zlib" def install mv "Makefile.std", "Makefile" - system "./plink_first_compile" - system "make", "plink" + ln_s Formula["zlib"].opt_include, "zlib-1.2.8" + cflags = "-Wall -O2 -flax-vector-conversions" + cflags += " -I#{Formula["openblas"].opt_include}" if build.with? "openblas" + args = ["CFLAGS=#{cflags}", "ZLIB=-L#{Formula["zlib"].opt_lib} -lz"] + args << "BLASFLAGS=-L#{Formula["openblas"].opt_lib} -lopenblas" if build.with? "openblas" + system "make", "plink", *args bin.install "plink" => "plink2" end
Plink2: Use brewed zlib and OpenBLAS. Fixes #1957. Closes #2084. Signed-off-by: Dominique Orban <b6b12199b0ff1342bf41262c4fcd3a561907b571@gmail.com>
diff --git a/plugin.rb b/plugin.rb index abc1234..def5678 100644 --- a/plugin.rb +++ b/plugin.rb @@ -28,7 +28,7 @@ end end - Rails.application.routes.draw do + Discourse::Application.routes.append do get "session/sso_redirect" => "session#sso" end end
Switch to using a better (?) route.append
diff --git a/lib/metro/models/ui/tmx/orthogonal_position.rb b/lib/metro/models/ui/tmx/orthogonal_position.rb index abc1234..def5678 100644 --- a/lib/metro/models/ui/tmx/orthogonal_position.rb +++ b/lib/metro/models/ui/tmx/orthogonal_position.rb @@ -6,7 +6,7 @@ def position_of_image(image,row,column) pos_x = x + column * map.tilewidth + map.tilewidth / 2 pos_y = y + row * map.tileheight + map.tileheight / 2 - Bounds.new left: pos_x, top: pos_y, right: pos_x + map.tilewidth, bottom: pos_y + map.tileheight/2 + ::Metro::Units::RectangleBounds.new left: pos_x, top: pos_y, right: pos_x + map.tilewidth, bottom: pos_y + map.tileheight/2 end end
FIX specific name for the Bounds
diff --git a/config/initializers/content_security_policy.rb b/config/initializers/content_security_policy.rb index abc1234..def5678 100644 --- a/config/initializers/content_security_policy.rb +++ b/config/initializers/content_security_policy.rb @@ -14,7 +14,7 @@ # # Specify URI for violation reports # # policy.report_uri "/csp-violation-report-endpoint" - policy.script_src :self, :https, :unsafe_inline + policy.script_src :self, :https, :unsafe_inline, :unsafe_eval end # If you are using UJS then enable automatic nonce generation
Allow eval in prod environment, to support use of Vue templates
diff --git a/puppet-lint-no_cron_resources-check.gemspec b/puppet-lint-no_cron_resources-check.gemspec index abc1234..def5678 100644 --- a/puppet-lint-no_cron_resources-check.gemspec +++ b/puppet-lint-no_cron_resources-check.gemspec @@ -21,7 +21,7 @@ spec.add_development_dependency 'rspec', '~> 3.9.0' spec.add_development_dependency 'rspec-its', '~> 1.0' spec.add_development_dependency 'rspec-collection_matchers', '~> 1.0' - spec.add_development_dependency 'rubocop', '~> 0.80.0' + spec.add_development_dependency 'rubocop', '~> 0.81.0' spec.add_development_dependency 'rake', '~> 13.0.0' spec.add_development_dependency 'rspec-json_expectations', '~> 2.2' spec.add_development_dependency 'simplecov', '~> 0.18.0'
Update rubocop requirement from ~> 0.80.0 to ~> 0.81.0 Updates the requirements on [rubocop](https://github.com/rubocop-hq/rubocop) to permit the latest version. - [Release notes](https://github.com/rubocop-hq/rubocop/releases) - [Changelog](https://github.com/rubocop-hq/rubocop/blob/master/CHANGELOG.md) - [Commits](https://github.com/rubocop-hq/rubocop/compare/v0.80.0...v0.81.0) Signed-off-by: dependabot-preview[bot] <5bdcd3c0d4d24ae3e71b3b452a024c6324c7e4bb@dependabot.com>
diff --git a/lib/active_merchant/billing/gateways/paypal_uk.rb b/lib/active_merchant/billing/gateways/paypal_uk.rb index abc1234..def5678 100644 --- a/lib/active_merchant/billing/gateways/paypal_uk.rb +++ b/lib/active_merchant/billing/gateways/paypal_uk.rb @@ -8,6 +8,10 @@ self.supported_countries = ['UK'] self.homepage_url = 'https://www.paypal-business.co.uk/process-online-payments-with-paypal/index.htm' self.display_name = 'PayPal Website Payments Pro (UK)' + + def express + @express ||= PaypalExpressUkGateway.new(@options) + end end end end
Initialize the correct express gateway for PayPal Express Checkout (UK).
diff --git a/lib/module/interface.rb b/lib/module/interface.rb index abc1234..def5678 100644 --- a/lib/module/interface.rb +++ b/lib/module/interface.rb @@ -24,10 +24,12 @@ # end #=> NotImplementedError "shortage methods: [:walk]" # end def interface(mod) + wants = mod.instance_methods(false) | mod.private_instance_methods(false) + yield - - shortages = (mod.instance_methods(false) | mod.private_instance_methods(false)) - \ - (instance_methods(false) | private_instance_methods(false)) + + havings = instance_methods(false) | private_instance_methods(false) + shortages = wants - havings unless shortages.empty? raise NotImplementedError, "shortage methods: #{shortages.inspect}"
Refactor with unspec timing changed
diff --git a/lib/mongoid-ancestry.rb b/lib/mongoid-ancestry.rb index abc1234..def5678 100644 --- a/lib/mongoid-ancestry.rb +++ b/lib/mongoid-ancestry.rb @@ -3,12 +3,14 @@ extend ActiveSupport::Concern autoload :ClassMethods, 'mongoid-ancestry/class_methods' - autoload :InstanceMethods, 'mongoid-ancestry/instance_methods' autoload :Error, 'mongoid-ancestry/exceptions' included do cattr_accessor :base_class self.base_class = self + + require 'mongoid-ancestry/instance_methods' + include InstanceMethods end end end
Include instance methods manually to avoid ActiveSupport::Concern InstanceMethods deprecation notice
diff --git a/lib/bootsy/simple_form/bootsy_input.rb b/lib/bootsy/simple_form/bootsy_input.rb index abc1234..def5678 100644 --- a/lib/bootsy/simple_form/bootsy_input.rb +++ b/lib/bootsy/simple_form/bootsy_input.rb @@ -6,7 +6,14 @@ def input(wrapper_options = nil) bootsy_params = [:editor_options, :container, :uploader] input_html_options.merge!(input_options.select {|k,v| bootsy_params.include?(k) }) - merged_input_options = merge_wrapper_options(input_html_options, wrapper_options) + + # Check presence of `merge_wrapper_options` to keep + # compatibility with both Simple Form 3.0 and 3.1. + merged_input_options = if respond_to?(:merge_wrapper_options, true) + merge_wrapper_options(input_html_options, wrapper_options) + else + input_html_options + end @builder.bootsy_area(attribute_name, merged_input_options) end
Fix compatibility with Simple Form `3.0`.
diff --git a/lib/sous_chef/recipe.rb b/lib/sous_chef/recipe.rb index abc1234..def5678 100644 --- a/lib/sous_chef/recipe.rb +++ b/lib/sous_chef/recipe.rb @@ -19,8 +19,17 @@ @flags.include?(:verbose) end - def execute(name = nil, &block) - @resources << Resource::Execute.new(self, name, &block) + def execute(*args, &block) + @resources << Resource::Execute.new(self, *args, &block) + end + + def file(*args, &block) + @resources << Resource::File.new(self, *args, &block) + end + + def directory(*args, &block) + @resources << Resource::Directory.new(self, *args, &block) + end end protected
Add file and directory methods to Recipe.
diff --git a/db/seeds/default/250_users.rb b/db/seeds/default/250_users.rb index abc1234..def5678 100644 --- a/db/seeds/default/250_users.rb +++ b/db/seeds/default/250_users.rb @@ -1,5 +1,5 @@ module Renalware - log "--------------------Adding Users--------------------" + log "--------------------Adding System User--------------------" Renalware::User.create!( given_name: 'System', family_name: 'User', @@ -9,5 +9,5 @@ approved: true, signature: 'System User' ) - log "1 User seeded" + log "1 System User created" end
Tweak add System User log
diff --git a/lib/texas/task/watch.rb b/lib/texas/task/watch.rb index abc1234..def5678 100644 --- a/lib/texas/task/watch.rb +++ b/lib/texas/task/watch.rb @@ -8,7 +8,7 @@ end def run - self.class.run_options = options + self.class.run_options = options.to_h.merge(:task => :build) dirs = Task::Watch.directories_to_watch Listen.to(*dirs) do |modified, added, removed| Task::Watch.rebuild @@ -39,7 +39,7 @@ def rebuild started_at = Time.now.to_i - Build.run_with_nice_errors Build::Final.new(run_options) + Texas::Runner.new(run_options) finished_at = Time.now.to_i time = finished_at - started_at trace TraceInfo.new(:rebuild, "in #{time} seconds", :green)
Use Texas::Runner in Watch task instead of Texas::Build::Final
diff --git a/lib/active_model_serializers/namespaces.rb b/lib/active_model_serializers/namespaces.rb index abc1234..def5678 100644 --- a/lib/active_model_serializers/namespaces.rb +++ b/lib/active_model_serializers/namespaces.rb @@ -26,7 +26,8 @@ end end - found_class && (found_class.new *args) + found_class ||= ActiveModel::DefaultSerializer + found_class.new *args end end
Use DefaultSerializer when there is no custom one
diff --git a/db/migrate/6_change_point_amounts_to_floats.rb b/db/migrate/6_change_point_amounts_to_floats.rb index abc1234..def5678 100644 --- a/db/migrate/6_change_point_amounts_to_floats.rb +++ b/db/migrate/6_change_point_amounts_to_floats.rb @@ -1,6 +1,10 @@ class ChangePointAmountsToFloats < ActiveRecord::Migration - def change + def up change_column :scorecard_points, :amount, :decimal, null: false, - precision: 10 + precision: 10, scale: 6 + end + + def down + change_column :scorecard_points, :amount, :integer end end
Scale matters, and we don't want a default of zero.
diff --git a/lib/itamae/plugin/recipe/selinux/common.rb b/lib/itamae/plugin/recipe/selinux/common.rb index abc1234..def5678 100644 --- a/lib/itamae/plugin/recipe/selinux/common.rb +++ b/lib/itamae/plugin/recipe/selinux/common.rb @@ -1,4 +1,4 @@-case os[:family] +case node[:platform] when %r(debian|ubuntu) package 'selinux-utils' when %r(redhat|fedora)
Use node[:platform] instead of os[:family]
diff --git a/app/models/champs/linked_drop_down_list_champ.rb b/app/models/champs/linked_drop_down_list_champ.rb index abc1234..def5678 100644 --- a/app/models/champs/linked_drop_down_list_champ.rb +++ b/app/models/champs/linked_drop_down_list_champ.rb @@ -1,27 +1,28 @@ class Champs::LinkedDropDownListChamp < Champ - attr_reader :primary_value, :secondary_value delegate :primary_options, :secondary_options, to: :type_de_champ - after_initialize :unpack_value + def primary_value + if value.present? + JSON.parse(value)[0] + else + '' + end + end - def unpack_value + def secondary_value if value.present? - primary, secondary = JSON.parse(value) + JSON.parse(value)[1] else - primary = secondary = '' + '' end - @primary_value ||= primary - @secondary_value ||= secondary end def primary_value=(value) - @primary_value = value - pack_value + pack_value(value, secondary_value) end def secondary_value=(value) - @secondary_value = value - pack_value + pack_value(primary_value, value) end def main_value_name @@ -46,7 +47,7 @@ "#{primary_value || ''};#{secondary_value || ''}" end - def pack_value - self.value = JSON.generate([ primary_value, secondary_value ]) + def pack_value(primary, secondary) + self.value = JSON.generate([ primary, secondary ]) end end
Fix comportement chelou in LinkedDropDownListChamp
diff --git a/scripts/admin/check-package-dependencies.rb b/scripts/admin/check-package-dependencies.rb index abc1234..def5678 100644 --- a/scripts/admin/check-package-dependencies.rb +++ b/scripts/admin/check-package-dependencies.rb @@ -0,0 +1,26 @@+#! /usr/bin/env ruby + +# This script takes two arguments: +# 1. The name of a package - ex. ejson +# 2. The name of an export - ex. EJSON +# It makes sure that if the export appears somewhere in package source code, the +# name of the package appears somewhere in package.js for that package. + +root = File.join(File.dirname(__FILE__), "..", ".."); + +Dir.chdir(root) + +file_list = `git grep -l '#{ARGV[0]}' packages/`.lines +package_list = file_list.map do |filename| + filename.split("/")[1] +end + +package_list = package_list.uniq + +package_list.each do |p| + unless File.open("packages/#{p}/package.js").read.include? ARGV[1] + puts "'#{ARGV[0]}' appears in #{p} but '#{ARGV[1]}' not in package.js. Files:" + puts `git grep -l '#{ARGV[0]}' packages/#{p}/` + puts "" + end +end
Add script to check dependencies
diff --git a/app/api/activity_types_public_api.rb b/app/api/activity_types_public_api.rb index abc1234..def5678 100644 --- a/app/api/activity_types_public_api.rb +++ b/app/api/activity_types_public_api.rb @@ -0,0 +1,16 @@+require 'grape' + +module Api + class ActivityTypesPublicApi < Grape::API + + desc "Get the activity type details" + get '/activity_types/:id' do + ActivityType.find(params[:id]) + end + + desc 'Get all the activity types' + get '/activity_types' do + ActivityType.all + end + end +end
NEW: Create activity type public api
diff --git a/app/controllers/errors_controller.rb b/app/controllers/errors_controller.rb index abc1234..def5678 100644 --- a/app/controllers/errors_controller.rb +++ b/app/controllers/errors_controller.rb @@ -3,8 +3,7 @@ class ErrorsController < ApplicationController def error_404 respond_to do |format| - format.html { render template: 'errors/not_found', status: 404 } - format.all { render nothing: true, status: 404 } + format.all { render template: 'errors/not_found', status: 404 } end end end
Add all formats to the errors controller
diff --git a/app/controllers/trails_controller.rb b/app/controllers/trails_controller.rb index abc1234..def5678 100644 --- a/app/controllers/trails_controller.rb +++ b/app/controllers/trails_controller.rb @@ -9,6 +9,7 @@ def show @trail = Trail.find(params[:id]) @comments = @trail.comments + @comment = Comment.new render :show end
Create new comment for comment form
diff --git a/lang/en_US.rb b/lang/en_US.rb index abc1234..def5678 100644 --- a/lang/en_US.rb +++ b/lang/en_US.rb @@ -8,7 +8,7 @@ l.store "he_IL", "Hebrew" l.store "it_IT", "Italian" l.store "ja_JP", "Japanese" - l.store "lt_LT", "Lituanian" + l.store "lt_LT", "Lithuanian" l.store "nb_NO", "Norwegian" l.store "nl_NL", "Nederland" l.store "pl_PL", "Polish"
Fix typo in English language names [merges branch 'randomecho/copyedits']
diff --git a/app_prototype/spec/features/registration_spec.rb b/app_prototype/spec/features/registration_spec.rb index abc1234..def5678 100644 --- a/app_prototype/spec/features/registration_spec.rb +++ b/app_prototype/spec/features/registration_spec.rb @@ -35,7 +35,20 @@ it "sends the activation email" do expect(open_email(@email)).to_not be_nil - expect(current_email).to have_content "/sign_up/#{@user.activation_token}/activate" + expect(current_email).to have_content "/sign_up/#{@user.activation_token}/activate" # FIXME + end + end + + context "unsuccessful registration" do + it "redirects to new" do + visit sign_up_path + within '#new_user' do + fill_in 'Email', with: 'INVALID EMAIL' + fill_in 'Name', with: 'Stan' + fill_in 'Password', with: 'p@ssword' + click_button 'Sign up' + end + expect(current_path).to eq sign_up_path end end end
Add unsuccessful registration acceptance coverage
diff --git a/recipes/configure.rb b/recipes/configure.rb index abc1234..def5678 100644 --- a/recipes/configure.rb +++ b/recipes/configure.rb @@ -26,12 +26,6 @@ notifies :restart, "service[php-fpm]" end -unless node['php-fpm']['pools'].key?('www') - php_fpm_pool 'www' do - enable false - end -end - if node['php-fpm']['pools'] node['php-fpm']['pools'].each do |pool| if pool.is_a?(Array)
Remove disabling of the default www pool from the recipe It is easier to use attributes to disable if we've to
diff --git a/whitesimilarity.gemspec b/whitesimilarity.gemspec index abc1234..def5678 100644 --- a/whitesimilarity.gemspec +++ b/whitesimilarity.gemspec @@ -13,7 +13,7 @@ spec.homepage = '' spec.license = 'MIT' - spec.files = `git ls-files`.split($/).reject { |f| f =~ %r{^ext/whitesimilarity/lib/.*} } + 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.require_paths = ['lib']
Remove 'spec.files' filtering via 'reject' method call because it's no longer needed
diff --git a/config/routes.rb b/config/routes.rb index abc1234..def5678 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -31,5 +31,5 @@ resources :users resources :books resources :account_activations, only: [:edit] - resources :password_resets, only: [:new, :create, :update] + resources :password_resets, only: [:new, :create, :edit, :update] end
Add edit route to pw reset
diff --git a/config/routes.rb b/config/routes.rb index abc1234..def5678 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,4 +1,4 @@-ActionController::Routing::Routes.draw do |map| +Rails.application.routes.draw do |map| map.namespace('tolk') do |tolk| tolk.root :controller => 'locales' tolk.resources :locales, :member => {:all => :get, :updated => :get}
Use Rails 3 route syntax
diff --git a/config/routes.rb b/config/routes.rb index abc1234..def5678 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -5,8 +5,8 @@ resources :dependencies resources :logs - root 'errors#pardon' - get '/*any_route', to: 'errors#pardon', as: 'pardon' + # root 'errors#pardon' + # get '/*any_route', to: 'errors#pardon', as: 'pardon' resources :searches, path: 's'
Remove “Pardon our dust...” message
diff --git a/config/routes.rb b/config/routes.rb index abc1234..def5678 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -8,5 +8,10 @@ r.post "/routes/commit" => "routes#commit" r.get "/healthcheck" => proc { [200, {}, %w[OK]] } + + r.get "/healthcheck/live", to: proc { [200, {}, %w[OK]] } + r.get "/healthcheck/ready", to: GovukHealthcheck.rack_response( + GovukHealthcheck::Mongoid, + ) end end
Add RFC 141 healthcheck endpoints I've added another check to this because it uses mongodb. Once govuk-puppet has been updated, the old endpoint can be removed. See the RFC for more details.
diff --git a/spec/controllers/queries_controller_spec.rb b/spec/controllers/queries_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/queries_controller_spec.rb +++ b/spec/controllers/queries_controller_spec.rb @@ -20,7 +20,7 @@ context "POST #bing_create" do it "increments the Query count" do expect { - post :create, language_id: language.id, query: { :title => "Test", :english => "hey" } + post :bing_create, language_id: language.id, query: { :title => "Test", :english => "hey" } }.to change{Query.count}.by(1) end end
Fix bing_create test - now test cov is 83%
diff --git a/spec/lib/cloud_cost_tracker/tracker_spec.rb b/spec/lib/cloud_cost_tracker/tracker_spec.rb index abc1234..def5678 100644 --- a/spec/lib/cloud_cost_tracker/tracker_spec.rb +++ b/spec/lib/cloud_cost_tracker/tracker_spec.rb @@ -15,7 +15,7 @@ resource = FAKE_AWS.servers.new resource.stub(:tracker_account).and_return(FAKE_ACCOUNT) resource.stub(:identity).and_return "fake server ID" - @resource.stub(:status).and_return "running" + resource.stub(:status).and_return "running" FogTracker::AccountTracker.any_instance.stub(:all_resources). and_return([ resource ]) @tracker.update
Fix typo in Tracker test
diff --git a/spec/unit/recipes/module_http_geoip_spec.rb b/spec/unit/recipes/module_http_geoip_spec.rb index abc1234..def5678 100644 --- a/spec/unit/recipes/module_http_geoip_spec.rb +++ b/spec/unit/recipes/module_http_geoip_spec.rb @@ -10,7 +10,6 @@ it 'retrieves remote files to cache' do geoip_version = chef_run.node.attributes['nginx']['geoip']['lib_version'] - expect(chef_run).to create_remote_file("#{Chef::Config['file_cache_path']}/GeoIP-#{geoip_version}.tar.gz") expect(chef_run).to create_remote_file("#{Chef::Config['file_cache_path']}/GeoIP.dat.gz") expect(chef_run).to create_remote_file("#{Chef::Config['file_cache_path']}/GeoLiteCity.dat.gz") end @@ -20,7 +19,6 @@ end it 'expands the retrieved files' do - expect(chef_run).to run_bash('extract_geolib') expect(chef_run).to run_bash('gunzip_geo_lite_country_dat') expect(chef_run).to run_bash('gunzip_geo_lite_city_dat') end
Remove tests for geoip library code extraction (which we no longer do)
diff --git a/test/unit/client_interface_sections/history_test.rb b/test/unit/client_interface_sections/history_test.rb index abc1234..def5678 100644 --- a/test/unit/client_interface_sections/history_test.rb +++ b/test/unit/client_interface_sections/history_test.rb @@ -16,4 +16,37 @@ assert_equal FHIR::Formats::ResourceFormat::RESOURCE_JSON_DSTU2, reply.request[:headers]['format'] end + def test_history_uses_default_xml_dstu2 + stub_request(:get, /history-test/).to_return(body: '{"resourceType":"Bundle"}') + + temp = client + temp.use_dstu2 + temp.default_xml + + reply = temp.all_history + assert_equal FHIR::Formats::ResourceFormat::RESOURCE_XML_DSTU2, reply.request[:headers]['format'] + end + + def test_history_uses_default_json_stu3 + stub_request(:get, /history-test/).to_return(body: '{"resourceType":"Bundle"}') + + temp = client + temp.use_stu3 + temp.default_json + + reply = temp.all_history + assert_equal FHIR::Formats::ResourceFormat::RESOURCE_JSON, reply.request[:headers]['format'] + end + + def test_history_uses_default_xml_stu3 + stub_request(:get, /history-test/).to_return(body: '{"resourceType":"Bundle"}') + + temp = client + temp.use_stu3 + temp.default_xml + + reply = temp.all_history + assert_equal FHIR::Formats::ResourceFormat::RESOURCE_XML, reply.request[:headers]['format'] + end + end
Add history tests for other resource formats
diff --git a/zencoder-rb.gemspec b/zencoder-rb.gemspec index abc1234..def5678 100644 --- a/zencoder-rb.gemspec +++ b/zencoder-rb.gemspec @@ -0,0 +1,22 @@+# -*- encoding: utf-8 -*- +lib = File.expand_path('../lib/', __FILE__) +$:.unshift lib unless $:.include?(lib) + +require 'zencoder/version' + +Gem::Specification.new do |s| + s.name = "zencoder" + s.version = Zencoder::VERSION + s.platform = Gem::Platform::RUBY + s.authors = "Nathan Sutton" + s.email = "nate@zencoder.com" + s.homepage = "http://github.com/zencoder/zencoder-rb" + s.summary = "Zencoder integration library." + s.description = "Zencoder integration library." + s.rubyforge_project = "zencoder" + s.add_dependency "json" + s.add_development_dependency "shoulda" + s.add_development_dependency "mocha" + s.files = Dir.glob("lib/**/*") + %w(LICENSE README.markdown Rakefile) + s.require_path = 'lib' +end
Add first version of the gemspec
diff --git a/Casks/mamp.rb b/Casks/mamp.rb index abc1234..def5678 100644 --- a/Casks/mamp.rb +++ b/Casks/mamp.rb @@ -1,9 +1,9 @@ class Mamp < Cask - url 'http://downloads8.mamp.info/MAMP-PRO/releases/3.0.2/MAMP_MAMP_PRO_3.0.2.pkg' + url 'http://downloads2.mamp.info/MAMP-PRO/releases/3.0.3/MAMP_MAMP_PRO_3.0.3.pkg' homepage 'http://www.mamp.info/en/index.html' - version '3.0.2' - sha256 '060cc78b6457776a64a864ee69de7e52c95ac2332e906fe4b4afb65826207315' - install 'MAMP_MAMP_PRO_3.0.2.pkg' + version '3.0.3' + sha256 '1e23c4777a91e7d4181afb8865dc84e1b07ff01d67c843299834e6f8c747e9da' + install 'MAMP_MAMP_PRO_3.0.3.pkg' after_install do system '/usr/bin/sudo', '-E', '--', '/usr/sbin/chown', '-R', "#{Etc.getpwuid(Process.euid).name}:staff", '/Applications/MAMP', '/Applications/MAMP PRO'
Update MAMP to version 3.0.3
diff --git a/Casks/mamp.rb b/Casks/mamp.rb index abc1234..def5678 100644 --- a/Casks/mamp.rb +++ b/Casks/mamp.rb @@ -4,7 +4,7 @@ url "http://downloads.mamp.info/MAMP-PRO/releases/#{version}/MAMP_MAMP_PRO_#{version}.pkg" name 'MAMP' - homepage 'http://www.mamp.info/' + homepage 'https://www.mamp.info/' license :unknown # todo: change license and remove this comment; ':unknown' is a machine-generated placeholder pkg "MAMP_MAMP_PRO_#{version}.pkg"
Fix homepage to use SSL in MAMP Cask The HTTP URL is already getting redirected to HTTPS. Using the HTTPS URL directly makes it more secure and saves a HTTP round-trip.
diff --git a/lib/console-vmc-plugin/plugin.rb b/lib/console-vmc-plugin/plugin.rb index abc1234..def5678 100644 --- a/lib/console-vmc-plugin/plugin.rb +++ b/lib/console-vmc-plugin/plugin.rb @@ -23,7 +23,7 @@ end filter(:start, :start_app) do |app| - if app.framework.name == "rails3" + if app.framework.name == "rails3" || app.framework.name == "buildpack" app.console = true end
Provision console port for buildpack framework Change-Id: I7572a97f328cfe60791ac89dd41650774a2afdfd
diff --git a/spec/controllers/cohorts_controller_spec.rb b/spec/controllers/cohorts_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/cohorts_controller_spec.rb +++ b/spec/controllers/cohorts_controller_spec.rb @@ -0,0 +1,22 @@+require 'rails_helper' + +describe CohortsController do + render_views + + describe '#students' do + let(:course) { create(:course) } + let(:cohort) { create(:cohort) } + let(:student) { create(:user) } + + before do + cohort.courses << course + create(:courses_user, course_id: course.id, user_id: student.id, + role: CoursesUsers::Roles::STUDENT_ROLE) + end + + it 'returns a csv of student usernames' do + get :students, slug: cohort.slug, format: :csv + expect(response.body).to have_content(student.username) + end + end +end
Add spec for cohort student CSVs
diff --git a/Casks/rubymine633.rb b/Casks/rubymine633.rb index abc1234..def5678 100644 --- a/Casks/rubymine633.rb +++ b/Casks/rubymine633.rb @@ -2,17 +2,30 @@ version '6.3.3' sha256 'c79216de02f2564ea60592420342ab9fb5014da7e7c96f92e2856dc49f2090dd' - url "http://download-cf.jetbrains.com/ruby/RubyMine-#{version}.dmg" - homepage 'http://www.jetbrains.com/ruby/' - license :unknown + url "https://download.jetbrains.com/ruby/RubyMine-#{version}.dmg" + name 'RubyMine' + homepage 'https://confluence.jetbrains.com/display/RUBYDEV/Previous+RubyMine+Releases' + license :commercial app 'RubyMine.app' - postflight do - plist_set(':JVMOptions:JVMVersion', '1.6+') - end zap :delete => [ - "~/Library/Application Support/RubyMine#{version.gsub('.','')}", - "~/Library/Preferences/RubyMine#{version.gsub('.','')}", + '~/Library/Preferences/com.jetbrains.rubymine.plist', + '~/Library/Preferences/RubyMine60', + '~/Library/Application Support/RubyMine60', + '~/Library/Caches/RubyMine60', + '~/Library/Logs/RubyMine60', + '/usr/local/bin/mine', ] + + caveats <<-EOS.undent + #{token} requires Java 6 like any other IntelliJ-based IDE. + You can install it with + + brew cask install caskroom/homebrew-versions/java6 + + The vendor (JetBrains) doesn't support newer versions of Java (yet) + due to several critical issues, see details at + https://intellij-support.jetbrains.com/entries/27854363 + EOS end
Clean up RubyMine 6.3.3 formula - Unify with other IntelliJ-based formulas (see #879)
diff --git a/Casks/sketch-beta.rb b/Casks/sketch-beta.rb index abc1234..def5678 100644 --- a/Casks/sketch-beta.rb +++ b/Casks/sketch-beta.rb @@ -1,8 +1,8 @@ class SketchBeta < Cask - version '3.1' - sha256 'b567fe5ed071822d8917573d52e93acdc921dc924b77eee9ede2a41e88ce03ba' + version '3.1.1' + sha256 '4d4785f3356079f224bd64302ab17e651ba00752e364f08f146e67196a0a0fbc' - url 'https://rink.hockeyapp.net/api/2/apps/0172d48cceec171249a8d850fb16276b/app_versions/37?format=zip&avtoken=985ff642ddb110cfeb7998ffbc5993ef80bbfcf7' + url 'https://rink.hockeyapp.net/api/2/apps/0172d48cceec171249a8d850fb16276b/app_versions/49?format=zip&avtoken=2ab011a5b37200a2947be20cb2dd21af7af9265c' homepage 'http://bohemiancoding.com/sketch/beta/' license :unknown
Upgrade Sketch Beta to v3.1.1
diff --git a/spec/integration/struct_as_embedded_value_spec.rb b/spec/integration/struct_as_embedded_value_spec.rb index abc1234..def5678 100644 --- a/spec/integration/struct_as_embedded_value_spec.rb +++ b/spec/integration/struct_as_embedded_value_spec.rb @@ -0,0 +1,28 @@+require 'spec_helper' + +describe 'Using Struct as an embedded value attribute' do + before do + module Examples + Point = Struct.new(:x, :y) + + class Rectangle + include Virtus + + attribute :top_left, Point + attribute :bottom_right, Point + end + end + end + + subject do + Examples::Rectangle.new(top_left: [ 3, 5 ], bottom_right: [ 8, 7 ]) + end + + specify 'initialize a struct object with correct attributes' do + subject.top_left.x.should be(3) + subject.top_left.y.should be(5) + + subject.bottom_right.x.should be(8) + subject.bottom_right.y.should be(7) + end +end
Add an integration spec for Struct as an EV
diff --git a/spec/views/gend_image_pages/show.html.erb_spec.rb b/spec/views/gend_image_pages/show.html.erb_spec.rb index abc1234..def5678 100644 --- a/spec/views/gend_image_pages/show.html.erb_spec.rb +++ b/spec/views/gend_image_pages/show.html.erb_spec.rb @@ -2,10 +2,10 @@ describe "gend_image_pages/show.html.erb" do - let(:gend_image) { FactoryGirl.create(:gend_image, :work_in_progress => false) } + let(:gend_image) { FactoryGirl.create(:gend_image, work_in_progress: false) } let(:src_image) { FactoryGirl.create(:src_image) } let(:gend_image_url) { - url_for(:controller => :gend_images, :action => :show, :id => gend_image.id_hash) + url_for(controller: :gend_images, action: :show, id: gend_image.id_hash) } let(:android) { false }
Use ruby 1.9 style hashes.
diff --git a/app/controllers/api/payment/braintree_controller.rb b/app/controllers/api/payment/braintree_controller.rb index abc1234..def5678 100644 --- a/app/controllers/api/payment/braintree_controller.rb +++ b/app/controllers/api/payment/braintree_controller.rb @@ -17,7 +17,10 @@ def one_click @result = client::OneClick.new(unsafe_params, cookies.signed[:payment_methods]).run - render status: :unprocessable_entity unless @result.success? + unless @result.success? + @errors = client::ErrorProcessing.new(@result, locale: locale).process + render status: :unprocessable_entity, errors: @errors + end end private
[wip] Return errors with express donations
diff --git a/app/controllers/api/v1/proof_attempts_controller.rb b/app/controllers/api/v1/proof_attempts_controller.rb index abc1234..def5678 100644 --- a/app/controllers/api/v1/proof_attempts_controller.rb +++ b/app/controllers/api/v1/proof_attempts_controller.rb @@ -13,6 +13,41 @@ end end + def used_axioms + respond_to do |format| + format.json do + render json: resource.used_axioms, + each_serializer: AxiomSerializer::Reference + end + end + end + + def generated_axioms + respond_to do |format| + format.json do + render json: resource.generated_axioms, + each_serializer: GeneratedAxiomSerializer + end + end + end + + def used_theorems + respond_to do |format| + format.json do + render json: resource.used_theorems, + each_serializer: TheoremSerializer::Reference + end + end + end + + def prover_output + respond_to do |format| + format.json do + render json: {prover_output: resource.prover_output} + end + end + end + protected def collection
Add actions for proof_attempt subsites.
diff --git a/RazzleDazzle.podspec b/RazzleDazzle.podspec index abc1234..def5678 100644 --- a/RazzleDazzle.podspec +++ b/RazzleDazzle.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "RazzleDazzle" - s.version = "0.1.3" + s.version = "0.1.4" s.summary = "Simple Swift keyframe animations for scrolling intros" s.homepage = "https://github.com/IFTTT/RazzleDazzle" s.license = 'MIT'
Update podspec version to 0.1.4.
diff --git a/lib/salesforce_bulk/query_result_collection.rb b/lib/salesforce_bulk/query_result_collection.rb index abc1234..def5678 100644 --- a/lib/salesforce_bulk/query_result_collection.rb +++ b/lib/salesforce_bulk/query_result_collection.rb @@ -15,19 +15,19 @@ end def next? - + @currentIndex < length - 1 end def next - + # if has next, calls method on client to fetch data and returns new collection instance end def previous? - + @currentIndex > 0 end def previous - + # if has previous, calls method on client to fetch data and returns new collection instance end end
Update next? and previous? method implementations to pass tests.
diff --git a/pearl.gemspec b/pearl.gemspec index abc1234..def5678 100644 --- a/pearl.gemspec +++ b/pearl.gemspec @@ -22,4 +22,6 @@ spec.add_development_dependency "bundler", "~> 1.3" spec.add_development_dependency "rake" + spec.add_dependency "multi_json", "~> 1.6.1" + spec.add_dependency "terminal-table" end
Add multi_json to parse json response
diff --git a/1.8/library/csv/reader/parse_spec.rb b/1.8/library/csv/reader/parse_spec.rb index abc1234..def5678 100644 --- a/1.8/library/csv/reader/parse_spec.rb +++ b/1.8/library/csv/reader/parse_spec.rb @@ -9,7 +9,6 @@ CSV::Reader.parse(empty_input) do |row| Expectation.fail_with('block should not be executed', 'but executed') end - Mock.verify_count end it "calls block once for one row of input" do
Remove obsolete call to Mock.verify_count in CSV::Reader.parse specs.
diff --git a/app/controllers/api_controller.rb b/app/controllers/api_controller.rb index abc1234..def5678 100644 --- a/app/controllers/api_controller.rb +++ b/app/controllers/api_controller.rb @@ -1,2 +1,11 @@ class ApiController < ApplicationController + before_action :change_query_order, only: :index + + @@order = :id + + def change_query_order + unless params[:order] == nil + @@order = params[:order].to_sym + end + end end
Add Order To API's Querying Of Database
diff --git a/app/controllers/api_controller.rb b/app/controllers/api_controller.rb index abc1234..def5678 100644 --- a/app/controllers/api_controller.rb +++ b/app/controllers/api_controller.rb @@ -1,7 +1,12 @@ class ApiController < ApplicationController - before_action :change_query_order, only: :index + before_action :change_query_order, :add_querying, only: :index @@order = :id + @@query = nil + + def add_querying + @@query = "%#{params[:q].downcase}%" unless params[:q] == nil + end def change_query_order unless params[:order] == nil
Add Query API Method To Be Used By API Controllers
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index abc1234..def5678 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -3,7 +3,7 @@ # Application helper. module ApplicationHelper def current_user - @current_user ||= User.find_by_id(session[:user_id]) if session[:user_id] + @current_user ||= User.find_by(id: session[:user_id]) if session[:user_id] end def cache_expires(length_of_time)
Use find_by instead of dynamic finder.
diff --git a/app/models/concerns/censurable.rb b/app/models/concerns/censurable.rb index abc1234..def5678 100644 --- a/app/models/concerns/censurable.rb +++ b/app/models/concerns/censurable.rb @@ -31,28 +31,10 @@ end def filter_whatsapp(text) - filter(/#{whatsapp_slangs.join('|')}/, text) + filter(/(wh?ats[au]pp?|wu?ass?ap|guass?app?|guasp)/, text) end private - - def whatsapp_slangs - %w[ - whatsapp - whatsupp - whatsap - watsap - wuassap - wuasap - wassap - wasap - guassapp - guassap - guasapp - guasap - guasp - ] - end def filter(regexp, text) text.gsub(regexp, "[#{privacy_mask}]")
Transform whatsapp filter to a regexp I'm against this, but the others want to keep it. Keep it as a one liner makes it more invisible to myself :)
diff --git a/app/presenters/flash_presenter.rb b/app/presenters/flash_presenter.rb index abc1234..def5678 100644 --- a/app/presenters/flash_presenter.rb +++ b/app/presenters/flash_presenter.rb @@ -22,6 +22,8 @@ 'alert alert-success' when :error, :alert 'alert alert-error' + else + 'alert alert-success' end end end
Set a css class default for flash messages.
diff --git a/manageiq-providers-ovirt.gemspec b/manageiq-providers-ovirt.gemspec index abc1234..def5678 100644 --- a/manageiq-providers-ovirt.gemspec +++ b/manageiq-providers-ovirt.gemspec @@ -15,7 +15,7 @@ s.add_runtime_dependency "ovirt", "~>0.18.0" s.add_runtime_dependency "parallel", "~>1.9" # For ManageIQ::Providers::Ovirt::Legacy::Inventory - s.add_runtime_dependency "ovirt-engine-sdk", "~>4.2.0" + s.add_runtime_dependency "ovirt-engine-sdk", "~>4.2.1" s.add_development_dependency "codeclimate-test-reporter", "~> 1.0.0" s.add_development_dependency "simplecov"
Update to version 4.2.1 of the oVirt Ruby SDK The more relevant changes in this new version of the SDK are the following: * Fix handling of the `all_content` parameter https://bugzilla.redhat.com/1525555[#1525555]. * Limit the number of requests sent to `libcurl` https://bugzilla.redhat.com/1525302[#1525302]. Fixes https://bugzilla.redhat.com/1513528 Signed-off-by: Juan Hernandez <59e5b8140de97cc91c3fb6c5342dce948469af8c@redhat.com>
diff --git a/test/integration/edition_link_check_test.rb b/test/integration/edition_link_check_test.rb index abc1234..def5678 100644 --- a/test/integration/edition_link_check_test.rb +++ b/test/integration/edition_link_check_test.rb @@ -0,0 +1,44 @@+require "integration_test_helper" +require "gds_api/test_helpers/link_checker_api" + + +class EditionLinkCheckTest < JavascriptIntegrationTest + include GdsApi::TestHelpers::LinkCheckerApi + + setup do + setup_users + stub_linkables + stub_holidays_used_by_fact_check + + @stubbed_api_request = link_checker_api_create_batch( + uris: ["https://www.gov.uk"], + id: "a-batch-id", + webhook_uri: link_checker_api_callback_url(host: Plek.find("publisher")), + webhook_secret_token: Rails.application.secrets.link_checker_api_secret_token + ) + + @place = FactoryGirl.create(:place_edition, introduction: "This is [link](https://www.gov.uk) text.") + end + + with_and_without_javascript do + should "create a link check report" do + visit_edition @place + + within(".broken-links-report") do + click_on "Check for broken links" + page.has_content?("Broken link report in progress.") + end + + assert_requested(@stubbed_api_request) + + @place.reload + + @place.latest_link_check_report.update(status: "completed") + + within(".broken-links-report") do + click_on "Refresh" + page.has_content?("This edition contains no broken links") + end + end + end +end
Add an integration test for creating an edition link check
diff --git a/test/integration/integration_test_helper.rb b/test/integration/integration_test_helper.rb index abc1234..def5678 100644 --- a/test/integration/integration_test_helper.rb +++ b/test/integration/integration_test_helper.rb @@ -7,7 +7,7 @@ class ActionDispatch::IntegrationTest include Capybara::DSL - include WebMock + include WebMock::API def setup DatabaseCleaner.clean
Use WebMock::API instead of deprecated WebMock.
diff --git a/config/initializers/forest_engine.rb b/config/initializers/forest_engine.rb index abc1234..def5678 100644 --- a/config/initializers/forest_engine.rb +++ b/config/initializers/forest_engine.rb @@ -1,4 +1,3 @@-'MediaItem'.safe_constantize&.expire_cache! 'Menu'.safe_constantize&.expire_cache! 'Setting'.safe_constantize&.expire_cache! 'Setting'.safe_constantize&.expire_application_cache_key!
Remove unused media item cache key expiration from forest initializer
diff --git a/recipes/ui.rb b/recipes/ui.rb index abc1234..def5678 100644 --- a/recipes/ui.rb +++ b/recipes/ui.rb @@ -23,5 +23,5 @@ home_dir node['consul']['ui_dir'] version node['consul']['version'] checksum install_checksum - url ::URI.join(node['consul']['base_url'], "#{install_version}.zip").to_s + url node['consul']['base_url'] % { version: install_version } end
Fix UI recipe to use string interpolation for base url.
diff --git a/XHRefreshControl.podspec b/XHRefreshControl.podspec index abc1234..def5678 100644 --- a/XHRefreshControl.podspec +++ b/XHRefreshControl.podspec @@ -1,11 +1,11 @@ Pod::Spec.new do |s| s.name = "XHRefreshControl" - s.version = "0.1.3" + s.version = "0.1.4" s.summary = "XHRefreshControl 是一款高扩展性、低耦合度的下拉刷新、上提加载更多的组件。" s.homepage = "https://github.com/xhzengAIB/XHRefreshControl" s.license = "GPL v2" s.authors = { "xhzengAIB" => "xhzengAIB@gmail.com" } - s.source = { :git => "https://github.com/xhzengAIB/XHRefreshControl.git", :tag => "v0.1.3" } + s.source = { :git => "https://github.com/xhzengAIB/XHRefreshControl.git", :tag => "v0.1.4" } s.frameworks = 'Foundation', 'CoreGraphics', 'UIKit' s.platform = :ios, '5.0' s.source_files = 'RefreshControl/*.{h,m}'
Update pod spec file v0.1.4
diff --git a/spec/features/user_visits_cookies_page_spec.rb b/spec/features/user_visits_cookies_page_spec.rb index abc1234..def5678 100644 --- a/spec/features/user_visits_cookies_page_spec.rb +++ b/spec/features/user_visits_cookies_page_spec.rb @@ -3,7 +3,16 @@ RSpec.describe 'When the user visits the cookies page' do it 'displays the page in English' do visit '/cookies' - expect(page).to have_content('GOV.UK puts small files (known as ‘cookies’) onto your computer to collect information about how you browse the site.') + expect(page).to have_content('GOV.UK Verify puts small files (known as \'cookies\') onto your computer.') + page_should_have_cookie_descriptions + end + + it 'displays the page in Welsh' do + visit '/cwcis' + expect(page).to have_content('Mae GOV.UK Verify yn gosod feiliau bychan (a elwir yn \'cwcis\') ar eich cyfrifiadur.') + end + + def page_should_have_cookie_descriptions expect(page).to have_content('x_govuk_session_cookie') expect(page).to have_content('_verify-frontend_session') expect(page).to have_content('seen_cookie_message')
5183: Update test for the English cookie page and add a test for Welsh Authors: 598e896415e8721542fcf86b6d67a324310d4b50@tuomasnylund
diff --git a/recipes/build_source.rb b/recipes/build_source.rb index abc1234..def5678 100644 --- a/recipes/build_source.rb +++ b/recipes/build_source.rb @@ -2,9 +2,14 @@ # Description: Install ruby from source # Compile and install ruby +major_version = node[:optoro_ruby][:ruby_major_version] +minor_version = node[:optoro_ruby][:ruby_minor_version] +params = { major: major_version, minor: minor_version } +source_directory = node[:optoro_ruby][:source_directory] % params + execute "install_ruby" do command "./configure && make && make install" - cwd node[:optoro_ruby][:source_directory] + cwd source_directory not_if { File.exist?("/usr/local/bin/ruby") } subscribes :run, "execute[extract_ruby]", :immediately action :nothing
Update build source recipe to use lazy parameter evaluation.
diff --git a/server.rb b/server.rb index abc1234..def5678 100644 --- a/server.rb +++ b/server.rb @@ -15,10 +15,10 @@ end -ActiveRecord::Base.establish_connection( - :adapter => "sqlite3", - :database => "db/development.sqlite3" -) +activerecord_config = YAML.load(File.read(File.join(File.dirname(__FILE__), 'config', 'database.yml'))) + +# Hardcoded to the development environment for the time being +ActiveRecord::Base.establish_connection(activerecord_config["development"]) # Create a new server instance listening at 127.0.0.1:2525 # and accepting a maximum of 4 simultaneous connections @@ -26,5 +26,4 @@ # Start the server server.start - server.join
Load database config from standard rails place
diff --git a/week-4/calculate-grade/letter_grade_spec.rb b/week-4/calculate-grade/letter_grade_spec.rb index abc1234..def5678 100644 --- a/week-4/calculate-grade/letter_grade_spec.rb +++ b/week-4/calculate-grade/letter_grade_spec.rb @@ -0,0 +1,22 @@+require_relative "my_solution" + +describe 'get_grade' do + it 'is defined as a method' do + expect(defined?(get_grade)).to eq 'method' + end + it 'returns "A" when the average is >= 90' do + expect(get_grade(90)).to eq "A" + end + it 'returns "B" when the average is >= 80' do + expect(get_grade(88)).to eq "B" + end + it 'returns "C" when the average is >= 70' do + expect(get_grade(72)).to eq "C" + end + it 'returns "D" when the average is >= 60' do + expect(get_grade(66)).to eq "D" + end + it 'returns "F" when the average is < 60' do + expect(get_grade(50)).to eq "F" + end +end
Complete challenge - 0 failures
diff --git a/MBAlertView.podspec b/MBAlertView.podspec index abc1234..def5678 100644 --- a/MBAlertView.podspec +++ b/MBAlertView.podspec @@ -9,7 +9,7 @@ s.license = 'MIT' s.license = { :type => 'MIT', :file => 'LICENSE' } s.author = { "Mo Bitar" => "me@mbbitar.com" } - s.source = { :git => 'https://github.com/100grams/MBAlertView.git', :commit => '5650aed8e3' } + s.source = { :git => 'https://github.com/100grams/MBAlertView.git', :commit => '9e9b51c5b3' } s.platform = :ios s.source_files = 'MBAlertView/**/*.{h,m}'
Update podspec to point to latest commit
diff --git a/spec/options_spec.rb b/spec/options_spec.rb index abc1234..def5678 100644 --- a/spec/options_spec.rb +++ b/spec/options_spec.rb @@ -0,0 +1,17 @@+require 'spec_helper' +require "braingasm/options" + +module Braingasm + describe :handle_options do + it "translates command line options to Braingasm options" do + Braingasm.handle_options(:zero => true) + expect(Options[:eof]).to be 0 + + Braingasm.handle_options(:negative => true) + expect(Options[:eof]).to be -1 + + Braingasm.handle_options(:as_is => true) + expect(Options[:eof]).to be nil + end + end +end
Add specs for command line option handling
diff --git a/spec/ospec/runner.rb b/spec/ospec/runner.rb index abc1234..def5678 100644 --- a/spec/ospec/runner.rb +++ b/spec/ospec/runner.rb @@ -4,6 +4,21 @@ def self.opal_runner @env = Object.new @env.extend MSpec + end +end + +# Add keys to pending array as names of specs not to run. +class OSpecFilter + def initialize + @pending = {} + end + + def register + MSpec.register :exclude, self + end + + def ===(string) + @pending.has_key? string end end @@ -20,6 +35,9 @@ def register formatter = PhantomFormatter.new formatter.register + + filter = OSpecFilter.new + filter.register end def run
Add OSpecFilter to filter non-compliant specs from running in mspec