diff stringlengths 65 26.7k | message stringlengths 7 9.92k |
|---|---|
diff --git a/spec/integration/start_spec.rb b/spec/integration/start_spec.rb
index abc1234..def5678 100644
--- a/spec/integration/start_spec.rb
+++ b/spec/integration/start_spec.rb
@@ -6,8 +6,8 @@
out = `#{command}`
- expect(out).to include <<-OUT
-\e[0mCommands:
+ expect(out).to eq(<<-OUT)
+#{TTY::CLI.top_banner}Commands:
teletype add COMMAND_NAME [OPTIONS] # Add a command to the command line app.
teletype help [COMMAND] # Describe available commands or one specific command
teletype new PROJECT_NAME [OPTIONS] # Create a new command line app skeleton.
@@ -17,6 +17,7 @@ [--no-color] # Disable colorization in output.
-r, [--dry-run], [--no-dry-run] # Run but do not make any changes.
[--debug], [--no-debug] # Run with debug logging.
+
OUT
end
end
| Change to compare whole output
|
diff --git a/lib/vagrant-kvm/action/boot.rb b/lib/vagrant-kvm/action/boot.rb
index abc1234..def5678 100644
--- a/lib/vagrant-kvm/action/boot.rb
+++ b/lib/vagrant-kvm/action/boot.rb
@@ -9,7 +9,7 @@ def call(env)
@env = env
- if @env[:machine].provider_config.gui
+ if @env[:machine].provider_config.gui and @env[:machine_action] != :resume
env[:machine].provider.driver.set_gui
end
| Allow resuming saved machine state when gui is enabled
Attempting to resume a suspended (saved) machine would result in:
```
Call to virDomainUndefine failed: Requested operation is not valid:
Refusing to undefine while domain managed save image exists
(Libvirt::Error)
```
To mitigate this, do not attempt to modify the saved VM when resuming.
|
diff --git a/spec/object_queue_spec.rb b/spec/object_queue_spec.rb
index abc1234..def5678 100644
--- a/spec/object_queue_spec.rb
+++ b/spec/object_queue_spec.rb
@@ -0,0 +1,75 @@+require "spec_helper"
+require "save_queue/object_queue"
+
+describe SaveQueue::ObjectQueue do
+ let(:queue) { SaveQueue::ObjectQueue.new }
+ let(:element) { new_element(:element) }
+
+ [:add, :<<, :push].each do |method|
+ describe "##{method}" do
+ #it "should add only objects that implement SaveQueue::Object interface" do
+ it "should not accept objects that does not respond to #save" do
+ element.unstub(:save)
+ expect{ queue.add element }.to raise_error ArgumentError, "#{element.inspect} does not respond to #save"
+ end
+
+ it "should not accept objects that does not respond to #has_unsaved_changes?" do
+ element.unstub(:has_unsaved_changes?)
+ expect{ queue.add element }.to raise_error ArgumentError, "#{element.inspect} does not respond to #has_unsaved_changes?"
+ end
+ end
+ end
+
+ describe "#save" do
+ it "should save all object in queue" do
+ 5.times do
+ element = stub(:element)
+ element.stub(:has_unsaved_changes?).and_return(true)
+ element.should_receive(:save).once
+ queue << element
+ end
+
+ queue.save
+ end
+
+ it "should save an object if it has unsaved changes" do
+ element = stub(:element)
+ element.stub(:has_unsaved_changes?).and_return(true)
+ element.should_receive(:save).once
+
+ queue << element
+ queue.save
+ end
+
+ it "should not save an object if it has not been changed" do
+ element = stub(:element)
+ element.stub(:has_unsaved_changes?).and_return(false)
+ element.should_not_receive(:save)
+
+ queue << element
+ queue.save
+ end
+
+ it "should raise SaveQueue::FailedSaveError if at least one object in queue was not saved" do
+ objects ={}
+ objects[:valid1] = new_element(:valid1)
+ objects[:valid2] = new_element(:valid2)
+ objects[:not_changed] = new_element(:not_changed, :changed => false, :saved => true)
+ objects[:unsaved_but_changed] = new_element(:unsaved_but_changed, :changed => true, :saved => false)
+ objects[:saved] = new_element(:saved, :changed => true, :saved => true)
+ objects[:valid3] = new_element(:valid3)
+
+ objects.each_value do |object|
+ queue << object
+ end
+
+
+ expect{ queue.save }.to raise_error(SaveQueue::FailedSaveError) {|error| \
+ error.context.should == { :processed => objects.values_at(:valid1, :valid2, :not_changed),
+ :saved => objects.values_at(:valid1, :valid2),
+ :failed => objects[:unsaved_but_changed],
+ :pending => objects.values_at(:not_changed, :saved, :valid3) }
+ }
+ end
+ end
+end | Add specs for Queue. Split it to UniqQueue and ObjectQueue
|
diff --git a/spec/features/errors_spec.rb b/spec/features/errors_spec.rb
index abc1234..def5678 100644
--- a/spec/features/errors_spec.rb
+++ b/spec/features/errors_spec.rb
@@ -1,6 +1,6 @@ require 'spec_helper'
-RSpec.feature 'Errors' do
+RSpec.feature 'Controller Integration' do
scenario 'rescue exceptions by rendering error page' do
visit '/posts/0'
| Change name of errors spec
|
diff --git a/spec/view_helpers_spec.rb b/spec/view_helpers_spec.rb
index abc1234..def5678 100644
--- a/spec/view_helpers_spec.rb
+++ b/spec/view_helpers_spec.rb
@@ -0,0 +1,51 @@+require 'rails_helper'
+#require 'action_view' Necessary?
+
+module LoadMore
+ describe ActionView, type: :helper do
+ before(:all) do
+ %w(a b c d e f g h i j).each do |i|
+ Entry.create!(string: i)
+ end
+
+ Param.create!
+ end
+
+ describe 'load_more_btn' do
+ it 'should display message if collection is nil' do
+ expect(load_more_btn(nil)).to have_text 'No more content'
+ expect(load_more_btn(nil)).to have_selector 'div.load-more-btn.end'
+ end
+
+ it 'should display message if collection has only one item' do
+ expect(load_more_btn(Param.all)).to have_text 'No more content'
+ expect(load_more_btn(nil)).to have_selector 'div.load-more-btn.end'
+ end
+
+ it 'should display with collection' do
+ html = load_more_btn(Entry.all, { url_params: { controller: 'sample' } })
+ expect(html).to have_selector 'div.load-more-btn a.btn.btn-primary-outline'
+ expect(html).to have_link 'View more'
+ end
+
+ it 'should have a href attribute with last_item: j when order_by: :string' do
+ expect(load_more_btn(Entry.all, {
+ order_by: :string,
+ url_params: { controller: 'sample' }
+ })).to have_link 'View more', href: '/?last_item=j'
+ end
+
+ it 'should have a href attribute with last_item: 10 when order_by: nil' do
+ expect(load_more_btn(Entry.all, {
+ url_params: { controller: 'sample' }
+ }))
+ .to have_link 'View more', href: '/?last_item=10'
+ end
+ end
+
+ after(:all) do
+ Entry.destroy_all
+ Param.destroy_all
+ end
+ end
+end
| Add tests for view helper load_more_btn
|
diff --git a/lib/wakame/instance_counter.rb b/lib/wakame/instance_counter.rb
index abc1234..def5678 100644
--- a/lib/wakame/instance_counter.rb
+++ b/lib/wakame/instance_counter.rb
@@ -0,0 +1,78 @@+module Wakame
+ class InstanceCounter
+ class OutOfLimitRangeError < StandardError; end
+
+ include AttributeHelper
+
+ def bind_resource(resource)
+ @resource = resource
+ end
+
+ def resource
+ @resource
+ end
+
+ def instance_count
+ raise NotImplementedError
+ end
+
+ protected
+ def check_hard_limit(count=self.instance_count)
+ Range.new(@resource.min_instances, @resource.max_instances, true).include?(count)
+ end
+ end
+
+
+ class ConstantCounter < InstanceCounter
+ def initialize(resource)
+ @instance_count = 1
+ bind_resource(resource)
+ end
+
+ def instance_count
+ @instance_count
+ end
+
+ def instance_count=(count)
+ raise OutOfLimitRangeError unless check_hard_limit(count)
+ if @instance_count != count
+ prev = @instance_count
+ @instance_count = count
+ ED.fire_event(Event::InstanceCountChanged.new(@resource, prev, count))
+ end
+ end
+ end
+
+ class TimedCounter < InstanceCounter
+ def initialize(seq, resource)
+ @sequence = seq
+ bind_resource(resource)
+ @timer = Scheduler::SequenceTimer.new(seq)
+ @timer.add_observer(self)
+ @instance_count = 1
+ end
+
+ def instance_count
+ @instance_count
+ end
+
+ def update(*args)
+ new_count = args[0]
+ if @instance_count != count
+ prev = @instance_count
+ @instance_count = count
+ ED.fire_event(Event::InstanceCountChanged.new(@resource, prev, count))
+ end
+ #if self.min > new_count || self.max < new_count
+ #if self.min != new_count || self.max != new_count
+ # prev_min = self.min
+ # prev_max = self.max
+
+ # self.max = self.min = new_count
+ # ED.fire_event(Event::InstanceCountChanged.new(@resource, prev_min, prev_max, self.min, self.max))
+ #end
+
+ end
+ end
+
+end
| Split InstanceCounter class from service.rb.
|
diff --git a/spec/models/response_spec.rb b/spec/models/response_spec.rb
index abc1234..def5678 100644
--- a/spec/models/response_spec.rb
+++ b/spec/models/response_spec.rb
@@ -1,12 +1,12 @@ require "spec_helper"
describe Response do
- it { should respond_to(:question) }
- it { should respond_to(:survey) }
-
before :each do
@response = Response.new
end
+
+ it { should respond_to(:question) }
+ it { should respond_to(:survey) }
it "should return the survey by UUID" do
example_uuid = "00000000-0000-0000-0000-000000000000"
| Move before block of response spec to beginning
|
diff --git a/spec/support/factory_girl.rb b/spec/support/factory_girl.rb
index abc1234..def5678 100644
--- a/spec/support/factory_girl.rb
+++ b/spec/support/factory_girl.rb
@@ -0,0 +1,14 @@+# RSpec
+# spec/support/factory_girl.rb
+RSpec.configure do |config|
+ config.include FactoryGirl::Syntax::Methods
+
+ config.before(:suite) do
+ begin
+ DatabaseCleaner.start
+ FactoryGirl.lint
+ ensure
+ DatabaseCleaner.clean
+ end
+ end
+end | Use FactoryGirl to lint all of the factories on startup
|
diff --git a/025-1000-digit-fibonacci-number/ruby-solution.rb b/025-1000-digit-fibonacci-number/ruby-solution.rb
index abc1234..def5678 100644
--- a/025-1000-digit-fibonacci-number/ruby-solution.rb
+++ b/025-1000-digit-fibonacci-number/ruby-solution.rb
@@ -1,11 +1,7 @@-last_two = [1, 1]
-fib_index = 2
+fibonacci = [1, 1]
-while last_two[1].to_s.length < 1000
- next_fib = last_two.reduce(:+)
- fib_index += 1
- last_two[0] = last_two[1]
- last_two[1] = next_fib
+while fibonacci.last.to_s.length < 1000
+ fibonacci << fibonacci[-1] + fibonacci[-2]
end
-p fib_index
+p fibonacci.length
| Refactor 25 in ruby for simplicity
|
diff --git a/Casks/vmware-fusion.rb b/Casks/vmware-fusion.rb
index abc1234..def5678 100644
--- a/Casks/vmware-fusion.rb
+++ b/Casks/vmware-fusion.rb
@@ -1,6 +1,6 @@ cask :v1_1 => 'vmware-fusion' do
- version '8.0.1-3094680'
- sha256 'e16f66349ee136fd961550f73af243f1ffec63c17847b5f89b74c1cc77898ab4'
+ version '8.0.2-3164312'
+ sha256 'b7e48506a65ecc147ea596a23bfb56f73feaa1ec327ff78fbd2eeb5cb1f63e3f'
url "https://download3.vmware.com/software/fusion/file/VMware-Fusion-#{version}.dmg"
name 'VMware Fusion'
| Upgrade VMware Fusion.app to v8.0.2-3164312
|
diff --git a/lib/nehm/playlist_control.rb b/lib/nehm/playlist_control.rb
index abc1234..def5678 100644
--- a/lib/nehm/playlist_control.rb
+++ b/lib/nehm/playlist_control.rb
@@ -5,7 +5,7 @@
def self.set_playlist
loop do
- playlist = HighLine.new.ask('Enter name of default iTunes playlist to which you want add tracks (press Enter to unset default playlist)')
+ playlist = HighLine.new.ask('Enter name of default iTunes playlist to which you want add tracks (press Enter to set it to default Music library)')
if playlist == ''
Cfg[:playlist] = nil
puts Paint['Default iTunes playlist unset', :green]
| Edit message when set the iTunes playlist
|
diff --git a/app/views/projects/index.rss.builder b/app/views/projects/index.rss.builder
index abc1234..def5678 100644
--- a/app/views/projects/index.rss.builder
+++ b/app/views/projects/index.rss.builder
@@ -1,5 +1,5 @@ rss_activity_feed :root_url => projects_url do |feed|
for activity in @activities
- feed.entry activity
+ feed.entry activity if activity.target
end
end
| Solve RSS bug for activities without a target
|
diff --git a/recipes/install1.rb b/recipes/install1.rb
index abc1234..def5678 100644
--- a/recipes/install1.rb
+++ b/recipes/install1.rb
@@ -0,0 +1,39 @@+# Install the helloworld application
+# TODO: use app from wasdev
+
+application "HelloworldApp" do
+
+ serverName = "Test1"
+
+ path "/usr/local/helloworldApp"
+ repository "http://central.maven.org/maven2/org/apache/tuscany/sca/samples/helloworld-webapp/2.0/helloworld-webapp-2.0.war"
+ scm_provider Chef::Provider::RemoteFile::Deploy
+ owner "wlp"
+ group "wlp-admin"
+
+ wlp_webapp do
+
+ description "Helloworld App"
+ features [ "jsp-2.2", "servlet-3.0" ]
+
+ # TODO: derive app_location automatically
+ application_location "/usr/local/helloworldApp/current/helloworld-webapp-2.0.war"
+
+# application name and location default to above "HelloworldApp" and path
+# config other application attributes via attributes here, eg:
+# application_type "war"
+# application_context_root "someroot"
+# application_auto_start "true"
+# or, to use a custom xml template from this cookbook:
+# application_xml_template "HelloworldApp.xml.erb"
+
+ end
+
+ wlp
+
+end
+
+# TODO: where should this start go?
+wlp_server serverName do
+ action :start
+end
| Add a recipe that shows how to use the application_wlp cookbook
|
diff --git a/spec/samin_spec.rb b/spec/samin_spec.rb
index abc1234..def5678 100644
--- a/spec/samin_spec.rb
+++ b/spec/samin_spec.rb
@@ -2,6 +2,12 @@
describe Samin do
subject { Samin.new }
+ let(:conf_base_name) { 'EUR' }
+ let(:conf_conversion_rates) {{
+ 'USD' => 1.11,
+ 'Bitcoin' => 0.0047
+ }}
+ let(:fifty_eur) { Money.new(50, 'EUR') }
it 'has a version number' do
expect(Samin::VERSION).not_to be nil
| Set up initial variables that will be used accross different examples
|
diff --git a/mspec/lib/mspec/helpers/tmp.rb b/mspec/lib/mspec/helpers/tmp.rb
index abc1234..def5678 100644
--- a/mspec/lib/mspec/helpers/tmp.rb
+++ b/mspec/lib/mspec/helpers/tmp.rb
@@ -15,7 +15,8 @@
-----------------------------------------------------
The rubyspec temp directory is not empty. Ensure that
-all specs are cleaning up temporary files.
+all specs are cleaning up temporary files:
+ #{SPEC_TEMP_DIR}
-----------------------------------------------------
EOM
| Print the path of SPEC_TEMP_DIR to be more helpful
|
diff --git a/lib/cuttlefish_log_daemon.rb b/lib/cuttlefish_log_daemon.rb
index abc1234..def5678 100644
--- a/lib/cuttlefish_log_daemon.rb
+++ b/lib/cuttlefish_log_daemon.rb
@@ -11,6 +11,12 @@ if log_line && log_line.status == "hard_bounce"
# We don't want to save duplicates
if BlackList.find_by(team_id: log_line.delivery.app.team_id, address: log_line.delivery.address).nil?
+ # TEMPORARY addition to debug something in production
+ if log_line.delivery.app.team_id.nil?
+ puts "team_id is NIL"
+ p log_line
+ p line
+ end
BlackList.create(team_id: log_line.delivery.app.team_id, address: log_line.delivery.address, caused_by_delivery: log_line.delivery)
end
end
| Add some debugging that is temporary for production
|
diff --git a/lib/dimples/configuration.rb b/lib/dimples/configuration.rb
index abc1234..def5678 100644
--- a/lib/dimples/configuration.rb
+++ b/lib/dimples/configuration.rb
@@ -43,8 +43,8 @@ {
post: 'post',
category: 'category',
- archives: 'archives',
- date_archives: 'archives'
+ archive: 'archive',
+ date_archive: 'archive'
}
end
| Change archives and date_archives layouts to the singular
|
diff --git a/lib/liftoff/commands/todo.rb b/lib/liftoff/commands/todo.rb
index abc1234..def5678 100644
--- a/lib/liftoff/commands/todo.rb
+++ b/lib/liftoff/commands/todo.rb
@@ -1,6 +1,6 @@ TODO_WARNING_SCRIPT = <<WARNING
KEYWORDS="TODO:|FIXME:|\\?\\?\\?:|\\!\\!\\!:"
-find "${SRCROOT}" \\( -name "*.h" -or -name "*.m" \\) -print0 | xargs -0 egrep --with-filename --line-number --only-matching "($KEYWORDS).*\\$" | perl -p -e "s/($KEYWORDS)/ warning: \\$1/"
+find "${SRCROOT}" -ipath "${SRCROOT}/vendor" -prune -o \\( -name "*.h" -or -name "*.m" \\) -print0 | xargs -0 egrep --with-filename --line-number --only-matching "($KEYWORDS).*\\$" | perl -p -e "s/($KEYWORDS)/ warning: \\$1/"
WARNING
command :todo do |c|
| Update TODO script to ignore files in /Vendor
Case insensitive
|
diff --git a/resources/exabgp.rb b/resources/exabgp.rb
index abc1234..def5678 100644
--- a/resources/exabgp.rb
+++ b/resources/exabgp.rb
@@ -13,14 +13,14 @@ when :package
package 'exabgp' do
action :install
- version new_resource.package_version unless new_resource.package_version.nil?
+ version new_resource.package_version if property_is_set?(:package_version)
end
when :pip
include_recipe 'poise-python'
python_package 'exabgp' do
action :install
- version new_resource.package_version
+ version new_resource.package_version if property_is_set?(:package_version)
end
when :source
package 'git-core'
| Use property_is_set instead of a nil check
|
diff --git a/library/time/to_time_spec.rb b/library/time/to_time_spec.rb
index abc1234..def5678 100644
--- a/library/time/to_time_spec.rb
+++ b/library/time/to_time_spec.rb
@@ -7,11 +7,11 @@ time = Time.new(2012, 2, 21, 10, 11, 12)
with_timezone("America/Regina") do
- time.to_time.should == time
+ time.to_time.should equal time
end
time2 = Time.utc(2012, 2, 21, 10, 11, 12)
- time2.to_time.should == time2
+ time2.to_time.should equal time2
end
end
end
| Make sure the returned time is the same instance
|
diff --git a/test/integration/default/serverspec/localhost/application_spec.rb b/test/integration/default/serverspec/localhost/application_spec.rb
index abc1234..def5678 100644
--- a/test/integration/default/serverspec/localhost/application_spec.rb
+++ b/test/integration/default/serverspec/localhost/application_spec.rb
@@ -0,0 +1,14 @@+# Tests for specific Racktable application items
+require 'serverspec'
+
+describe user('racktables') do
+ it { should exist }
+ it { should belong_to_group 'racktables' }
+ it { should have_login_shell '/bin/false' }
+end
+
+describe file('/var/www/racktables/wwwroot/inc/secret.php') do
+ it { should be_a_file}
+ its(:content) { should match /\$pdo_dsn/ }
+ its(:content) { should match /\$user_auth_src/ }
+end
| Add serverspec tests for racktables::application.
|
diff --git a/tasks/metrics/mutant.rake b/tasks/metrics/mutant.rake
index abc1234..def5678 100644
--- a/tasks/metrics/mutant.rake
+++ b/tasks/metrics/mutant.rake
@@ -9,7 +9,7 @@ project = Devtools.project
config = project.mutant
cmd = %[mutant -r ./spec/spec_helper.rb "::#{config.namespace}" --rspec-dm2]
- Kernel.system(cmd) || raise('Mutant task is not successful')
+ Kernel.system(cmd) or raise 'Mutant task is not successful'
end
else
desc 'Run Mutant'
| Remove unnecessary parenthesis from exception
|
diff --git a/app/controllers/api/ims_imports_controller.rb b/app/controllers/api/ims_imports_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/api/ims_imports_controller.rb
+++ b/app/controllers/api/ims_imports_controller.rb
@@ -2,8 +2,11 @@ include Concerns::CanvasImsccSupport
def create
- if params[:data] && params[:data][:lti_launches].present?
- lti_launches = lti_launches_params(params[:data])[:lti_launches]
+ data = params[:data]
+ if data.present?
+ lti_launches = if data[:lti_launches].present?
+ lti_launches_params(data)[:lti_launches]
+ end
data = {
lti_launches: lti_launches,
| Verify ims import data params separately
|
diff --git a/config/initializers/constants.rb b/config/initializers/constants.rb
index abc1234..def5678 100644
--- a/config/initializers/constants.rb
+++ b/config/initializers/constants.rb
@@ -3,4 +3,4 @@ GIT_BIN = "git"
RAKE_BIN = "rake"
REDIS_NAMESPACE = "rails-assets"
-DATA_DIR = ENV["DATA_DIR"] || File.expand_path("../../../data", __FILE__)
+DATA_DIR = ENV["DATA_DIR"] || File.expand_path("../../../public", __FILE__)
| Change default data dir to public (dev)
|
diff --git a/app/overrides/remove_searchbar_from_header.rb b/app/overrides/remove_searchbar_from_header.rb
index abc1234..def5678 100644
--- a/app/overrides/remove_searchbar_from_header.rb
+++ b/app/overrides/remove_searchbar_from_header.rb
@@ -1,4 +1,5 @@ Deface::Override.new(:virtual_path => 'spree/shared/_nav_bar',
:name => 'remove_searchbar_from_header',
- :remove => "code[erb-loud]:contains('spree/shared/search')",
- :original => '2361eded89274b5234da712ed05325ee1b8dadfa')
+ :remove => "li#search-bar",
+ :original => 'eb3fa668cd98b6a1c75c36420ef1b238a1fc55ac',
+ :sequence => 1)
| Remove login links from header first.
|
diff --git a/lib/stairs/steps/balanced.rb b/lib/stairs/steps/balanced.rb
index abc1234..def5678 100644
--- a/lib/stairs/steps/balanced.rb
+++ b/lib/stairs/steps/balanced.rb
@@ -4,6 +4,7 @@ module Steps
class Balanced < Step
title "Balanced Payments"
+ description "Creates a test Marketplace on Balanced"
def run
::Balanced.configure(api_key.secret)
| Add description to Balanced step
|
diff --git a/lib/will_paginate/mongoid.rb b/lib/will_paginate/mongoid.rb
index abc1234..def5678 100644
--- a/lib/will_paginate/mongoid.rb
+++ b/lib/will_paginate/mongoid.rb
@@ -13,7 +13,11 @@ end
def per_page(value = :non_given)
- value == :non_given ? options[:limit] : limit(value)
+ if value == :non_given
+ options[:limit] == 0 ? nil : options[:limit] # in new Mongoid versions a nil limit is saved as 0
+ else
+ limit(value)
+ end
end
def page(page)
| Fix broken spec on latest version of Mongoid.
In new versions of Mongoid setting a limit to nil actually sets the limit to 0, which behaves the same as nil. So if the limit is 0 in #per_page we make sure to return nil. |
diff --git a/spec/lib/zendesk_tab_spec.rb b/spec/lib/zendesk_tab_spec.rb
index abc1234..def5678 100644
--- a/spec/lib/zendesk_tab_spec.rb
+++ b/spec/lib/zendesk_tab_spec.rb
@@ -24,8 +24,8 @@ it 'has a wrapper element' do
expect(subject).to have_tag('div#feedback-tab')
end
- it 'embeds an image in the link' do
- expect(subject).to have_tag('a img')
+ it 'embeds a link' do
+ expect(subject).to have_tag('a')
end
end
| Remove the test requirement for an image
|
diff --git a/spec/saxon/processor_spec.rb b/spec/saxon/processor_spec.rb
index abc1234..def5678 100644
--- a/spec/saxon/processor_spec.rb
+++ b/spec/saxon/processor_spec.rb
@@ -10,6 +10,6 @@ end
it "can make a new XML instance" do
- expect(processor.XML(xsl_file)).to respond_to(:getNodeKind)
+ expect(processor.XML(xsl_file)).to respond_to(:node_kind)
end
end
| Use JRuby's rubyised method names
|
diff --git a/spec/support/email_helper.rb b/spec/support/email_helper.rb
index abc1234..def5678 100644
--- a/spec/support/email_helper.rb
+++ b/spec/support/email_helper.rb
@@ -5,7 +5,7 @@ # It's here in a single place to allow an easy upgrade to Spree 2 which
# needs a different implementation of this method.
def setup_email
- create(:mail_method)
+ Spree::Config[:mails_from] = "test@ofn.example.org"
end
end
end
| Update test mail setup for Spree 2
https://github.com/openfoodfoundation/openfoodnetwork/issues/2882
The email setup differs between Spree 1 and Spree 2. We already
encapsulated that setup in a single method which now needed changing.
|
diff --git a/config/initializers/car_cost_tool.rb b/config/initializers/car_cost_tool.rb
index abc1234..def5678 100644
--- a/config/initializers/car_cost_tool.rb
+++ b/config/initializers/car_cost_tool.rb
@@ -4,5 +4,6 @@ 'DOMAIN' => ENV['CAR_COST_TOOL_DOMAIN'],
'CAP_SUBSCRIBER_ID' => ENV['CAR_COST_TOOL_CAP_SUBSCRIBER_ID'],
'CAP_PASSWORD' => ENV['CAR_COST_TOOL_CAP_PASSWORD'],
+ 'CAP_PASSWORD_ALT' => ENV['CAR_COST_TOOL_CAP_PASSWORD_ALT'],
'MAX_CARS_TO_COMPARE' => ENV['CAR_COST_TOOL_MAX_CARS_TO_COMPARE'].to_i
}
| Allow failover passsword for CAP (Car Cost)
|
diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb
index abc1234..def5678 100644
--- a/config/initializers/session_store.rb
+++ b/config/initializers/session_store.rb
@@ -1,3 +1,3 @@ # Be sure to restart your server when you modify this file.
-ExampleApp::Application.config.session_store :cookie_store, key: '_exampleapp_session'
+ExampleApp::Application.config.session_store :cache_store, key: '_exampleapp_session'
| Use cache store for cookies |
diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb
index abc1234..def5678 100644
--- a/config/initializers/session_store.rb
+++ b/config/initializers/session_store.rb
@@ -1,6 +1,9 @@ # Be sure to restart your server when you modify this file.
-NeedOTron::Application.config.session_store :cookie_store, key: '_need-o-tron_session'
+NeedOTron::Application.config.session_store :cookie_store,
+ key: '_need-o-tron_session',
+ :secure => Rails.env.production?,
+ :http_only => true
# Use the database for sessions instead of the cookie-based default,
# which shouldn't be used to store highly confidential information
| Set cookies to only be served over https and to be http only
|
diff --git a/app/notifiers/following_activity_notifier.rb b/app/notifiers/following_activity_notifier.rb
index abc1234..def5678 100644
--- a/app/notifiers/following_activity_notifier.rb
+++ b/app/notifiers/following_activity_notifier.rb
@@ -3,7 +3,7 @@ def self.deliver(following)
a = Activity.find_or_initialize_by(user_id: following.leader_id, target_user_id: following.user.id, activity_type: 'FOLLOWING')
a.image_url = following.user.avatar_image[:small]
- a.title = "#{following.user.username} is now following you on Knoda."
+ a.title = following.user.username
a.created_at = DateTime.now
a.seen = false
a.save!
| Change activity title for followings
|
diff --git a/sauce_whisk.gemspec b/sauce_whisk.gemspec
index abc1234..def5678 100644
--- a/sauce_whisk.gemspec
+++ b/sauce_whisk.gemspec
@@ -17,6 +17,8 @@ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
gem.require_paths = ["lib"]
+ gem.license = "MIT"
+
gem.add_runtime_dependency "rest-client"
gem.add_development_dependency "vcr"
gem.add_development_dependency "webmock"
| Add licencing details to gemspec.
|
diff --git a/lib/facter/buzzdeee_rubysuffix.rb b/lib/facter/buzzdeee_rubysuffix.rb
index abc1234..def5678 100644
--- a/lib/facter/buzzdeee_rubysuffix.rb
+++ b/lib/facter/buzzdeee_rubysuffix.rb
@@ -0,0 +1,10 @@+#
+
+Facter.add(:rubysuffix) do
+ confine :kernel => [ 'OpenBSD' ]
+ setcode do
+ version = Facter.value(:rubyversion)
+ version.gsub!(/^(\d+)\.(\d+)\..*/, '\1\2')
+ end
+end
+
| Add a fact called rubysuffix
|
diff --git a/exercises/concept/basics/lasagna.rb b/exercises/concept/basics/lasagna.rb
index abc1234..def5678 100644
--- a/exercises/concept/basics/lasagna.rb
+++ b/exercises/concept/basics/lasagna.rb
@@ -3,8 +3,8 @@ raise NotImplementedError, 'Please implement the remaining_minutes_in_oven method'
end
- def preperation_time_in_minutes(layers)
- raise NotImplementedError, 'Please implement the preperation_time_in_minutes method'
+ def preparation_time_in_minutes(layers)
+ raise NotImplementedError, 'Please implement the preparation_time_in_minutes method'
end
def total_time_in_minutes(number_of_layers:, actual_minutes_in_oven:)
| Fix typo in function name
|
diff --git a/test/rails_test_helper.rb b/test/rails_test_helper.rb
index abc1234..def5678 100644
--- a/test/rails_test_helper.rb
+++ b/test/rails_test_helper.rb
@@ -15,6 +15,12 @@ require 'facebooker/rails/publisher'
require 'facebooker/rails/facebook_form_builder'
+if Rails.version > '2.3'
+ include Test::Unit::Assertions
+ include ActionController::TestCase::Assertions
+ include ActionController::TestProcess
+end
+
ActionController::Routing::Routes.draw do |map|
map.connect '', :controller=>"facebook",:conditions=>{:canvas=>true}
map.connect '', :controller=>"plain_old_rails"
| Fix many 2.3.2 specs by including assertion modules
|
diff --git a/test/vagrant_list_test.rb b/test/vagrant_list_test.rb
index abc1234..def5678 100644
--- a/test/vagrant_list_test.rb
+++ b/test/vagrant_list_test.rb
@@ -0,0 +1,18 @@+require 'test/unit'
+require 'vagrant-list'
+
+class VagrantListTest < Test::Unit::TestCase
+
+ def test_virtual_machine_present
+
+ end
+
+ def test_virtual_machine_absent
+
+ end
+
+ def test_virtual_machine_running
+
+ end
+
+end
| Add test stubs - currently unsure as to how to test the CLI command
|
diff --git a/test/basic.rb b/test/basic.rb
index abc1234..def5678 100644
--- a/test/basic.rb
+++ b/test/basic.rb
@@ -7,9 +7,6 @@ end
class BrokenState < BfsBruteForce::State
- def solved?
- false
- end
end
class TestBasic < Minitest::Test
@@ -30,7 +27,7 @@ assert_raises(NotImplementedError) {state.next_states(nil)}
assert state.solved?
- solver.solve state, []
+ solver.solve state
end
def test_broken
@@ -38,8 +35,7 @@ solver = BfsBruteForce::Solver.new
assert_raises(NotImplementedError) {state.next_states(nil)}
- refute state.solved?
-
- assert_raises(NotImplementedError) { solver.solve(state, []) }
+ assert_raises(NotImplementedError) {state.solved?}
+ assert_raises(NotImplementedError) { solver.solve(state) }
end
end
| Increase to 100% test coverage
|
diff --git a/script/htmlproof.rb b/script/htmlproof.rb
index abc1234..def5678 100644
--- a/script/htmlproof.rb
+++ b/script/htmlproof.rb
@@ -13,5 +13,9 @@ :typhoeus => {
:timeout => 15, # seconds
},
- :verbose => true,
+ :url_ignore => [
+ # html-proofer removes the end slash;
+ # this site will return 500 if the URL is not an exact match
+ /script-tutorials.com/,
+ ],
}).run
| Remove script-tutorials.com from link checks
|
diff --git a/beachball.gemspec b/beachball.gemspec
index abc1234..def5678 100644
--- a/beachball.gemspec
+++ b/beachball.gemspec
@@ -10,16 +10,8 @@ spec.email = ["isaac@thewilliams.ws"]
spec.summary = %q{An small pinwheel, rotating infinitely in the blackness of space despite the absence of air}
- spec.homepage = "TODO: Put your gem's website or public repo URL here."
+ spec.homepage = "https://github.com/fomentia/beachball"
spec.license = "MIT"
-
- # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
- # to allow pushing to a single host or delete this section to allow pushing to any host.
- if spec.respond_to?(:metadata)
- spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
- else
- raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
- end
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
spec.bindir = "exe"
| Allow public gem pushes to RubyGems
|
diff --git a/config/initializers/apipie.rb b/config/initializers/apipie.rb
index abc1234..def5678 100644
--- a/config/initializers/apipie.rb
+++ b/config/initializers/apipie.rb
@@ -1,7 +1,7 @@ Apipie.configure do |config|
config.app_name = "AACT 2 API"
config.api_base_url = "/api"
- config.doc_base_url = "/docs"
+ config.doc_base_url = "/api_docs"
# where is your API defined?
config.api_controllers_matcher = "#{Rails.root}/app/controllers/api/**/*.rb"
end
| Change api docs base url.
|
diff --git a/config/software/spawn-fcgi.rb b/config/software/spawn-fcgi.rb
index abc1234..def5678 100644
--- a/config/software/spawn-fcgi.rb
+++ b/config/software/spawn-fcgi.rb
@@ -31,6 +31,6 @@ command "./configure" \
" --prefix=#{install_dir}/embedded", env: env
- command "make -j #{max_build_jobs}", env: env
- command "make install", env: env
+ make "-j #{max_build_jobs}", env: env
+ make "install", env: env
end
| Use `make` instead of `command` in spawn-fgci |
diff --git a/db/data_migration/20161010105438_update_worldwide_organisation_british_consulate_sylhet_slug.rb b/db/data_migration/20161010105438_update_worldwide_organisation_british_consulate_sylhet_slug.rb
index abc1234..def5678 100644
--- a/db/data_migration/20161010105438_update_worldwide_organisation_british_consulate_sylhet_slug.rb
+++ b/db/data_migration/20161010105438_update_worldwide_organisation_british_consulate_sylhet_slug.rb
@@ -0,0 +1,3 @@+world_org = WorldwideOrganisation.find_by(slug: 'british-high-commission-office-sylhet')
+world_org.slug = 'british-consulate-sylhet'
+world_org.save!
| Update slug for British Consulate Sylhet
Part of https://trello.com/c/4p0ojDbC/494-september-redirects-medium
`WorldwideOrganisation` implements `PublishesToPublishingApi` which
will automatically republish and create the appropriate redirects, so
this should be sufficient.
|
diff --git a/app/helpers/custom_bigbluebutton_rooms_helper.rb b/app/helpers/custom_bigbluebutton_rooms_helper.rb
index abc1234..def5678 100644
--- a/app/helpers/custom_bigbluebutton_rooms_helper.rb
+++ b/app/helpers/custom_bigbluebutton_rooms_helper.rb
@@ -3,7 +3,7 @@ module CustomBigbluebuttonRoomsHelper
def mobile_google_play_link
- "https://play.google.com/store/apps/details?id=org.mconf.android.mconfmobile"
+ "https://play.google.com/store/apps/details?id=air.com.mconf.mconfmobile"
end
def mobile_google_play_image
| Update the URL to the new android mobile client
|
diff --git a/app/policies/project_inherited_policy_helpers.rb b/app/policies/project_inherited_policy_helpers.rb
index abc1234..def5678 100644
--- a/app/policies/project_inherited_policy_helpers.rb
+++ b/app/policies/project_inherited_policy_helpers.rb
@@ -6,4 +6,9 @@ def destroy?
create?
end
+
+ # This method is used in ApplicationPolicy#done_by_owner_or_admin?
+ def is_owned_by?(user)
+ user.present? && record.project.user == user
+ end
end
| Revert "Remove outdated comment and related code"
This reverts commit 2aba0d62b480657bfbf2571f23b2c309d3e20566.
|
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -28,9 +28,10 @@
def update
@user = User.new(user_params)
- if @user.save
+ if @user.update(params[:user])
redirect_to @user
else
+ @errors = @user.errors.full_messages
redirect_to 'edit_user_path'
end
end
| Add error for failed update request
|
diff --git a/test/factories/team_members.rb b/test/factories/team_members.rb
index abc1234..def5678 100644
--- a/test/factories/team_members.rb
+++ b/test/factories/team_members.rb
@@ -3,6 +3,7 @@ FactoryBot.define do
factory :team_member do
event
+ display { true }
after(:build) do |team_member|
team_member.user_con_profile ||= build(:user_con_profile, convention: team_member.event.convention)
| Set more reasonable defaults for team members in test
|
diff --git a/db/migrate/20150916095528_add_content_id_to_publisher_documents.rb b/db/migrate/20150916095528_add_content_id_to_publisher_documents.rb
index abc1234..def5678 100644
--- a/db/migrate/20150916095528_add_content_id_to_publisher_documents.rb
+++ b/db/migrate/20150916095528_add_content_id_to_publisher_documents.rb
@@ -0,0 +1,10 @@+class AddContentIdToPublisherDocuments < Mongoid::Migration
+ def self.up
+ Artefact.where(owning_app: 'publisher', content_id: nil).each do |artefact|
+ artefact.set(:content_id, SecureRandom.uuid)
+ end
+ end
+
+ def self.down
+ end
+end
| Set content_id for all publisher's artefacts
Artefacts belonging to the publisher application are created in
panopticon. We are adding `content_ids` to each artefact on creation.
This migration adds them wherever they're missing.
Uses the atomic `Artefact#set` to prevent callbacks, validations and
observers from firing.
|
diff --git a/test/unit/asset_bundle_test.rb b/test/unit/asset_bundle_test.rb
index abc1234..def5678 100644
--- a/test/unit/asset_bundle_test.rb
+++ b/test/unit/asset_bundle_test.rb
@@ -6,11 +6,30 @@ def test_raise_exception_if_bundle_command_fails
capture_io do
with_env('JEKYLL_MINIBUNDLE_CMD_JS' => 'false') do
- bundle = AssetBundle.new :js, [fixture_path('_assets/scripts/dependency.js')], fixture_path
- err = assert_raises(RuntimeError) { bundle.make_bundle }
+ err = assert_raises(RuntimeError) { make_bundle }
assert_equal 'Bundling js assets failed with exit status 1, command: false', err.to_s
end
end
end
+
+ def test_raise_exception_if_bundle_command_not_found
+ with_env('JEKYLL_MINIBUNDLE_CMD_JS' => 'no-such-jekyll-minibundle-cmd') do
+ assert_raises(Errno::ENOENT) { make_bundle }
+ end
+ end
+
+ def test_raise_exception_if_bundle_command_not_configured
+ with_env('JEKYLL_MINIBUNDLE_CMD_JS' => nil) do
+ err = assert_raises(RuntimeError) { make_bundle }
+ assert_equal 'You need to set bundling command in $JEKYLL_MINIBUNDLE_CMD_JS', err.to_s
+ end
+ end
+
+ private
+
+ def make_bundle
+ bundle = AssetBundle.new :js, [fixture_path('_assets/scripts/dependency.js')], fixture_path
+ bundle.make_bundle
+ end
end
end
| Add tests for other failures when executing bundling command
|
diff --git a/spec/dummy/db/seeds/modalities/rabbit.rb b/spec/dummy/db/seeds/modalities/rabbit.rb
index abc1234..def5678 100644
--- a/spec/dummy/db/seeds/modalities/rabbit.rb
+++ b/spec/dummy/db/seeds/modalities/rabbit.rb
@@ -3,14 +3,21 @@
rabbit = Patient.find_by(family_name: "RABBIT", given_name: "Roger")
file_path = File.join(File.dirname(__FILE__), "rabbit_modalities.csv")
+ user = Renalware::User.first
+
+ if rabbit.current_modality.present?
+ rabbit.current_modality.terminate_by(user, on: Time.zone.now)
+ end
CSV.foreach(file_path, headers: true) do |row|
Modalities::Modality.find_or_create_by!(
patient_id: rabbit.id,
- description_id: row["description_id"],
- started_on: row["started_on"],
- ended_on: row["ended_on"],
- created_by_id: Renalware::User.first.id)
+ description_id: row["description_id"]
+ ) do |modality|
+ modality.started_on = row["started_on"]
+ modality.ended_on = row["ended_on"]
+ modality.by = user
+ end
end
end
end
| Terminate Rabbit current_modality if present before seeding more
|
diff --git a/spec/lib/tasks/evm_export_import_spec.rb b/spec/lib/tasks/evm_export_import_spec.rb
index abc1234..def5678 100644
--- a/spec/lib/tasks/evm_export_import_spec.rb
+++ b/spec/lib/tasks/evm_export_import_spec.rb
@@ -0,0 +1,29 @@+require 'rake'
+
+describe 'evm_export_import' do
+ let(:task_path) {'lib/tasks/evm_export_import'}
+
+ describe 'evm:import:alerts', :type => :rake_task do
+ it 'depends on the environment' do
+ expect(Rake::Task['evm:import:alerts'].prerequisites).to include('environment')
+ end
+ end
+
+ describe 'evm:import:alertprofiles', :type => :rake_task do
+ it 'depends on the environment' do
+ expect(Rake::Task['evm:import:alertprofiles'].prerequisites).to include('environment')
+ end
+ end
+
+ describe 'evm:export:alerts', :type => :rake_task do
+ it 'depends on the environment' do
+ expect(Rake::Task['evm:export:alerts'].prerequisites).to include('environment')
+ end
+ end
+
+ describe 'evm:export:alertprofiless', :type => :rake_task do
+ it 'depends on the environment' do
+ expect(Rake::Task['evm:export:alertprofiles'].prerequisites).to include('environment')
+ end
+ end
+end
| Add test to ensure rake script setup correctly
|
diff --git a/spec/suites/rspec/functional/dsl_spec.rb b/spec/suites/rspec/functional/dsl_spec.rb
index abc1234..def5678 100644
--- a/spec/suites/rspec/functional/dsl_spec.rb
+++ b/spec/suites/rspec/functional/dsl_spec.rb
@@ -12,7 +12,7 @@ expect(subject).to have_received.foobar(1, 2)
expect {
expect(subject).to have_received.foobar(1, 2, 3)
- }.to raise_error(Spec::Expectations::ExpectationNotMetError)
+ }.to raise_error(RSpec::Expectations::ExpectationNotMetError)
end
end
end
| Fix obsolete reference to RSpec-1 in a test
|
diff --git a/spec/site_spec.rb b/spec/site_spec.rb
index abc1234..def5678 100644
--- a/spec/site_spec.rb
+++ b/spec/site_spec.rb
@@ -32,6 +32,6 @@ files << File.basename(file)
end
- expect(files).to eq(["a.jpg", "b.jpg", "c.jpg"])
+ expect(files.sort).to eq(["a.jpg", "b.jpg", "c.jpg"])
end
end | Sort the files list in the asset copying before comparing.
|
diff --git a/spec/uuid_spec.rb b/spec/uuid_spec.rb
index abc1234..def5678 100644
--- a/spec/uuid_spec.rb
+++ b/spec/uuid_spec.rb
@@ -16,7 +16,9 @@
it "should instantiate from a Time object" do
ts = Time.new
- UUID.new(ts).to_time.should eq(ts)
+ # Nanosecond precision is available on some platforms but not in UUIDv1 so they may not match, just be v.close
+ # Note that the time returned from two UUIDs using these two timestamps will still be the same
+ (UUID.new(ts).to_time - ts).should < 0.000001
end
it "should turn have a to_time class method that takes bytes" do
| Modify uuid test to account for nanosecond precision on some platforms
|
diff --git a/db/migrate/20090505233940_create_accounts.rb b/db/migrate/20090505233940_create_accounts.rb
index abc1234..def5678 100644
--- a/db/migrate/20090505233940_create_accounts.rb
+++ b/db/migrate/20090505233940_create_accounts.rb
@@ -24,6 +24,8 @@ add_index :accounts, :email, :unique => true
add_index :accounts, :confirmation_token, :unique => true
add_index :accounts, :reset_password_token, :unique => true
+
+ execute "ALTER TABLE accounts CHANGE login login varchar(40) COLLATE utf8_bin NOT NULL;"
end
def self.down
| Fix case sensitivy bug on logins
|
diff --git a/test/test_build_source_gem.rb b/test/test_build_source_gem.rb
index abc1234..def5678 100644
--- a/test/test_build_source_gem.rb
+++ b/test/test_build_source_gem.rb
@@ -0,0 +1,9 @@+require 'minitest/autorun'
+
+class TestBuildSourceGem < MiniTest::Test
+ def test_build_latest_source_gem
+ version = File.read("source-versions.txt").split("\n").last
+ output = `rake vendor/cache/6to5-source-#{version}.gem 2>&1`
+ assert $?.success?, output
+ end
+end
| Test building latest source gem
|
diff --git a/lib/postgresql_cursor/active_record/connection_adapters/postgresql_type_map.rb b/lib/postgresql_cursor/active_record/connection_adapters/postgresql_type_map.rb
index abc1234..def5678 100644
--- a/lib/postgresql_cursor/active_record/connection_adapters/postgresql_type_map.rb
+++ b/lib/postgresql_cursor/active_record/connection_adapters/postgresql_type_map.rb
@@ -5,7 +5,7 @@ module PostgreSQLTypeMap
# Returns the private "type_map" needed for the cursor operation
def get_type_map # :nodoc:
- if Rails::VERSION::MAJOR == 4 && Rails::VERSION::MINOR == 0
+ if ::ActiveRecord::VERSION::MAJOR == 4 && ::ActiveRecord::VERSION::MINOR == 0
::ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::OID::TYPE_MAP
else
type_map
| Use ActiveRecord version instead of Rails'
...So this will work in non-Rails apps
|
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index abc1234..def5678 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -3,6 +3,11 @@
require File.expand_path("../dummy/config/environment", __FILE__)
require 'rspec/rails'
+
+ActiveRecord::Migrator.migrations_paths = ActiveRecord::Tasks::DatabaseTasks.migrations_paths
+ActiveRecord::Tasks::DatabaseTasks.drop_current
+ActiveRecord::Tasks::DatabaseTasks.create_current
+ActiveRecord::Tasks::DatabaseTasks.migrate
Dir[File.expand_path("../support/**/*.rb", __FILE__)].each { |f| require f }
| Reset the DB before running 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
@@ -11,5 +11,5 @@ end
def path_prefix
- /darwin/ =~ RUBY_PLATFORM ? '/private' : nil
+ /darwin/ =~ RUBY_PLATFORM ? '/private' : ''
end
| Return empty string rather than nil for path prefix
|
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,3 +1,6 @@+require 'simplecov'
+SimpleCov.start
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
require 'homesick'
| Set up simplecov (it was in the Gemfile before, but it wasn't actually used)
|
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,6 +20,7 @@ config.order = 'random'
config.before(:suite) do
+ DatabaseCleaner[:sequel, {:connection => DB}]
DatabaseCleaner.strategy = :transaction
DatabaseCleaner.clean_with(:truncation)
end
| Set default connection for DatabaseCleaner
|
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index abc1234..def5678 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -3,7 +3,9 @@ require 'database_cleaner'
current_path = File.dirname(__FILE__)
-Dir[File.join(current_path, 'support/**/*.rb')].each { |f| require f }
+SPEC_MODELS_PATH = File.join(current_path, 'support/**/*.rb').freeze
+Dir[SPEC_MODELS_PATH].each { |f| require f }
+
Mongoid.load! File.join(current_path, 'support/mongoid.yml'), :test
RSpec.configure do |config|
@@ -28,4 +30,14 @@ config.around(:each) do |example|
DatabaseCleaner.cleaning { example.run }
end
+
+ config.before(:each) do
+ # Need to manually reload spec models for mutant to work as expected
+ if ENV['MUTANT']
+ Dir[SPEC_MODELS_PATH].each do |filename|
+ Object.send(:remove_const, File.basename(filename, '.rb').capitalize)
+ load filename
+ end
+ end
+ end
end
| Add spec model reloading when using mutant
|
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,7 +30,6 @@ require 'docile'
require 'singleton'
-require 'rspec'
RSpec.configure do |config|
config.expect_with :rspec do |c|
| Remove explicit require of rspec to fix builds
Not sure why this works, or is even possible? But I can reproduce locally that
all non-1.8 builds fail when using a bundler cache unless this line is removed.
My guess is that, when using the --path option to bundler, all gems are being
implicitly required, and requiring rspec a second time is somehow causing issues,
but that doesn't make much sense to me.
|
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,4 +1,5 @@ $LOAD_PATH.unshift(File.expand_path(File.join(File.dirname(__FILE__), %w[.. lib])))
+ENV["PATH"] = [File.expand_path(File.join(File.dirname(__FILE__), %w[.. bin])), ENV["PATH"]].join(':')
require 'nom'
| Test the local nom script, rather than the system installed one
|
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,7 +7,7 @@ def columns(*cols)
return super if cols.empty?
define_method(:columns){cols}
- @dataset.instance_variable_set(:@columns, cols) if @dataset
+ @dataset.send(:columns=, cols) if @dataset
def_column_accessor(*cols)
@columns = cols
@db_schema = {}
| Fix spec for Sequel > 5.1
|
diff --git a/src/watir_robot_gui/worker/run_button.rb b/src/watir_robot_gui/worker/run_button.rb
index abc1234..def5678 100644
--- a/src/watir_robot_gui/worker/run_button.rb
+++ b/src/watir_robot_gui/worker/run_button.rb
@@ -7,6 +7,7 @@
def doInBackground
self.status_bar.text = "Running tests. Wait until all browsers have closed."
+ self.test_path = self.test_path.gsub('\\', '/')
# Ensure the parameter to -d below is a directory
if File.directory? self.test_path
@@ -19,7 +20,7 @@ # so for now we're just running it command-line style
rf_jar = 'lib/standalone/robotframework.jar'
# @TODO get some kind of logging in place
- results = IO.popen("java -jar #{rf_jar} -T -d #{output_path} #{self.test_path}")
+ results = IO.popen("java -jar #{rf_jar} -T -d \"#{output_path}\" \"#{self.test_path}\"")
end
end
end
| Fix slashes and spacing issue for system call for Run worker thread
|
diff --git a/deploy_website.rb b/deploy_website.rb
index abc1234..def5678 100644
--- a/deploy_website.rb
+++ b/deploy_website.rb
@@ -0,0 +1,38 @@+#!/usr/bin/env ruby
+
+require 'fileutils'
+extend FileUtils
+
+REPO='git@github.com:beyama/winter.git'
+GROUP_ID = 'io.jentz.winter'
+DIR = 'tmp_clone'
+
+rm_rf DIR
+`git clone #{REPO} #{DIR}`
+
+cd DIR
+
+`git checkout -t origin/gh-pages`
+
+# Remove old site
+rm_rf '*'
+
+# Download the latest javadoc
+['winter', 'winter-android', 'winter-compiler'].each do |id|
+ `curl -L "http://repository.sonatype.org/service/local/artifact/maven/redirect?r=central-proxy&g=#{GROUP_ID}&a=#{id}&v=LATEST&c=javadoc" > javadoc.zip`
+ mkdir 'javadoc' unless File.directory? 'javadoc'
+ `unzip -o javadoc.zip -d javadoc`
+ rm 'javadoc.zip'
+end
+
+# Stage all files in git and create a commit
+`git add .`
+`git add -u`
+`git commit -m "Website at $(date)"`
+
+# Push the new files up to GitHub
+`git push origin gh-pages`
+
+# Clean up
+cd '..'
+rm_rf DIR | Add java doc deploy script
|
diff --git a/lib/api_helper.rb b/lib/api_helper.rb
index abc1234..def5678 100644
--- a/lib/api_helper.rb
+++ b/lib/api_helper.rb
@@ -20,7 +20,7 @@ private
def do_request(type, resource, additional_headers = nil, body = nil)
- http = EventMachine::HttpRequest.new(resource)
+ http = EventMachine::HttpRequest.new(resource, :connect_timeout => 20, :inactivity_timeout => 20)
headers = if additional_headers
authorization.merge(additional_headers)
else
| Increase API connection timeout time
|
diff --git a/lib/serverspec.rb b/lib/serverspec.rb
index abc1234..def5678 100644
--- a/lib/serverspec.rb
+++ b/lib/serverspec.rb
@@ -12,23 +12,19 @@
module RSpec::Core::Notifications
class FailedExampleNotification < ExampleNotification
- def message_lines
- @lines ||=
+ def failure_lines
+ @failure_lines ||=
begin
lines = ["Failure/Error: #{read_failed_line.strip}"]
lines << "#{exception_class_name}:" unless exception_class_name =~ /RSpec/
exception.message.to_s.split("\n").each do |line|
lines << " #{line}" if exception.message
+ end
lines << " #{example.metadata[:command]}"
lines << " #{example.metadata[:stdout]}" if example.metadata[:stdout]
lines << " #{example.metadata[:stderr]}" if example.metadata[:stderr]
+ lines
end
- if shared_group
- lines << "Shared Example Group: \"#{shared_group.metadata[:shared_group_name]}\"" +
- " called from #{backtrace_formatter.backtrace_line(shared_group.location)}"
- end
- lines
- end
end
end
end
| Fix how to override failure message
|
diff --git a/lib/cassandra.rb b/lib/cassandra.rb
index abc1234..def5678 100644
--- a/lib/cassandra.rb
+++ b/lib/cassandra.rb
@@ -8,7 +8,7 @@ here = File.expand_path(File.dirname(__FILE__))
class Cassandra ; end
-unless Cassandra.methods.include?("VERSION")
+unless Cassandra.respond_to?(:VERSION)
require "#{here}/cassandra/0.6"
end
| Change how version is detected for Ruby 1.9 compat
|
diff --git a/spec/unit/resources/hypervisor_cluster_profile/delete_cluster_spec.rb b/spec/unit/resources/hypervisor_cluster_profile/delete_cluster_spec.rb
index abc1234..def5678 100644
--- a/spec/unit/resources/hypervisor_cluster_profile/delete_cluster_spec.rb
+++ b/spec/unit/resources/hypervisor_cluster_profile/delete_cluster_spec.rb
@@ -1,9 +1,9 @@ require_relative './../../../spec_helper'
-describe 'oneview_test_api1600_c7000::hypervisor_cluster_profile_delete' do
+describe 'oneview_test::hypervisor_cluster_profile_delete' do
let(:resource_name) { 'hypervisor_cluster_profile' }
include_context 'chef context'
- let(:target_class) { OneviewSDK::API1600::C7000::HypervisorClusterProfile }
+ let(:target_class) { OneviewSDK::HypervisorClusterProfile }
it 'removes it with soft delete if it exist' do
expect_any_instance_of(target_class).to receive(:retrieve!).and_return(true)
| Change module path for UT
|
diff --git a/diversity.gemspec b/diversity.gemspec
index abc1234..def5678 100644
--- a/diversity.gemspec
+++ b/diversity.gemspec
@@ -20,6 +20,7 @@ s.add_development_dependency('bacon')
s.add_development_dependency('coveralls')
s.add_development_dependency('rake')
+ s.add_development_dependency('reek')
s.add_development_dependency('rubocop')
s.add_development_dependency('simplecov')
s.add_development_dependency('simplecov-rcov')
| Add reek as a development dependency
|
diff --git a/test/test_start.rb b/test/test_start.rb
index abc1234..def5678 100644
--- a/test/test_start.rb
+++ b/test/test_start.rb
@@ -0,0 +1,20 @@+require 'common'
+
+class StartTest < Net::SFTP::TestCase
+ def test_with_block
+ ssh = mock('ssh')
+ ssh.expects(:close)
+ Net::SSH.expects(:start).with('host', 'user', {}).returns(ssh)
+
+ sftp = mock('sftp')
+ # TODO: figure out how to verify a block is passed, and call it later.
+ # I suspect this is hard to do properly with mocha.
+ Net::SFTP::Session.expects(:new).with(ssh).returns(sftp)
+ sftp.expects(:connect!).returns(sftp)
+ sftp.expects(:loop)
+
+ Net::SFTP.start('host', 'user') do
+ # NOTE: currently not called!
+ end
+ end
+end
| Add half-baked test for Net::SFTP.start
|
diff --git a/lib/ravelin/checkout_transaction.rb b/lib/ravelin/checkout_transaction.rb
index abc1234..def5678 100644
--- a/lib/ravelin/checkout_transaction.rb
+++ b/lib/ravelin/checkout_transaction.rb
@@ -20,5 +20,15 @@ :three_d_secure
attr_required :transaction_id, :currency, :debit, :credit
+
+ def initialize(params)
+ unless params['3ds'].nil?
+ self.three_d_secure = ThreeDSecure.new(params['3ds'])
+ params.delete('3ds')
+ end
+
+ super(params)
+ end
+
end
end
| Apply 3ds rename to checkout transaction
|
diff --git a/lib/tasks/sample_data/addressing.rb b/lib/tasks/sample_data/addressing.rb
index abc1234..def5678 100644
--- a/lib/tasks/sample_data/addressing.rb
+++ b/lib/tasks/sample_data/addressing.rb
@@ -14,7 +14,7 @@ end
def zone
- zone = Spree::Zone.find_or_create_by_name!("Australia")
+ zone = Spree::Zone.find_or_create_by_name!(ENV.fetch('CHECKOUT_ZONE'))
zone.members.create!(zonable: country)
zone
end
| Make sample data zone read from the environment variable CHECKOUT_ZONE
|
diff --git a/lib/hem/setup.rb b/lib/hem/setup.rb
index abc1234..def5678 100644
--- a/lib/hem/setup.rb
+++ b/lib/hem/setup.rb
@@ -2,6 +2,5 @@ require_relative 'version'
require_relative 'plugins'
-Hem::Plugins.new(__dir__, '.noGemfile', false).define do
- gem 'hem', Hem::VERSION, :path => File.expand_path(File.join('..', '..', '..'), __FILE__)
-end.require
+$:.push File.expand_path(File.join("..", ".."), __FILE__)
+require 'hem'
| Remove Hem bundler self reference
The use of Bundler is having trouble requiring multiple separate definitions
|
diff --git a/react-native-appsflyer.podspec b/react-native-appsflyer.podspec
index abc1234..def5678 100644
--- a/react-native-appsflyer.podspec
+++ b/react-native-appsflyer.podspec
@@ -13,4 +13,5 @@ s.source_files = 'ios/**/*.{h,m}'
s.platform = :ios, "8.0"
s.dependency 'AppsFlyerFramework', '~> 4.8.4'
+ s.dependency 'React'
end | Add React as a dependency on the PodFile
|
diff --git a/lib/opal/util.rb b/lib/opal/util.rb
index abc1234..def5678 100644
--- a/lib/opal/util.rb
+++ b/lib/opal/util.rb
@@ -2,26 +2,34 @@ module Util
extend self
+ def null
+ if (/mswin|mingw/ =~ RUBY_PLATFORM).nil?
+ '/dev/null'
+ else
+ 'nul'
+ end
+ end
+
# Used for uglifying source to minify
def uglify(str)
- IO.popen('uglifyjs 2> /dev/null', 'r+') do |i|
+ IO.popen('uglifyjs 2> ' + null, 'r+') do |i|
i.puts str
i.close_write
return i.read
end
- rescue Errno::ENOENT, Errno::EPIPE
+ rescue Errno::ENOENT, Errno::EPIPE, Errno::EINVAL
$stderr.puts '"uglifyjs" command not found (install with: "npm install -g uglify-js")'
nil
end
# Gzip code to check file size
def gzip(str)
- IO.popen('gzip -f 2> /dev/null', 'r+') do |i|
+ IO.popen('gzip -f 2> ' + null, 'r+') do |i|
i.puts str
i.close_write
return i.read
end
- rescue Errno::ENOENT, Errno::EPIPE
+ rescue Errno::ENOENT, Errno::EPIPE, Errno::EINVAL
$stderr.puts '"gzip" command not found, it is required to produce the .gz version'
nil
end
| Fix Util module to work on Windows
|
diff --git a/lib/simplemvc.rb b/lib/simplemvc.rb
index abc1234..def5678 100644
--- a/lib/simplemvc.rb
+++ b/lib/simplemvc.rb
@@ -3,6 +3,8 @@ module Simplemvc
class Application
def call(env)
+ return [ 302, { "Location" => "/pages/about" }, [] ] if env["PATH_INFO"] == "/"
+ return [ 500, {}, []] if env["PATH_INFO"] == "/favicon.ico"
# env["PATH_INFO"] = "/pages/about" => "PagesController.send(:about)"
controller_class, action = get_controller_and_action(env)
response = controller_class.new.send(action)
| Implement root redirect and favicon path base case
|
diff --git a/spec/helpers/application_helper/buttons/generic_feature_button_with_disable_spec.rb b/spec/helpers/application_helper/buttons/generic_feature_button_with_disable_spec.rb
index abc1234..def5678 100644
--- a/spec/helpers/application_helper/buttons/generic_feature_button_with_disable_spec.rb
+++ b/spec/helpers/application_helper/buttons/generic_feature_button_with_disable_spec.rb
@@ -0,0 +1,46 @@+describe ApplicationHelper::Button::GenericFeatureButtonWithDisable do
+ [:start].each do |feature|
+ describe '#skip?' do
+ context "when vm supports feature #{feature}" do
+ before do
+ @record = FactoryGirl.create(:vm_vmware)
+ allow(@record).to receive(:is_available?).with(feature).and_return(true)
+ end
+
+ it "will not be skipped for this vm" do
+ view_context = setup_view_context_with_sandbox({})
+ button = described_class.new(view_context, {}, {'record' => @record}, {:options => {:feature => feature}})
+ expect(button.skip?).to be_falsey
+ end
+ end
+
+ context "when instance does not support feature #{feature}" do
+ before do
+ @record = FactoryGirl.create(:vm_vmware)
+ allow(@record).to receive(:is_available?).with(feature).and_return(false)
+ end
+
+ it "will be skipped for this vm" do
+ view_context = setup_view_context_with_sandbox({})
+ button = described_class.new(view_context, {}, {'record' => @record}, {:options => {:feature => feature}})
+ expect(button.skip?).to be_truthy
+ end
+ end
+ end
+ describe '#disabled?' do
+ context "when record has an error message" do
+ before do
+ @record = FactoryGirl.create(:vm_vmware)
+ message = "xx stop message"
+ allow(@record).to receive(:is_available_now_error_message).with(feature).and_return(message)
+ end
+
+ it "disables the button and returns the stop error message" do
+ view_context = setup_view_context_with_sandbox({})
+ button = described_class.new(view_context, {}, {'record' => @record}, {:options => {:feature => feature}})
+ expect(button.disabled?).to be_truthy
+ end
+ end
+ end
+ end
+end
| Add spec for Generic Button with Disable
|
diff --git a/lib/cocoapods/executable.rb b/lib/cocoapods/executable.rb
index abc1234..def5678 100644
--- a/lib/cocoapods/executable.rb
+++ b/lib/cocoapods/executable.rb
@@ -33,7 +33,7 @@ end
status = Open4.spawn(full_command, :stdout => stdout, :stderr => stderr, :status => true)
# TODO not sure that we should be silent in case of a failure.
- puts "[!] Failed: #{full_command}".red unless status.success? || Config.instance.silent?
+ puts (Config.instance.verbose? ? ' ' : '') << "[!] Failed: #{full_command}".red unless status.success? || Config.instance.silent?
stdout.join("\n") + stderr.join("\n") # TODO will this suffice?
end
private name
| [Executable] Indent warning if command fails.
|
diff --git a/test/models/category_test.rb b/test/models/category_test.rb
index abc1234..def5678 100644
--- a/test/models/category_test.rb
+++ b/test/models/category_test.rb
@@ -22,9 +22,7 @@ categories = Category.all.includes(children: :child).to_a.index_by(&:id)
tree_to_array(Category.get_tree).each do |node|
should_be = categories[node[0]].children.map {|i| i.child_id}.sort
- assert(node[1].sort == should_be,
- "Children array of #{node[0]}:#{categories[node[0]].name}, " \
- "should be #{should_be} but was #{node[1]}")
+ assert_equal node[1].sort, should_be
end
end
| Refactor 'Category tree nodes should match category relationships' test
Substitue assert with assert_equal and remove message
|
diff --git a/lib/swow/error.rb b/lib/swow/error.rb
index abc1234..def5678 100644
--- a/lib/swow/error.rb
+++ b/lib/swow/error.rb
@@ -17,8 +17,6 @@ def reason
@response[:body]['reason']
end
-
- private
def self.nok?(response)
response[:body].respond_to?(:each_key) && response[:body]['status'] == 'nok'
| Remove unnecessary private access modifier
|
diff --git a/lib/turbolinks.rb b/lib/turbolinks.rb
index abc1234..def5678 100644
--- a/lib/turbolinks.rb
+++ b/lib/turbolinks.rb
@@ -14,9 +14,7 @@ before_filter :set_xhr_redirected_to, :set_request_method_cookie
after_filter :abort_xdomain_redirect
end
- end
- ActiveSupport.on_load(:action_dispatch) do
ActionDispatch::Request.class_eval do
def referer
self.headers['X-XHR-Referer'] || super
| Use the action_controller hook for overriding the referer method because there is no action_dispatch hook
|
diff --git a/messaging.gemspec b/messaging.gemspec
index abc1234..def5678 100644
--- a/messaging.gemspec
+++ b/messaging.gemspec
@@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = 'evt-messaging'
- s.version = '0.27.0.1'
+ s.version = '0.28.0.0'
s.summary = 'Common primitives for platform-specific messaging implementations for Eventide'
s.description = ' '
| Package version is increased from 0.27.0.1 to 0.28.0.0
|
diff --git a/metamodel.gemspec b/metamodel.gemspec
index abc1234..def5678 100644
--- a/metamodel.gemspec
+++ b/metamodel.gemspec
@@ -17,5 +17,11 @@ s.description = "Not desc for now."
s.files = Dir["lib/**/*.rb"]
+
+ s.add_runtime_dependency 'claide', '>= 1.0.0', '< 2.0'
+ s.add_runtime_dependency 'colored', '~> 1.2'
+
+ s.add_development_dependency 'bundler', '~> 1.3'
+ s.add_development_dependency 'rake', '~> 10.0'
+
end
-
| Add development dependencies to gemsepc
|
diff --git a/db/migrate/20171102154400_change_column_type_to_payment_method_zahlen_charge.rb b/db/migrate/20171102154400_change_column_type_to_payment_method_zahlen_charge.rb
index abc1234..def5678 100644
--- a/db/migrate/20171102154400_change_column_type_to_payment_method_zahlen_charge.rb
+++ b/db/migrate/20171102154400_change_column_type_to_payment_method_zahlen_charge.rb
@@ -0,0 +1,12 @@+class ChangeColumnTypeToPaymentMethodZahlenCharge < ActiveRecord::Migration
+ def change
+ pms = Zahlen::Charge.payment_methods
+ Zahlen::Charge.select("*, payment_method as old_pm").find_each do |c|
+ next if c.old_pm.blank?
+ new_pm = pms[c.old_pm]
+ c.update_column(:payment_method, new_pm)
+ end
+
+ change_column :zahlen_charges, :payment_method, 'integer USING CAST(payment_method AS integer)'
+ end
+end
| Add migration to update enum values of payment method
|
diff --git a/bosh-director/db/migrations/director/20151229184742_add_vm_attributes_to_instance.rb b/bosh-director/db/migrations/director/20151229184742_add_vm_attributes_to_instance.rb
index abc1234..def5678 100644
--- a/bosh-director/db/migrations/director/20151229184742_add_vm_attributes_to_instance.rb
+++ b/bosh-director/db/migrations/director/20151229184742_add_vm_attributes_to_instance.rb
@@ -7,21 +7,19 @@ add_column :vm_env_json, String, :text => true
add_column :trusted_certs_sha1, String, { :default => Digest::SHA1.hexdigest('') }
end
- self[:instances].each do |row|
- if row[:vm]
- vm_cid = row[:vm][:cid]
- agent_id = row[:vm][:agent_id]
- credentials_json = row[:vm][:credentials_json]
- trusted_certs_sha1 = row[:vm][:trusted_certs_sha1]
- vm_env_json = row[:vm][:env_json]
- row.update(
- vm_cid: vm_cid,
- agent_id: agent_id,
- vm_env_json: vm_env_json,
- trusted_certs_sha1: trusted_certs_sha1,
- credentials_json: credentials_json)
- end
+ self[:instances].each do |instance|
+ next unless instance[:vm_id]
+
+ vm = self[:vms].filter(id: instance[:vm_id]).first
+
+ self[:instances].filter(id: instance[:id]).update(
+ vm_cid: vm[:cid],
+ agent_id: vm[:agent_id],
+ vm_env_json: vm[:env_json],
+ trusted_certs_sha1: vm[:trusted_certs_sha1],
+ credentials_json: vm[:credentials_json]
+ )
end
end
end
| Fix vm to instance migration
Signed-off-by: Maria Shaldibina <dc03896a0185453e5852a5e0f0fab6cbd2e026ff@pivotal.io>
|
diff --git a/lib/infinity_test/observer/watchr.rb b/lib/infinity_test/observer/watchr.rb
index abc1234..def5678 100644
--- a/lib/infinity_test/observer/watchr.rb
+++ b/lib/infinity_test/observer/watchr.rb
@@ -10,7 +10,7 @@
# ==== Examples
#
- # watch('lib/(.*)\.rb') { |match_data| system("ruby test/test_#{match_data[1]}.rb") }
+ # watch('lib/(.*)\.rb') { |file| puts [file.name, file.path, file.match_data] }
# watch('test/test_helper.rb') { RunAll() }
#
def watch(pattern_or_file, &block)
@@ -21,7 +21,11 @@
# ==== Examples
#
- # watch_dir(:lib) { |file| RunTest(file) }
+ # watch_dir(:lib) { |file| RunTest(file) }
+ # watch_dir(:test) { |file| RunFile(file) }
+ #
+ # watch_dir(:test, :py) { |file| puts [file.name, file.path, file.match_data] }
+ # watch_dir(:test, :js) { |file| puts [file.name, file.path, file.match_data] }
#
def watch_dir(dir_name, extension = :rb, &block)
watch("^#{dir_name}/*/(.*).#{extension}", &block)
| Add more example docs to watcher class. |
diff --git a/lib/net/ldap/auth_adapters/simple.rb b/lib/net/ldap/auth_adapters/simple.rb
index abc1234..def5678 100644
--- a/lib/net/ldap/auth_adapters/simple.rb
+++ b/lib/net/ldap/auth_adapters/simple.rb
@@ -1,3 +1,5 @@+require 'net/ldap/auth_adapter'
+
module Net
class LDAP
module AuthAdapters
| Fix uninitialized constant error by adding require statement
|
diff --git a/lib/rack/switchboard/store_loader.rb b/lib/rack/switchboard/store_loader.rb
index abc1234..def5678 100644
--- a/lib/rack/switchboard/store_loader.rb
+++ b/lib/rack/switchboard/store_loader.rb
@@ -3,7 +3,7 @@ module StoreLoader
protected
def create_store(options = :memory)
- config = options || :memory
+ config = options ? options.dup : :memory
provider, config = if config.kind_of? Hash
[ config.delete(:provider), config ]
else
| Fix issue with modifying shared shared options hash
|
diff --git a/lib/roadmapster/wizeline/base_api.rb b/lib/roadmapster/wizeline/base_api.rb
index abc1234..def5678 100644
--- a/lib/roadmapster/wizeline/base_api.rb
+++ b/lib/roadmapster/wizeline/base_api.rb
@@ -18,10 +18,20 @@ )
end
+ def post(resource, payload, **options)
+ @resource_options = options
+ response = RestClient.post(
+ "#{base_endpoint(options)}#{resource}",
+ payload.to_json,
+ headers
+ )
+ JSON.parse(response.body, symbolize_names: true)
+ end
+
private
def headers
- { authorization: "Bearer #{@api_token}", }
+ { authorization: "Bearer #{@api_token}", content_type: :json }
end
def base_endpoint(options)
| Add support for POST operations to base mixin
|
diff --git a/lib/sparql/algebra/operator/graph.rb b/lib/sparql/algebra/operator/graph.rb
index abc1234..def5678 100644
--- a/lib/sparql/algebra/operator/graph.rb
+++ b/lib/sparql/algebra/operator/graph.rb
@@ -3,42 +3,17 @@ ##
# The SPARQL GraphPattern `graph` operator.
#
+ # This is basically a wrapper to add the context to the BGP.
+ #
# @see http://www.w3.org/TR/rdf-sparql-query/#sparqlAlgebra
class Graph < Operator::Binary
- include Query
-
NAME = [:graph]
-
##
- # Executes this query on the given `queryable` graph or repository.
- #
- # @param [RDF::Queryable] queryable
- # the graph or repository to query
- # @param [Hash{Symbol => Object}] options
- # any additional keyword options
- # @return [RDF::Query::Solutions]
- # the resulting solution sequence
- # @see http://www.w3.org/TR/rdf-sparql-query/#sparqlAlgebra
- def execute(queryable, options = {})
- debug("Graph", options)
- # FIXME: this must take into consideration the graph context
- @solutions = operands.last.execute(queryable, options.merge(:depth => options[:depth].to_i + 1))
- debug("=> #{@solutions.inspect}", options)
- @solutions
+ # A graph is an RDF::Query with a context
+ def self.new(context, bgp)
+ bgp.context = context
+ bgp
end
-
- ##
- # Returns an optimized version of this query.
- #
- # Applies the context to the query operand returns the query
- #
- # @return [RDF::Query]
- def optimize
- # FIXME
- graph = operands.last.dup
- graph.context = operands.first
- graph
- end
- end # Join
+ end # Graph
end # Operator
end; end # SPARQL::Algebra
| Change Operator::Graph to just have a .new class method to add the context to the bgp operator.
|
diff --git a/spec/api_classes/event_spec.rb b/spec/api_classes/event_spec.rb
index abc1234..def5678 100644
--- a/spec/api_classes/event_spec.rb
+++ b/spec/api_classes/event_spec.rb
@@ -2,10 +2,10 @@
describe LastFM::Event do
it "should define unrestricted methods" do
- LastFM::Event.unrestricted_methods.should == [:get_attendees, :get_info, :get_shouts]
+ LastFM::Event.should respond_to(:get_attendees, :get_info, :get_shouts)
end
it "should define restricted methods" do
- LastFM::Event.restricted_methods.should == [:attend, :share, :shout]
+ LastFM::Event.should respond_to(:attend, :share, :shout)
end
end
| Check restricted method definitions for Event
|
diff --git a/spec/string_calculator_spec.rb b/spec/string_calculator_spec.rb
index abc1234..def5678 100644
--- a/spec/string_calculator_spec.rb
+++ b/spec/string_calculator_spec.rb
@@ -4,6 +4,6 @@ subject { described_class.new }
it 'returns 0 if empty string provided' do
- subject.add("").should eq(0)
+ expect(subject.add("")).to eq(0)
end
end
| Change rspec syntax from should to expect
|
diff --git a/nymph.gemspec b/nymph.gemspec
index abc1234..def5678 100644
--- a/nymph.gemspec
+++ b/nymph.gemspec
@@ -23,6 +23,6 @@ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ["lib"]
- spec.add_development_dependency "bundler", "~> 1.8"
+ spec.add_development_dependency "bundler", ">= 1.6"
spec.add_development_dependency "rake", "~> 10.0"
end
| Allow an older version of bundler, for travis
|
diff --git a/test/one-time-validation/test_block_validation_with_different_types.rb b/test/one-time-validation/test_block_validation_with_different_types.rb
index abc1234..def5678 100644
--- a/test/one-time-validation/test_block_validation_with_different_types.rb
+++ b/test/one-time-validation/test_block_validation_with_different_types.rb
@@ -0,0 +1,35 @@+require 'minitest_helper'
+
+class TestBlockWithDifferentTypes < Minitest::Test
+ def person_class
+ Class.new do
+ include Sanatio
+
+ def initialize(gender)
+ @gender = gender
+ end
+
+ attr_reader :gender
+
+ ensure_that(:gender).is { !nil? }
+ end
+ end
+
+ def test_passes_when_symbol
+ assert_valid(person_class.new(:female))
+ rescue TypeError => e
+ skip("Possible Ruby bug: #{e.inspect}")
+ end
+
+ def test_passes_when_coercing_string_to_symbol
+ assert_valid(person_class.new("male".to_sym))
+ rescue TypeError => e
+ skip("Possible Ruby bug: #{e.inspect}")
+ end
+
+ def test_passes_when_bignum
+ assert_valid(person_class.new(12323234534534535345345))
+ rescue TypeError => e
+ skip("Possible Ruby bug: #{e.inspect}")
+ end
+end
| Add tests for a block validation with different types
|
diff --git a/lib/gyro/liquidgen/infos.rb b/lib/gyro/liquidgen/infos.rb
index abc1234..def5678 100644
--- a/lib/gyro/liquidgen/infos.rb
+++ b/lib/gyro/liquidgen/infos.rb
@@ -11,7 +11,7 @@
def self.showInfos(template)
if template.include?('/')
- readme = template + 'README.md' unless readme.exist?
+ readme = Pathname.new(template) + 'README.md'
else
readme = Gyro.templates_dir + template + 'README.md'
end
| Fix issue in "-i" with path
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.