diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/lib/tasks/redis.rake b/lib/tasks/redis.rake index abc1234..def5678 100644 --- a/lib/tasks/redis.rake +++ b/lib/tasks/redis.rake @@ -0,0 +1,30 @@+task 'redis:clean_up' => ['environment'] do + return unless Rails.configuration.multisite + + dbs = RailsMultisite::ConnectionManagement.all_dbs + dbs << Discourse::SIDEKIQ_NAMESPACE + + regexp = /((\$(?<message_bus>\w+)$)|(^?(?<namespace>\w+):))/ + + cursor = 0 + redis = $redis.without_namespace + + loop do + cursor, keys = redis.scan(cursor) + cursor = cursor.to_i + + redis.multi do + keys.each do |key| + if match = key.match(regexp) + db_name = match[:message_bus] || match[:namespace] + + if !dbs.include?(db_name) + redis.del(key) + end + end + end + end + + break if cursor == 0 + end +end
Add rake task to clean up orphane Redis keys when a multisite has been removed.
diff --git a/week-4/homework-cheater/homework_cheater.rb b/week-4/homework-cheater/homework_cheater.rb index abc1234..def5678 100644 --- a/week-4/homework-cheater/homework_cheater.rb +++ b/week-4/homework-cheater/homework_cheater.rb @@ -1,23 +1,47 @@-essay_1 = "J. D. Salinger: J. D. Salinger was an American author. His most notable body of work was The Catcher in the Rye. It was very a influential coming of age story." +#accept array as argument to essay_writer method +#assign each array element to a variable from the template +#return the essay template using the variables given as arguments -essay_2 = "Truman Capote: Truman Capote was an American author. His most notable body of work was In Cold Blood. He was also influential as a screenwriter and playwright." +template = "TITLE: NAME was an American author. His most notable body of work was NOVEL. THESIS." -essay_3 = "Sinclair Lewis: Sinclair Lewis was an American author. His most notable body of work was Main Street. He was influential in his views of American capitalism." +essay_1 = "J. D. Salinger: + +J. D. Salinger was an American author. His most notable body of work was The Catcher in the Rye. It was very a influential coming of age story." + +essay_2 = "Truman Capote: + +Truman Capote was an American author. His most notable body of work was In Cold Blood. He was also influential as a screenwriter and playwright." + +essay_3 = "Sinclair Lewis: + +Sinclair Lewis was an American author. His most notable body of work was Main Street. He was influential in his views of American capitalism." -def essay_writer(essay) - title = essay[0] - name = essay[1] - novel = essay[2] - thesis = essay[3] - template = "#{title}: #{name} was an American author. His most notable body of work was #{novel}. #{thesis}." +def essay_writer(title, name, novel, thesis, pronoun) - return template + if pronoun == "male" + pronoun = "His" + else + pronoun = "Her" + end + + return "#{title}:\n\n#{name} was an American author. #{pronoun} most notable body of work was #{novel}. #{thesis}." + end -novelist_1 = ["J. D. Salinger", "J. D. Salinger", "The Catcher in the Rye", "It was very a influential coming of age story"] +awesome_essay = (["J. D. Salinger", "J. D. Salinger", "The Catcher in the Rye", "It was very a influential coming of age story", "male"]) -puts essay_writer(novelist_1) == essay_1 +p essay_writer(*awesome_essay) == essay_1 + + + + + + + + + +
Add initial solution for bonus challenge
diff --git a/config/deploy/production.rb b/config/deploy/production.rb index abc1234..def5678 100644 --- a/config/deploy/production.rb +++ b/config/deploy/production.rb @@ -5,6 +5,8 @@ server ENV['SIDEKIQ_SERVER_2'], user: ENV['SIDEKIQ_USER'], roles: %w{app worker} server ENV['SIDEKIQ_SERVER_3'], user: ENV['SIDEKIQ_USER'], roles: %w{app worker} server ENV['SIDEKIQ_SERVER_4'], user: ENV['SIDEKIQ_USER'], roles: %w{app worker} +server ENV['SIDEKIQ_SERVER_5'], user: ENV['SIDEKIQ_USER'], roles: %w{app worker} +server ENV['SIDEKIQ_SERVER_6'], user: ENV['SIDEKIQ_USER'], roles: %w{app worker} namespace :deploy do task :restart do
Add two more sidekiq machines
diff --git a/Library/Contributions/examples/brew-bottle.rb b/Library/Contributions/examples/brew-bottle.rb index abc1234..def5678 100644 --- a/Library/Contributions/examples/brew-bottle.rb +++ b/Library/Contributions/examples/brew-bottle.rb @@ -1,5 +1,7 @@ # Builds binary brew package -brew_install +require 'cmd/install' + +Homebrew.install_formulae ARGV.formulae destination = HOMEBREW_PREFIX + "Bottles" if not File.directory?(destination)
Fix brew bottle to work with refactor branch.
diff --git a/lib/dropdown.rb b/lib/dropdown.rb index abc1234..def5678 100644 --- a/lib/dropdown.rb +++ b/lib/dropdown.rb @@ -1,3 +1,3 @@-require 'dropdown/processor' -require 'dropdown/output_store' -require 'dropdown/markdown_renderer' +require_relative 'dropdown/processor' +require_relative 'dropdown/output_store' +require_relative 'dropdown/markdown_renderer'
Change the require to require relative
diff --git a/meme_captain.gemspec b/meme_captain.gemspec index abc1234..def5678 100644 --- a/meme_captain.gemspec +++ b/meme_captain.gemspec @@ -18,7 +18,7 @@ s.add_dependency 'rmagick' s.add_development_dependency 'rake' - s.add_development_dependency 'rspec' + s.add_development_dependency 'rspec', '~> 3.2.0' s.add_development_dependency 'webmock' s.files = `git ls-files`.split("\n")
Change rspec version requirement in gemspec.
diff --git a/files/lib/chef_compat/monkeypatches/chef.rb b/files/lib/chef_compat/monkeypatches/chef.rb index abc1234..def5678 100644 --- a/files/lib/chef_compat/monkeypatches/chef.rb +++ b/files/lib/chef_compat/monkeypatches/chef.rb @@ -1,3 +1,11 @@+require 'chef/chef_class' + class Chef NOT_PASSED = Object.new if !defined?(NOT_PASSED) + # Earlier versions of Chef didn't have this message + if !respond_to?(:log_deprecation) + def self.log_deprecation(message) + Chef::Log.warn(message) + end + end end
Add log_deprecation on platforms that don't have it
diff --git a/examples/rango/config.ru b/examples/rango/config.ru index abc1234..def5678 100644 --- a/examples/rango/config.ru +++ b/examples/rango/config.ru @@ -3,5 +3,19 @@ require_relative "init" +require "rango/gv" +require "pupu/helpers" + +Rango::Router.use(:usher) + +# register helpers +Rango::GV::View.send(:include, Pupu::Helpers) + +Project.router = Usher::Interface.for(:rack) do + get("/").to(Rango::GV.static {"index"}) + get("/examples/:template").to(Rango::GV.static { |template| "examples/#{template}" }) +end + +# rack stack use Rango::Middlewares::Basic run Project.router
Use generic views so we don't have to implement any controllers
diff --git a/lib/has_face.rb b/lib/has_face.rb index abc1234..def5678 100644 --- a/lib/has_face.rb +++ b/lib/has_face.rb @@ -16,6 +16,10 @@ delegate config, "#{config}=", :to => HasFace::Configuration end + def configure + yield self + end + end end
Configure block should work correctly now.
diff --git a/lib/dm-validations/contextual_validators.rb b/lib/dm-validations/contextual_validators.rb index abc1234..def5678 100644 --- a/lib/dm-validations/contextual_validators.rb +++ b/lib/dm-validations/contextual_validators.rb @@ -43,7 +43,8 @@ contexts.clear end - # Execute all validators in the named context against the target + # Execute all validators in the named context against the target. Load + # together any properties that are designated lazy but are not yet loaded. # # @param [Symbol] # named_context the context we are validating against @@ -54,9 +55,13 @@ def execute(named_context, target) target.errors.clear! - context(named_context).map do |validator| - validator.execute?(target) ? validator.call(target) : true - end.all? + validators = context(named_context).select { |validator| validator.execute?(target) } + + # Load all lazy, not-yet-loaded, needs-to-be-validated properties. + need_to_load = validators.map{ |v| target.class.properties[v.field_name] }.select { |p| p.lazy? && !p.loaded?(target) } + target.__send__(:eager_load, need_to_load) + + validators.map { |validator| validator.call(target) }.all? end end # module ContextualValidators
Load together all properties that are lazy-designated but not yet loaded. This solves the problem that the presence of dm-validations causes any lazy-designated but not-yet-loaded properties to be loaded individually, one at a time, before an update/save. Also limits what gets loaded to only properties that would have validations applied to them.
diff --git a/lib/generators/templates/rails_footnotes.rb b/lib/generators/templates/rails_footnotes.rb index abc1234..def5678 100644 --- a/lib/generators/templates/rails_footnotes.rb +++ b/lib/generators/templates/rails_footnotes.rb @@ -1,5 +1,5 @@-if defined?(Footnotes) && Rails.env.development? - Footnotes.run! # first of all - - # ... other init code +if Rails.env.development? + Footnotes.setup do |f| + f.enabled = true + end end
Change initializer template to support new loading method
diff --git a/CUtil.podspec b/CUtil.podspec index abc1234..def5678 100644 --- a/CUtil.podspec +++ b/CUtil.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "CUtil" - s.version = "1.0.2" + s.version = "1.1.0" s.summary = "CUtil is a common utilities collection. It is designed as a tool-box for iOS development." s.author = { "Acttos" => "acttosma@gmail.com", "Jason" => "majinshou@gmail.com" } s.social_media_url = "https://twitter.com/hulu0319"
Update the version to 1.1.0 in podspec.
diff --git a/Casks/ubar.rb b/Casks/ubar.rb index abc1234..def5678 100644 --- a/Casks/ubar.rb +++ b/Casks/ubar.rb @@ -1,6 +1,6 @@ cask :v1 => 'ubar' do - version '2.5.0' - sha256 '0b5388a7bd599d48836e08b9138acc0c802aa86e65d6128f66e03a734eb2a823' + version '3.0.3' + sha256 '6e3d650aa0560e7f71c4e4b68f1fd175c1c76a9611fc7f2def7d0fe53ba383fc' url "http://www.brawersoftware.com/downloads/ubar/ubar#{version.delete('.')}.zip" appcast "http://brawersoftware.com/appcasts/feeds/ubar/ubar#{version.to_i}.xml",
Update uBar to version 3.0.3
diff --git a/Casks/lastpass-universal.rb b/Casks/lastpass-universal.rb index abc1234..def5678 100644 --- a/Casks/lastpass-universal.rb +++ b/Casks/lastpass-universal.rb @@ -1,7 +1,6 @@ class LastpassUniversal < Cask url 'https://lastpass.com/lpmacosx.dmg' homepage 'https://lastpass.com/' - version '2.5.0' - sha1 '0efa71f9b5efb9b4bed2574025eb9c0bedc1eada' + version 'latest' install 'lpmacosx.pkg' end
Remove version number and SHA Change to 'latest'
diff --git a/observer/employee.rb b/observer/employee.rb index abc1234..def5678 100644 --- a/observer/employee.rb +++ b/observer/employee.rb @@ -1,28 +1,18 @@+require 'observer' + class Employee + include Observable + attr_reader :name attr_accessor :title, :salary def initialize(name, title, salary) @name, @title, @salary = name, title, salary - @observers = [] end def salary=(new_salary) @salary = new_salary - notify_observers - end - - def notify_observers - @observers.each do |observer| - observer.update self - end - end - - def add_observer(observer) - @observers << observer - end - - def delete_observer(observer) - @observers.delete observer + changed + notify_observers(self) end end
[observer] Use Observable module of standard library
diff --git a/Casks/flux.rb b/Casks/flux.rb index abc1234..def5678 100644 --- a/Casks/flux.rb +++ b/Casks/flux.rb @@ -5,7 +5,7 @@ url 'https://justgetflux.com/mac/Flux.zip' appcast 'https://justgetflux.com/mac/macflux.xml' name 'f.lux' - homepage 'http://justgetflux.com' + homepage 'https://justgetflux.com/' license :gratis app 'Flux.app'
Fix homepage to use SSL in f.lux 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/ruby_event_store-browser/devserver/config.ru b/ruby_event_store-browser/devserver/config.ru index abc1234..def5678 100644 --- a/ruby_event_store-browser/devserver/config.ru +++ b/ruby_event_store-browser/devserver/config.ru @@ -4,7 +4,11 @@ repository = RubyEventStore::InMemoryRepository.new event_store = RubyEventStore::Client.new(repository: repository) +event_store.subscribe_to_all_events(RubyEventStore::LinkByCorrelationId.new(event_store: event_store)) + DummyEvent = Class.new(::RubyEventStore::Event) +OtherEvent = Class.new(::RubyEventStore::Event) + 90.times do event_store.publish(DummyEvent.new( data: { @@ -15,6 +19,31 @@ ), stream_name: "DummyStream$78") end + +some_correlation_id = "469904c5-46ee-43a3-857f-16a455cfe337" +event_store.publish(OtherEvent.new( + data: { + some_integer_attribute: 42, + some_string_attribute: "foobar", + some_float_attribute: 3.14, + }, + metadata: { + correlation_id: some_correlation_id, + }, +), stream_name: "OtherStream$91") +3.times do + event_store.publish(DummyEvent.new( + data: { + some_integer_attribute: 42, + some_string_attribute: "foobar", + some_float_attribute: 3.14, + }, + metadata: { + correlation_id: some_correlation_id, + }, + ), stream_name: "DummyStream$79") +end + run RubyEventStore::Browser::App.for( event_store_locator: -> { event_store }, )
Extend example dev-server to have some correlated events
diff --git a/spec/mutex_based_synchronized_counter_spec.rb b/spec/mutex_based_synchronized_counter_spec.rb index abc1234..def5678 100644 --- a/spec/mutex_based_synchronized_counter_spec.rb +++ b/spec/mutex_based_synchronized_counter_spec.rb @@ -2,22 +2,49 @@ RSpec.describe Gracefully::MutexBasedSynchronizedCounter do subject { + counter.count + } + + let(:counter) { described_class.new(Gracefully::InMemoryCounter.new) } before do @threads = 10.times.map do + Thread.abort_on_exception = true Thread.start do - subject.increment! + counter.increment! end end end specify { - expect(subject.count).to be_between(0, 10) + expect(subject).to be_between(0, 10) + } - @threads.each(&:join) + context 'after all the threads have finished' do + before do + @threads.each(&:join) + end - expect(subject.count).to eq(10) - } + it { is_expected.to eq(10) } + + context 'and then reset' do + before do + @thread = Thread.start do + counter.reset! + end + end + + it { is_expected.to eq(10).or eq(0) } + + context 'eventually' do + before do + @thread.join + end + + it { is_expected.to eq(0) } + end + end + end end
Cover more examples for MutexBasedSynchronizedCounter
diff --git a/union_station_hooks_core.gemspec b/union_station_hooks_core.gemspec index abc1234..def5678 100644 --- a/union_station_hooks_core.gemspec +++ b/union_station_hooks_core.gemspec @@ -12,6 +12,7 @@ s.files = Dir[ "README.md", "LICENSE.md", + "*.gemspec", "lib/**/*" ] s.homepage = "https://github.com/phusion/union_station_hooks_core"
Add .gemspec to gem so that the ':path' option in Gemfile works
diff --git a/db/migrate/20160107202325_make_custom_css_unlimited_length.rb b/db/migrate/20160107202325_make_custom_css_unlimited_length.rb index abc1234..def5678 100644 --- a/db/migrate/20160107202325_make_custom_css_unlimited_length.rb +++ b/db/migrate/20160107202325_make_custom_css_unlimited_length.rb @@ -0,0 +1,11 @@+class MakeCustomCssUnlimitedLength < ActiveRecord::Migration + def up + change_column :questionnaires, :custom_html, :text + change_column :questionnaires, :custom_css, :text + end + + def down + change_column :questionnaires, :custom_html, :string, default: "" + change_column :questionnaires, :custom_css, :string, default: "" + end +end
Remove length limitations on custom content
diff --git a/Casks/bleep.rb b/Casks/bleep.rb index abc1234..def5678 100644 --- a/Casks/bleep.rb +++ b/Casks/bleep.rb @@ -5,8 +5,16 @@ # utorrent.com is the official download host per the vendor homepage url 'https://download-new.utorrent.com/endpoint/bleep/os/osx/track/stable/' name 'Bleep' - homepage 'http://labs.bittorrent.com/bleep/' + homepage 'http://www.bleep.pm/' license :gratis + tags :vendor => 'BitTorrent' app 'Bleep.app' + + zap :delete => [ + '~/Library/Application Support/Bleep', + '~/Library/Caches/com.bittorrent.bleep.osx', + '~/Library/Preferences/com.bittorrent.bleep.osx.plist', + '~/Library/Saved Application State/com.bittorrent.bleep.osx.savedState', + ] end
Update Bleep.app homepage, add vendor and zap ~/Library files
diff --git a/app/controllers/message_threads_controller.rb b/app/controllers/message_threads_controller.rb index abc1234..def5678 100644 --- a/app/controllers/message_threads_controller.rb +++ b/app/controllers/message_threads_controller.rb @@ -5,22 +5,6 @@ def index @threads = MessageThread.public.order("updated_at desc").page(params[:page]) - end - - def new - @thread = MessageThread.new - @message = @thread.messages.build - end - - def create - @thread = MessageThread.new(params[:thread].merge(created_by: current_user)) - @message = @thread.messages.build(params[:message].merge(created_by: current_user)) - - if @thread.save - redirect_to action: :show, id: @thread - else - render :new - end end def show
Remove the controller methods for creating bare message threads
diff --git a/app/demo_data/fake_access_result_generator.rb b/app/demo_data/fake_access_result_generator.rb index abc1234..def5678 100644 --- a/app/demo_data/fake_access_result_generator.rb +++ b/app/demo_data/fake_access_result_generator.rb @@ -15,7 +15,7 @@ date_taken: DateTime.new(@dates.pop, 5, 15), scale_score: rand(300..400), performance_level: rand(10), - growth_percentile: rand(100), + growth_percentile: 1+rand(99), student_id: @student.id } end
Fix invalid fake data generator, revealed by new validation
diff --git a/elocal_api_support.gemspec b/elocal_api_support.gemspec index abc1234..def5678 100644 --- a/elocal_api_support.gemspec +++ b/elocal_api_support.gemspec @@ -21,6 +21,7 @@ spec.add_dependency 'activesupport', '>= 4.0.0' spec.add_dependency 'actionpack', '>= 4.0.0' spec.add_dependency 'activerecord', '>= 4.0.0' + spec.add_dependency 'kaminari' spec.add_development_dependency "bundler", "~> 1.3" spec.add_development_dependency "rake" end
Add kaminari dependency for now
diff --git a/rspec-puppet.gemspec b/rspec-puppet.gemspec index abc1234..def5678 100644 --- a/rspec-puppet.gemspec +++ b/rspec-puppet.gemspec @@ -11,7 +11,6 @@ s.files = Dir['CHANGELOG.md', 'LICENSE.md', 'README.md', 'lib/**/*', 'bin/**/*'] s.add_dependency 'rspec' - s.add_dependency 'rspec-expectations', '< 3.8.5' s.authors = ['Tim Sharpe'] s.email = 'tim@sharpe.id.au'
Remove the temporary rspec-expectations pin
diff --git a/event_store-messaging.gemspec b/event_store-messaging.gemspec index abc1234..def5678 100644 --- a/event_store-messaging.gemspec +++ b/event_store-messaging.gemspec @@ -2,7 +2,7 @@ Gem::Specification.new do |s| s.name = 'event_store-messaging' s.summary = 'Messaging primitives for EventStore using the EventStore Client HTTP library' - s.version = '0.2.0.3' + s.version = '0.3.0.0' s.authors = [''] s.require_paths = ['lib'] s.files = Dir.glob('{lib}/**/*')
Package version is increased from 0.2.0.3 to 0.3.0.0
diff --git a/examples/offset-profile.rb b/examples/offset-profile.rb index abc1234..def5678 100644 --- a/examples/offset-profile.rb +++ b/examples/offset-profile.rb @@ -0,0 +1,27 @@+require '../src/excel_to_code' +require 'ruby-prof' + +profile = RubyProf.profile do + this_directory = File.dirname(__FILE__) + command = ExcelToC.new + command.excel_file = File.join(this_directory, 'offsets.xlsx') + command.output_directory = this_directory + command.output_name = 'offsets' + # Handy command: + # cut -f 2 electricity-build-rate-constraint/intermediate/Named\ references\ 000 | pbcopy + command.named_references_to_keep = :all + command.named_references_that_can_be_set_at_runtime = :where_possible + command.cells_that_can_be_set_at_runtime = :named_references_only + command.actually_compile_code = true + command.actually_run_tests = true + command.run_in_memory = true + command.go! +end + +printer = RubyProf::GraphHtmlPrinter.new(profile) +File.open('profile.html', 'w') do |f| + printer.print(f) +end + +`open profile.html` +
Add an example of profiling a translation
diff --git a/examples/sinatra/config.ru b/examples/sinatra/config.ru index abc1234..def5678 100644 --- a/examples/sinatra/config.ru +++ b/examples/sinatra/config.ru @@ -6,7 +6,7 @@ s.main = 'application' } -map '/__opal_source_maps__' do +map opal.source_maps.prefix do run opal.source_maps end @@ -15,14 +15,14 @@ end get '/' do - <<-EOS + <<-HTML <!doctype html> <html> <head> <script src="/assets/application.js"></script> </head> </html> - EOS + HTML end run Sinatra::Application
Update sinatra example app to use SM prefix
diff --git a/spec/unit/memoizable/module_methods/unmemoized_instance_method_spec.rb b/spec/unit/memoizable/module_methods/unmemoized_instance_method_spec.rb index abc1234..def5678 100644 --- a/spec/unit/memoizable/module_methods/unmemoized_instance_method_spec.rb +++ b/spec/unit/memoizable/module_methods/unmemoized_instance_method_spec.rb @@ -9,9 +9,14 @@ Class.new do include Memoizable - def foo; end + def initialize + @foo = 0 + end - alias_method :original_foo, :foo + def foo + @foo += 1 + end + memoize :foo end end @@ -20,11 +25,9 @@ let(:name) { :foo } it 'returns the original method' do - should eql(object.instance_method(:original_foo)) - end - - it 'is different from the memoized method' do - should_not eql(object.instance_method(:foo)) + # original method is not memoized + method = subject.bind(object.new) + expect(method.call).to_not be(method.call) end end
Fix spec to work with ruby 1.8
diff --git a/spec/helpers/fileutils.rb b/spec/helpers/fileutils.rb index abc1234..def5678 100644 --- a/spec/helpers/fileutils.rb +++ b/spec/helpers/fileutils.rb @@ -2,7 +2,7 @@ # Shamelessly poached from homebrew def mktemp(opts={}) - tmp_prefix = ENV['HOMEBREW_TEMP'] || '/tmp' + tmp_prefix = ENV['TWAT_TEMP'] || Dir.pwd tmp=Pathname.new `/usr/bin/mktemp -d #{tmp_prefix}/twat_spec-XXXX`.strip raise "Couldn't create build sandbox" if not tmp.directory? or $? != 0 begin
Make temp directories off current dir for travis
diff --git a/spec/mailers/previews/user_mailer_preview.rb b/spec/mailers/previews/user_mailer_preview.rb index abc1234..def5678 100644 --- a/spec/mailers/previews/user_mailer_preview.rb +++ b/spec/mailers/previews/user_mailer_preview.rb @@ -3,4 +3,13 @@ def agency_setup_reminder_preview UserMailer.agency_setup_reminder(PartnerAgency.last) end + + def user_trip_email + UserMailer.user_trip_email(User.find(2), Trip.find(70)) + end + + def ecolane_trip_email + UserMailer.ecolane_trip_email('wjiang@camsys.com', Booking.limit(5)) + end + end
Add Email Preview for trip confirmation emails
diff --git a/spec/classes/mod/jk_spec.rb b/spec/classes/mod/jk_spec.rb index abc1234..def5678 100644 --- a/spec/classes/mod/jk_spec.rb +++ b/spec/classes/mod/jk_spec.rb @@ -9,8 +9,8 @@ it { is_expected.to contain_apache__mod('jk') } it { is_expected.to contain_file('jk.conf').that_notifies('Class[apache::service]').with( :ensure => file, - :content => /<IfModule jk_module>/), - :content => /<\/IfModule>/), - } + :content => /<IfModule jk_module>/, + :content => /<\/IfModule>/, + )} end
Correct typo in spec test for apache::mod::jk
diff --git a/ruby/subscription-card-update.rb b/ruby/subscription-card-update.rb index abc1234..def5678 100644 --- a/ruby/subscription-card-update.rb +++ b/ruby/subscription-card-update.rb @@ -1,5 +1,5 @@ -gem 'chargify_api_ares', '=1.3.5' +gem 'chargify_api_ares', '=1.4.3' require 'chargify_api_ares' Chargify.configure do |c| @@ -7,11 +7,10 @@ c.api_key = ENV['CHARGIFY_API_KEY'] end -sub = Chargify::Subscription.find 9970657 +sub = Chargify::Subscription.find 11335477 -sub.credit_card_attributes = {:full_number => "3", :expiration_year => "2020"} +sub.credit_card_attributes = {:full_number => "4242424242424242", :expiration_year => "2020"} sub.save puts sub.inspect -
Update to latest gem and good sub id
diff --git a/spec/models/section_spec.rb b/spec/models/section_spec.rb index abc1234..def5678 100644 --- a/spec/models/section_spec.rb +++ b/spec/models/section_spec.rb @@ -1,13 +1,15 @@ require 'rails_helper' describe Section do - let(:attrs) { FactoryGirl.attributes_for(:section) } - let(:course) { double("course") } - subject(:section) { Section.new(attrs) } - before do - allow(course).to receive("id"){ 1 } - subject.course_id = course.id - end + let(:course) { double("Course", :id => 1) } + + subject(:section) { Section.new( + :title => "test section", + :title_url => "testsection.url.com", + :description => "some test description", + :position => 2, + :course_id => course.id + )} it { is_expected.to respond_to(:title) } it { is_expected.to respond_to(:title_url) } @@ -15,17 +17,15 @@ it { is_expected.to respond_to(:position) } it { is_expected.to respond_to(:course_id) } - # Associations it { is_expected.to respond_to(:course) } it { is_expected.to respond_to(:lessons) } + # Associations + it { is_expected.to belong_to(:course) } + it { is_expected.to have_many(:lessons) } + + # Validations + it { is_expected.to validate_uniqueness_of(:position).with_message('Section position has already been taken') } it { is_expected.to be_valid } - it "shouldn't allow duplicate positions" do - s2 = Section.new(attrs) - s2.course_id = course.id - s2.save - expect(subject).not_to be_valid - end - end
Refactor sections model spec file Addresses Issue #263 Added tests for model validations and associations. Removed test for duplicate positions and FactoryGirl variables. I extracted the methods in the before action and moved them to their respectively model's initialization, thus removing the need for the before action altogether. Add respond_to checks for :course and :lessons back into spec
diff --git a/spec/models/student_spec.rb b/spec/models/student_spec.rb index abc1234..def5678 100644 --- a/spec/models/student_spec.rb +++ b/spec/models/student_spec.rb @@ -13,4 +13,12 @@ it { should have_many(:school_performaces) } it { should have_many(:incidents) } end + + describe '#show_name' do + subject(:student){ FactoryGirl.create(:student) } + it 'shows id and name' do + output = student.id.to_s + ' - ' + student.name + expect(student.show_name).to eq(output) + end + end end
Add tests for student model
diff --git a/process_host.gemspec b/process_host.gemspec index abc1234..def5678 100644 --- a/process_host.gemspec +++ b/process_host.gemspec @@ -1,6 +1,6 @@ Gem::Specification.new do |s| s.name = 'process_host' - s.version = '0.3.0' + s.version = '0.0.3.1' s.summary = 'Run multiple logical processes inside a single physical process.' s.description = 'Turns your ruby program into a long running process that your init system can manage.'
Package version is increased from 0.3.0 to 0.0.3.1
diff --git a/app/controllers/api/v1/reports_controller.rb b/app/controllers/api/v1/reports_controller.rb index abc1234..def5678 100644 --- a/app/controllers/api/v1/reports_controller.rb +++ b/app/controllers/api/v1/reports_controller.rb @@ -12,7 +12,7 @@ render json: API::V1::Report.new(offering, request.protocol, request.host_with_port).to_json end - # POST api/v1/reports/:id + # PUT api/v1/reports/:id def update offering = Portal::Offering.find(params[:id]) # authorize offering, :api_report?
Fix comment in report controller [#114840697]
diff --git a/app/controllers/facebooked/api_controller.rb b/app/controllers/facebooked/api_controller.rb index abc1234..def5678 100644 --- a/app/controllers/facebooked/api_controller.rb +++ b/app/controllers/facebooked/api_controller.rb @@ -9,7 +9,7 @@ return render :inline => '[]' unless response['data'] albums = response['data'].collect do |album| - if album['privacy'] == 'everyone' && album['count'] + if album['privacy'] == 'everyone' && album['count'] > 0 && album['photos'] && album['photos']['data'] && album['photos']['data'][0] { :id => album['id'], :name => album['name'],
Return an empty array when user has not facebook albums.
diff --git a/reagan.rb b/reagan.rb index abc1234..def5678 100644 --- a/reagan.rb +++ b/reagan.rb @@ -27,8 +27,12 @@ pretty_print('The following cookbooks were changed') cookbooks.each { |cb| puts cb } +results = [] cookbooks.each do |cookbook| pretty_print("Testing cookbook #{cookbook}") - ReaganTestVersion.new(cookbook).test - ReaganTestKnife.new(cookbook).test + results << ReaganTestVersion.new(cookbook).test + results << ReaganTestKnife.new(cookbook).test end + +# if any test failed then exit 1 so jenkins can pick up the failure +exit 1 if results.include?(false)
Exit 1 if any of the tests failed so that Jenkins can fail the build
diff --git a/app/controllers/procurement_areas_controller.rb b/app/controllers/procurement_areas_controller.rb index abc1234..def5678 100644 --- a/app/controllers/procurement_areas_controller.rb +++ b/app/controllers/procurement_areas_controller.rb @@ -32,9 +32,9 @@ end def destroy - if procurement_area.destroy - redirect_to procurement_areas_path - end + procurement_area.destroy + + redirect_to procurement_areas_path end private
Remove conditional around destroy action
diff --git a/app/controllers/spree/admin/sisow_controller.rb b/app/controllers/spree/admin/sisow_controller.rb index abc1234..def5678 100644 --- a/app/controllers/spree/admin/sisow_controller.rb +++ b/app/controllers/spree/admin/sisow_controller.rb @@ -5,10 +5,19 @@ end def update - Spree::Config.set(params[:preferences]) - + Spree::Config.set(update_params.to_hash) redirect_to edit_admin_sisow_path, :notice => Spree.t(:sisow_settings_updated) end + + private + + def update_params + params.require(:preferences).permit(:sisow_merchant_id, + :sisow_merchant_key, + :sisow_test_mode, + :sisow_debug_mode) + end + end end -end+end
Use strong params to update the configuration
diff --git a/app/services/gobierto_common/context_service.rb b/app/services/gobierto_common/context_service.rb index abc1234..def5678 100644 --- a/app/services/gobierto_common/context_service.rb +++ b/app/services/gobierto_common/context_service.rb @@ -21,7 +21,7 @@ private def fill_missing_parts(context) - return context if context =~ %r{^gid://gobierto//} + return context if context =~ %r{^gid://gobierto/} missing_part = "gid://" missing_part += "gobierto/" unless context =~ %r{^gobierto/}
Fix prefix expression of global ids
diff --git a/sentry-raven.gemspec b/sentry-raven.gemspec index abc1234..def5678 100644 --- a/sentry-raven.gemspec +++ b/sentry-raven.gemspec @@ -16,7 +16,7 @@ gem.license = 'Apache-2.0' gem.required_ruby_version = '>= 1.9.0' - gem.add_dependency "faraday", ">= 0.7.6" + gem.add_dependency "faraday", ">= 0.7.6", "<= 0.9.x" gem.add_development_dependency "rake" gem.add_development_dependency "rubocop"
Add an upper version bound on Faraday
diff --git a/famfamfam_flags_rails.gemspec b/famfamfam_flags_rails.gemspec index abc1234..def5678 100644 --- a/famfamfam_flags_rails.gemspec +++ b/famfamfam_flags_rails.gemspec @@ -5,15 +5,15 @@ gem.authors = ["Tanguy Krotoff (Flags by Mark James)"] gem.email = ["tkrotoff@gmail.com"] gem.description = %q{FAMFAMFAM flag icons} - gem.summary = %q{FAMFAMFAM flag icons packaged for Rails asset pipeline} + gem.summary = %q{FAMFAMFAM flag icons packaged for Rails 3.1+ asset pipeline} gem.homepage = "http://tkrotoff.github.com/famfamfam_flags/" - gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) } - gem.files = `git ls-files`.split("\n") - gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") + gem.files = `git ls-files`.split($\) + gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) } + gem.test_files = gem.files.grep(%r{^(test|spec|features)/}) gem.name = "famfamfam_flags_rails" gem.require_paths = ["lib"] gem.version = FamfamfamFlagsRails::VERSION - gem.add_dependency "railties", ">= 3.1.0" + gem.add_dependency 'railties', '>= 3.1.0' end
Update gemspec file Using Bundler version 1.1.5
diff --git a/Motif.podspec b/Motif.podspec index abc1234..def5678 100644 --- a/Motif.podspec +++ b/Motif.podspec @@ -8,17 +8,17 @@ s.osx.deployment_target = '10.8' s.ios.deployment_target = '7.0' s.summary = 'A lightweight and customizable JSON stylesheet framework for iOS' - s.homepage = 'https://github.com/erichoracek/Motif' + s.homepage = "https://github.com/erichoracek/#{s.name}" s.author = { 'Eric Horacek' => 'eric@automatic.com' } s.source = { - :git => 'https://github.com/erichoracek/#{s.name}.git', + :git => "https://github.com/erichoracek/#{s.name}.git", :tag => s.version.to_s } s.frameworks = 'Foundation' s.ios.frameworks = 'UIKit' s.source_files = [ - "#{s.name}/Motif.h", + "#{s.name}/#{s.name}.h", "#{s.name}/Core/*.{h,m}", "#{s.name}/Objective-C Runtime/*.{h,m}" ]
Fix podspec source git refernece
diff --git a/gds-sso.rb b/gds-sso.rb index abc1234..def5678 100644 --- a/gds-sso.rb +++ b/gds-sso.rb @@ -1,6 +1,6 @@ GDS::SSO.config do |config| config.user_model = "User" - config.oauth_id = ENV["SPECIALIST_PUBLISHER_OAUTH_ID"] || "not used" - config.oauth_secret = ENV["SPECIALIST_PUBLISHER_OAUTH_SECRET"] || "not used" + config.oauth_id = ENV["OAUTH_ID"] || "not used" + config.oauth_secret = ENV["OAUTH_SECRET"] || "not used" config.oauth_root_url = Plek.current.find("signon") end
Use the correct ENV keys for SSO
diff --git a/mrblib/Siren.rb b/mrblib/Siren.rb index abc1234..def5678 100644 --- a/mrblib/Siren.rb +++ b/mrblib/Siren.rb @@ -4,13 +4,54 @@ # module Siren - { - box: Prim, - copy: Build, - vertex: Build, - line: Build, - infline: Build, + # Prim package + box: Prim, + box2p: Prim, + boxax: Prim, + sphere: Prim, + cylinder: Prim, + cone: Prim, + torus: Prim, + halfspace: Prim, + prism: Prim, + revol: Prim, + revolution: Prim, + wedge: Prim, + # Build package + copy: Build, + vertex: Build, + line: Build, + infline: Build, + polyline: Build, + curve: Build, + wire: Build, + arc: Build, + arc3p: Build, + circle: Build, + circle3p: Build, + plane: Build, + face: Build, + infplane: Build, + polygon: Build, + nurbscurve: Build, + beziersurf: Build, + nurbssurf: Build, + sewing: Build, + solid: Build, + compound: Build, + # BRepIO package + save: BRepIO, + load: BRepIO, + dump: BRepIO, + # Offset package + sweep_vec: Offset, + sweep_path: Offset, + loft: Offset, + offset_geomsurf: Offset, + offset: Offset, + offset_shape: Offset, + pipe: Offset, }.each do |method, package| define_method(method) do |*args| package.send(method, *args) @@ -19,5 +60,5 @@ package.send(method, *args) end end +end -end
Add alias name for methods of Build, Prim, Offset and BRepIO.
diff --git a/guard-coffeescript.gemspec b/guard-coffeescript.gemspec index abc1234..def5678 100644 --- a/guard-coffeescript.gemspec +++ b/guard-coffeescript.gemspec @@ -15,7 +15,7 @@ s.required_rubygems_version = '>= 1.3.6' s.rubyforge_project = 'guard-coffeescript' - s.add_dependency 'guard', '~> 0.2.1' + s.add_dependency 'guard', '~> 0.2.2' s.add_development_dependency 'bundler', '~> 1.0.2' s.add_development_dependency 'rspec', '~> 2.0.1'
Use latest guard for development
diff --git a/spec/engine_settings.rb b/spec/engine_settings.rb index abc1234..def5678 100644 --- a/spec/engine_settings.rb +++ b/spec/engine_settings.rb @@ -0,0 +1,64 @@+# -*- coding: utf-8 -*- + +require 'simplecov' +require 'simplecov-rcov' +require 'logger' +require 'coveralls' + +Coveralls.wear! +SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[ + SimpleCov::Formatter::RcovFormatter, + Coveralls::SimpleCov::Formatter +] +SimpleCov.command_name 'bacon' +SimpleCov.start do + add_filter '/vendor/' + add_filter '/spec/' +end + +require 'digest/sha1' +require_relative '../lib/diversity' + +describe 'Engine::Settings' do + should 'Return a correct list of angulars' do + registry_path = File.expand_path( + File.join(File.dirname(__FILE__), 'components') + ) + registry = Diversity::Registry::Local.new(base_path: registry_path, base_url: 'https://dummy.domain/components') + engine = Diversity::Engine.new(registry: registry) + comp = registry.get_component('weak-sauce') + engine.render(comp) + angular = engine.send(:settings).angular + angular.length.should.equal(1) + angular[0].should.equal('dummy') + end + + should 'Return a correct list of scripts' do + registry_path = File.expand_path( + File.join(File.dirname(__FILE__), 'components') + ) + registry = Diversity::Registry::Local.new(base_path: registry_path, base_url: 'https://dummy.domain/components') + engine = Diversity::Engine.new(registry: registry) + comp = registry.get_component('weak-sauce') + engine.render(comp) + scripts = engine.send(:settings).scripts + scripts.length.should.equal(3) + scripts.uniq.length.should.equal(3) + scripts[0].should.equal('https://dummy.domain/components/dummy/0.0.1/js/dummy1.js') + scripts[1].should.equal('https://dummy.domain/components/dummy/0.0.1/js/dummy2.js') + scripts[2].should.equal('https://dummy.domain/components/weak-sauce/0.0.4/weak_sauce.js') + end + + should 'Return a correct list of styles' do + registry_path = File.expand_path( + File.join(File.dirname(__FILE__), 'components') + ) + registry = Diversity::Registry::Local.new(base_path: registry_path, base_url: 'https://dummy.domain/components') + engine = Diversity::Engine.new(registry: registry) + comp = registry.get_component('weak-sauce') + engine.render(comp) + styles = engine.send(:settings).styles + styles.length.should.equal(1) + styles[0].should.equal('https://dummy.domain/components/dummy/0.0.1/css/dummy.css') + end +end
Add some tests for Engine::Settings
diff --git a/specs/ristretto_spec.rb b/specs/ristretto_spec.rb index abc1234..def5678 100644 --- a/specs/ristretto_spec.rb +++ b/specs/ristretto_spec.rb @@ -6,14 +6,24 @@ let(:indented_codeblocks) { Ristretto.parse('specs/markdown/indented_codeblocks.md') } describe "#execute" do - it "executes parsed ruby code" do + it "executes simple ruby code" do Ristretto.execute(indented_codeblocks).must_equal "Hello, Ristretto!" end + + it "can cope with unbound methods" end describe "#parse" do it "parses markdown indented codeblocks" do indented_codeblocks.must_equal "welcome = \"Hello, Ristretto!\"\n# comments\nwelcome" end + + it "ignores indented lists" + + it "ignores shell commands prefixed with $" + + it "groks tabbed indents" + + it "parses backticked codeblocks" end end
Add more specs to implement
diff --git a/lib/sastrawi/dictionary/array_dictionary.rb b/lib/sastrawi/dictionary/array_dictionary.rb index abc1234..def5678 100644 --- a/lib/sastrawi/dictionary/array_dictionary.rb +++ b/lib/sastrawi/dictionary/array_dictionary.rb @@ -18,7 +18,9 @@ end def add_words(new_words) - @words.concat(new_words) + new_words.each do |word| + add(word) + end end def add(word)
Use defined function to add new words into dictionary
diff --git a/lib/circleci/coverage_reporter/reporters/link.rb b/lib/circleci/coverage_reporter/reporters/link.rb index abc1234..def5678 100644 --- a/lib/circleci/coverage_reporter/reporters/link.rb +++ b/lib/circleci/coverage_reporter/reporters/link.rb @@ -10,25 +10,28 @@ end end - def initialize(options = {}) - @options = options + # @param path [String] + # @param name [String] + def initialize(path:, name:) + @path = path + @name = name end # @note Implementation for {Base#active?} def active? - File.file?(File.join(configuration.artifacts_dir, @options[:path])) + File.file?(File.join(configuration.artifacts_dir, path)) end # @note Override {Base#name} - def name - @options[:name] - end + attr_reader :name def report(_base_build, _previous_build) - LinkReport.new(@options[:name], url) + LinkReport.new(name, url) end private + + attr_reader :path # @return [String] def url @@ -38,7 +41,7 @@ configuration.current_build_number, 'artifacts', "0#{configuration.artifacts_dir}", - @options[:path] + path ].join('/') end
Use keyward arguments to ensure that Link reporter has name and path
diff --git a/pandata.gemspec b/pandata.gemspec index abc1234..def5678 100644 --- a/pandata.gemspec +++ b/pandata.gemspec @@ -7,6 +7,7 @@ s.summary = 'A Pandora web scraper' s.description = 'A library and tool for downloading Pandora data (likes, bookmarks, stations, etc.)' s.homepage = 'https://github.com/ustasb/pandata' + s.license = 'MIT' s.authors = ['Brian Ustas'] s.email = 'brianustas@gmail.com' s.files = Dir["#{gem_path}/lib/**/*.rb"] << "#{gem_path}/bin/pandata"
Add license to gemspec file
diff --git a/shittydb.gemspec b/shittydb.gemspec index abc1234..def5678 100644 --- a/shittydb.gemspec +++ b/shittydb.gemspec @@ -1,6 +1,6 @@ Gem::Specification.new do |spec| spec.name = 'shittydb' - spec.version = '1.0.0' + spec.version = '0.0.0' spec.authors = ['ShittyDB Industries, Ltd.'] spec.email = ['info@shittydb.com'] spec.summary = %q{A confoundingly fast key-value store}
Change gem version to 0.0.0 I fucked up and the gem version is 1.0.0 and it should be 0.0.0 I have brought shame and dishonor to my family.
diff --git a/summon.rb b/summon.rb index abc1234..def5678 100644 --- a/summon.rb +++ b/summon.rb @@ -5,7 +5,7 @@ desc "Tool to make working with secrets easier" homepage "https://github.com/conjurinc/summon" url "https://github.com/conjurinc/summon/releases/download/v#{VERSION}/summon_v#{VERSION}_darwin_amd64.tar.gz" - version "0.3.2" + version VERSION sha256 SHA bottle :unneeded
Set correct version for v0.3.3
diff --git a/lib/delocalize/parameter_delocalizing.rb b/lib/delocalize/parameter_delocalizing.rb index abc1234..def5678 100644 --- a/lib/delocalize/parameter_delocalizing.rb +++ b/lib/delocalize/parameter_delocalizing.rb @@ -22,7 +22,7 @@ end def delocalize_parser_for(options, key_stack) - parser_type = key_stack.reduce(options) { |h, key| h.stringify_keys[key.to_s] } + parser_type = key_stack.reduce(options) { |h, key| h.is_a?(Hash) ? h.stringify_keys[key.to_s] : break } return unless parser_type parser_name = "delocalize_#{parser_type}_parser"
Break if key not in options hash. Fixes clemens/delocalize#71
diff --git a/lib/emailvision4rails/models/campaign.rb b/lib/emailvision4rails/models/campaign.rb index abc1234..def5678 100644 --- a/lib/emailvision4rails/models/campaign.rb +++ b/lib/emailvision4rails/models/campaign.rb @@ -1,6 +1,7 @@ class Emailvision4rails::Campaign < Emailvision4rails::Base attributes( + :id, :name, :mailinglist_id, :message_id, @@ -42,10 +43,14 @@ end end + def post + api.get.campaign.post(uri: [id]).call + end + def create if valid? run_callbacks :create do - api.post.campaign.create(:body => {:campaign => self.to_emv}).call + self.id = api.post.campaign.create(:body => {:campaign => self.to_emv}).call end true else
[Campaign] Store id and add post method
diff --git a/lib/project/progress_hud/progress_hud.rb b/lib/project/progress_hud/progress_hud.rb index abc1234..def5678 100644 --- a/lib/project/progress_hud/progress_hud.rb +++ b/lib/project/progress_hud/progress_hud.rb @@ -6,8 +6,10 @@ class ProgressHUD < Android::App::DialogFragment - def initialize(title="Loading") + def initialize(title="Loading", opts={}) @title = title + @style = convert_style(opts[:style]) + @max = opts[:max] end def show(activity=rmq.activity) @@ -18,12 +20,36 @@ builder = Android::App::AlertDialog::Builder.new(activity, Android::App::AlertDialog::THEME_HOLO_LIGHT) - progress = Android::Widget::ProgressBar.new(activity) - progress.setBackgroundColor(Android::Graphics::Color::TRANSPARENT) - builder.setView(progress) - .setTitle(@title) + if @style + @progress = Android::Widget::ProgressBar.new(activity, nil, @style) + if @max + @progress.setIndeterminate(false) + @progress.setMax(@max) + end + else + @progress = Android::Widget::ProgressBar.new(activity) + end + @progress.setBackgroundColor(Android::Graphics::Color::TRANSPARENT) + builder.setView(@progress) + .setTitle(@title) @created_dialog = builder.create() + end + + def progress=(value) + @progress.setProgress(value) + end + + def increment(inc=1) + runnable = HudRun.new + @current_progress ||= 0 + @current_progress += inc + runnable.progress = @current_progress + runnable.hud = self + + # 99.99% of the time, we will use this from within app.async + # so we need to be sure to run the progress in the UI thread + activity.runOnUiThread(runnable) end def title=(new_title) @@ -35,4 +61,25 @@ end alias_method :close, :hide + protected + def convert_style(style) + return nil if style.nil? + + case style + when :horizontal + Android::R::Attr::ProgressBarStyleHorizontal + else + style + end + end + end + +class HudRun + attr_accessor :hud, :progress + + def run + hud.progress = progress + end + +end
Add a progressbar to ProgressHUD
diff --git a/spec/support/database_cleaner.rb b/spec/support/database_cleaner.rb index abc1234..def5678 100644 --- a/spec/support/database_cleaner.rb +++ b/spec/support/database_cleaner.rb @@ -1,21 +1,18 @@ RSpec.configure do |config| + + # config.use_transactional_fixtures = false + config.before(:suite) do DatabaseCleaner.clean_with(:truncation) end - config.before(:each) do - DatabaseCleaner.strategy = :transaction - end - - config.before(:each, js: true) do - DatabaseCleaner.strategy = :truncation - end - - config.before(:each) do + config.before(:each) do |example| + DatabaseCleaner.strategy = example.metadata[:js] ? :truncation : :transaction DatabaseCleaner.start end config.after(:each) do DatabaseCleaner.clean end -end + +end
Make Guard work with rspec features
diff --git a/spec/features/players/view_spec.rb b/spec/features/players/view_spec.rb index abc1234..def5678 100644 --- a/spec/features/players/view_spec.rb +++ b/spec/features/players/view_spec.rb @@ -0,0 +1,47 @@+require 'spec_helper.rb' + +feature "Viewing a Player", js: true do + let(:p1) {FactoryGirl::create(:player)} + let(:p2) {FactoryGirl::create(:player)} + + scenario "view one Player" do + p1 + p2 + visit "#/players" + click_on "#{p1.name} #{p1.surname}" + tokens = p1.rank.split('_') + + expect(page).to have_content(p1.name) + expect(page).to have_content(p1.surname) + expect(page).to have_content("#{tokens[1]} #{tokens[0].upcase}") + expect(page).to have_content(Club.find_by_id(p1.club_id).name) + end + + scenario "go back from Player to Player index" do + p1 + p2 + visit "#/players" + click_on "#{p1.name} #{p1.surname}" + + click_on "index-player" + + expect(page).to have_content(p1.name) + expect(page).to have_content(p1.surname) + + expect(page).to have_content(p2.name) + expect(page).to have_content(p2.surname) + end + + scenario "go from Player to his Club" do + p1 + club = Club.find_by_id(p1.club_id) + visit "#/players" + click_on "#{p1.name} #{p1.surname}" + + click_on club.name + + expect(page).to have_content(club.name) + expect(page).to have_content(club.city) + expect(page).to have_content(club.description) + end +end
Add feature spec for viewing a single player
diff --git a/spec/helpers/tenant_helper_spec.rb b/spec/helpers/tenant_helper_spec.rb index abc1234..def5678 100644 --- a/spec/helpers/tenant_helper_spec.rb +++ b/spec/helpers/tenant_helper_spec.rb @@ -1,14 +1,16 @@ require "spec_helper" -describe ActsAsTenant::TenantHelper, type: :helper do - describe "#current_tenant" do - it "returns nil if no tenant set" do - expect(helper.current_tenant).to be_nil - end +describe ActionView::Base, type: :helper do + it "responds ot current_tenant" do + expect(helper).to respond_to(:current_tenant) + end - it "returns nil if no tenant set" do - ActsAsTenant.current_tenant = accounts(:foo) - expect(helper.current_tenant).to eq(accounts(:foo)) - end + it "returns nil if no tenant set" do + expect(helper.current_tenant).to be_nil + end + + it "returns the current tenant" do + ActsAsTenant.current_tenant = accounts(:foo) + expect(helper.current_tenant).to eq(accounts(:foo)) end end
Refactor view helper spec to test against ActionView::Base
diff --git a/activesupport/lib/active_support/test_case.rb b/activesupport/lib/active_support/test_case.rb index abc1234..def5678 100644 --- a/activesupport/lib/active_support/test_case.rb +++ b/activesupport/lib/active_support/test_case.rb @@ -8,10 +8,14 @@ require 'minitest/unit' # Hack around the test/unit autorun. - autorun_enabled = MiniTest::Unit.class_variable_get('@@installed_at_exit') - MiniTest::Unit.disable_autorun + autorun_enabled = MiniTest::Unit.send(:class_variable_get, '@@installed_at_exit') + if MiniTest::Unit.respond_to?(:disable_autorun) + MiniTest::Unit.disable_autorun + else + MiniTest::Unit.send(:class_variable_set, '@@installed_at_exit', false) + end require 'test/unit' - MiniTest::Unit.class_variable_set('@@installed_at_exit', autorun_enabled) + MiniTest::Unit.send(:class_variable_set, '@@installed_at_exit', autorun_enabled) class TestCase < ::Test::Unit::TestCase Assertion = MiniTest::Assertion
Fix compatibility with Ruby 1.8 that also has the Miniunit gem installed. Signed-off-by: Jeremy Kemper <b3f594e10a9edcf5413cf1190121d45078c62290@bitsweat.net>
diff --git a/examples/let_it_be_experiment.rb b/examples/let_it_be_experiment.rb index abc1234..def5678 100644 --- a/examples/let_it_be_experiment.rb +++ b/examples/let_it_be_experiment.rb @@ -0,0 +1,11 @@+# frozen_string_literal: true + +require '../../fast/lib/fast' + +# For specs using `let(:something) { create ... }` it tries to use `let_it_be` instead +Fast.experiment('RSpec/LetItBe') do + lookup 'spec/models' + search '(block $(send nil let (sym _)) (args) (send nil create))' + edit { |_, (let)| replace(let.loc.selector, 'let_it_be') } + policy { |new_file| system("bin/spring rspec --fail-fast #{new_file}") } +end.run
Add Let it be experiment
diff --git a/recipes/configure.rb b/recipes/configure.rb index abc1234..def5678 100644 --- a/recipes/configure.rb +++ b/recipes/configure.rb @@ -1,8 +1,6 @@ template node['pulledpork']['disablesid'] do source 'disablesid.conf.erb' - owner 'root' - group 'root' mode '0640' notifies :run, 'execute[run_pulledpork]' not_if { node['pulledpork']['disabled_sids_hash_array'].empty? } @@ -10,16 +8,12 @@ template node['pulledpork']['pp_config_path'] do source 'pulledpork.conf.erb' - owner 'root' - group 'root' mode '0640' notifies :run, 'execute[run_pulledpork]' end # create the sorule_path unless its managed elsewhere directory node['pulledpork']['sorule_path'] do - owner 'root' - group 'root' mode '0755' not_if { ::File.exist?(node['pulledpork']['sorule_path']) } end @@ -28,7 +22,5 @@ cookbook_file '/usr/lib/snort_dynamicrules/os-linux.so' do source 'default_so_rule' action :create_if_missing - owner 'root' - group 'root' mode '0655' end
Remove default user/groups from resources Signed-off-by: Tim Smith <764ef62106582a09ed09dfa0b6bff7c05fd7d1e4@chef.io>
diff --git a/config/routes.rb b/config/routes.rb index abc1234..def5678 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,7 +1,8 @@ Panopticon::Application.routes.draw do resources :artefacts - resources :tags, :defaults => { :format => 'json' } + resources :tags, :defaults => {:format => 'json'} + match 'tags/:id' => 'tags#show', :id => /[^\.]+/, :defaults => {:format => 'json'} match 'google_insight' => 'seo#show'
Allow unescaped slashes in tag IDs.
diff --git a/test/unit/database_test.rb b/test/unit/database_test.rb index abc1234..def5678 100644 --- a/test/unit/database_test.rb +++ b/test/unit/database_test.rb @@ -0,0 +1,19 @@+require 'tmpdir' +require_relative '../../lib/yomou/database' + +class DatabaseTest < Test::Unit::TestCase + setup do + end + + sub_test_case "directory" do + def test_db_file + Dir.mktmpdir do |dir| + ENV['YOMOU_HOME'] = File.join(dir, '.yomou') + database = Yomou::Database.new + database.init + path = File.join(ENV['YOMOU_HOME'], 'db/yomou.db') + assert_equal(true, File.exist?(path)) + end + end + end +end
Add database init test case
diff --git a/app/controllers/broggle/broggles_controller.rb b/app/controllers/broggle/broggles_controller.rb index abc1234..def5678 100644 --- a/app/controllers/broggle/broggles_controller.rb +++ b/app/controllers/broggle/broggles_controller.rb @@ -20,7 +20,7 @@ end def deploy - broggle.deploy(params['select-base']) + broggle.deploy(params[:branches]) redirect_to action: "index" end
Change param names for searching
diff --git a/app/controllers/learning_objects_controller.rb b/app/controllers/learning_objects_controller.rb index abc1234..def5678 100644 --- a/app/controllers/learning_objects_controller.rb +++ b/app/controllers/learning_objects_controller.rb @@ -1,6 +1,6 @@ class LearningObjectsController < ApplicationController before_action :authenticate_user! - before_action :find_learning_object, only: [:show, :edit, :update] + before_action :find_learning_object, only: [:show, :edit, :update, :destroy] def index @learning_objects = LearningObject.where(user: current_user) @@ -36,6 +36,9 @@ end def destroy + @learning_object.destroy + flash[:success] = "Objeto de Aprendizagem deletado!" + redirect_to learning_objects_url end private
Add learning object delete feature
diff --git a/app/presenters/drug_safety_update_presenter.rb b/app/presenters/drug_safety_update_presenter.rb index abc1234..def5678 100644 --- a/app/presenters/drug_safety_update_presenter.rb +++ b/app/presenters/drug_safety_update_presenter.rb @@ -1,6 +1,7 @@ class DrugSafetyUpdatePresenter < DocumentPresenter delegate( :therapeutic_area, + :published_date, to: :"document.details" ) @@ -18,4 +19,10 @@ therapeutic_area: therapeutic_area, } end + + def extra_date_metadata + { + "Published date" => published_date, + } + end end
Add published_at date to visible metadata for DSU documents
diff --git a/app/services/asset_manager/attachment_updater/replacement_id_updates.rb b/app/services/asset_manager/attachment_updater/replacement_id_updates.rb index abc1234..def5678 100644 --- a/app/services/asset_manager/attachment_updater/replacement_id_updates.rb +++ b/app/services/asset_manager/attachment_updater/replacement_id_updates.rb @@ -5,20 +5,27 @@ replacement = attachment_data.replaced_by Enumerator.new do |enum| - enum.yield AssetManager::AttachmentUpdater::Update.new( - attachment_data, attachment_data.file, replacement_legacy_url_path: replacement.file.asset_manager_path + enum.yield( + AssetManager::AttachmentUpdater::Update.new( + attachment_data, + attachment_data.file, + replacement_legacy_url_path: replacement.file.asset_manager_path, + ), ) if attachment_data.pdf? - if replacement.pdf? - enum.yield AssetManager::AttachmentUpdater::Update.new( - attachment_data, attachment_data.file.thumbnail, replacement_legacy_url_path: replacement.file.thumbnail.asset_manager_path - ) - else - enum.yield AssetManager::AttachmentUpdater::Update.new( - attachment_data, attachment_data.file.thumbnail, replacement_legacy_url_path: replacement.file.asset_manager_path - ) - end + replacement_legacy_url_path = if replacement.pdf? + replacement.file.thumbnail.asset_manager_path + else + replacement.file.asset_manager_path + end + enum.yield( + AssetManager::AttachmentUpdater::Update.new( + attachment_data, + attachment_data.file.thumbnail, + replacement_legacy_url_path: replacement_legacy_url_path, + ), + ) end end end
Refactor the ReplacementIdUpdates class for readability Format to avoid the lines which were too long. Also reduce the code duplication by using a variable.
diff --git a/lib/expando/api_ai/system_entity_examples.rb b/lib/expando/api_ai/system_entity_examples.rb index abc1234..def5678 100644 --- a/lib/expando/api_ai/system_entity_examples.rb +++ b/lib/expando/api_ai/system_entity_examples.rb @@ -54,6 +54,12 @@ 'sys.any' => [ 'anything', 'this is many words' + ], + 'sys.time-period' => [ + 'morning', + 'in the afternoon', + 'evening', + 'at night' ] } end
Add time-period to system entity examples
diff --git a/app/controllers/user_preference_controller.rb b/app/controllers/user_preference_controller.rb index abc1234..def5678 100644 --- a/app/controllers/user_preference_controller.rb +++ b/app/controllers/user_preference_controller.rb @@ -32,7 +32,7 @@ pref = UserPreference.new unless keyhash[pt['k']].nil? # already have that key - render :text => 'OH NOES! CAN HAS UNIQUE KEYS?', :status => 406 + render :text => 'OH NOES! CAN HAS UNIQUE KEYS?', :status => :not_acceptable return end @@ -45,7 +45,7 @@ end if prefs.size > 150 - render :text => 'Too many preferences', :status => 413 + render :text => 'Too many preferences', :status => :request_entity_too_large return end @@ -58,7 +58,7 @@ end rescue Exception => ex - render :text => 'OH NOES! FAIL!: ' + ex.to_s, :status => 500 + render :text => 'OH NOES! FAIL!: ' + ex.to_s, :status => :internal_server_error return end
Use named constants for HTTP response codes.
diff --git a/academic_benchmarks.gemspec b/academic_benchmarks.gemspec index abc1234..def5678 100644 --- a/academic_benchmarks.gemspec +++ b/academic_benchmarks.gemspec @@ -1,7 +1,7 @@ Gem::Specification.new do |s| s.name = 'academic_benchmarks' - s.version = '0.0.2' - s.date = '2015-12-07' + s.version = '0.0.3' + s.date = '2015-12-18' s.summary = "A ruby api for accessing the Academic Benchmarks API" s.description = "A ruby api for accessing the Academic Benchmarks API. " \ "A valid subscription with accompanying credentials " \
Bump gem version to 0.0.3 Test Plan: - None Change-Id: I290e263abee8c990a9393852b2e0bfc96071b144
diff --git a/lib/akashi/ec2/key_pair.rb b/lib/akashi/ec2/key_pair.rb index abc1234..def5678 100644 --- a/lib/akashi/ec2/key_pair.rb +++ b/lib/akashi/ec2/key_pair.rb @@ -6,7 +6,7 @@ def_delegators :@object, :fingerprint, :name class << self - def create(public_key) + def create(public_key:) response = Akashi::Aws.ec2.client.import_key_pair( key_name: Akashi.name, public_key_material: Base64.encode64(public_key)
Change arguments of Akashi::Ec2::KeyPair.create to keyword arguments
diff --git a/lib/celluloid/responses.rb b/lib/celluloid/responses.rb index abc1234..def5678 100644 --- a/lib/celluloid/responses.rb +++ b/lib/celluloid/responses.rb @@ -17,7 +17,7 @@ if super.is_a? AbortError # Aborts are caused by caller error, so ensure they capture the # caller's backtrace instead of the receiver's - raise super.cause.exception(super.cause.message) + raise super.cause.exception else raise super end
[CS] Remove useless exception message duplication
diff --git a/lib/presentation/window.rb b/lib/presentation/window.rb index abc1234..def5678 100644 --- a/lib/presentation/window.rb +++ b/lib/presentation/window.rb @@ -13,12 +13,14 @@ @slide_deck.next_slide when Gosu::KbLeft @slide_deck.previous_slide + else + # @slide_deck.current_slide.button_down end end def update - @slide_deck.current_slide.scroll_up if button_down? Gosu::KbUp - @slide_deck.current_slide.scroll_down if button_down? Gosu::KbDown + @slide_deck.current_slide.scroll_up if button_down? Gosu::KbDown + @slide_deck.current_slide.scroll_down if button_down? Gosu::KbUp end def draw
Change behavior of up/down keys to be more intuitive.
diff --git a/lib/psd/image_modes/rgb.rb b/lib/psd/image_modes/rgb.rb index abc1234..def5678 100644 --- a/lib/psd/image_modes/rgb.rb +++ b/lib/psd/image_modes/rgb.rb @@ -5,10 +5,9 @@ def combine_rgb8_channel @num_pixels.times do |i| - index = 0 pixel = {r: 0, g: 0, b: 0, a: 255} - PSD::Image::CHANNEL_INFO.each do |chan| + PSD::Image::CHANNEL_INFO.each_with_index do |chan, index| case chan[:id] when -1 next if channels != 4 @@ -17,14 +16,9 @@ when 1 then pixel[:g] = @channel_data[i + (@channel_length * index)] when 2 then pixel[:b] = @channel_data[i + (@channel_length * index)] end - - index += 1 end - @pixel_data << pixel[:r] - @pixel_data << pixel[:g] - @pixel_data << pixel[:b] - @pixel_data << pixel[:a] + @pixel_data.push *pixel.values end end
Clean up RGB8 processing a little
diff --git a/APIModel.podspec b/APIModel.podspec index abc1234..def5678 100644 --- a/APIModel.podspec +++ b/APIModel.podspec @@ -18,7 +18,7 @@ s.source_files = "Source/**/*" s.requires_arc = true - s.dependency "Alamofire", "~> 1.2" + s.dependency "Alamofire", "~> 2.0" s.dependency "SwiftyJSON", "~> 2.2.1" s.dependency "RealmSwift", "~> 0.95.0" end
Update Podspec dependency for Alamfire
diff --git a/app/models/book_category.rb b/app/models/book_category.rb index abc1234..def5678 100644 --- a/app/models/book_category.rb +++ b/app/models/book_category.rb @@ -3,6 +3,6 @@ belongs_to :book belongs_to :category - validates: :book_id, :category_id, presence: :true + validates :book_id, :category_id, presence: :true end
Fix syntax error in validations
diff --git a/spec/version_spec.rb b/spec/version_spec.rb index abc1234..def5678 100644 --- a/spec/version_spec.rb +++ b/spec/version_spec.rb @@ -0,0 +1,7 @@+require 'spec_helper' + +describe "#{Github::Status} VERSION" do + it "should be version 0.0.1" do + Github::VERSION.should == "0.0.1" + end +end
Add spec to ensure the gem version number always is updated before pushing a release to rubygems.
diff --git a/tasks/media.rake b/tasks/media.rake index abc1234..def5678 100644 --- a/tasks/media.rake +++ b/tasks/media.rake @@ -0,0 +1,40 @@+target_dir = "target/tyrian-assets" + +task 'unzip_tyrian_assets' do + download_task = download("downloads/tyrian-graphics.zip" => "http://lostgarden.com/Remastered%20Tyrian%20Graphics.zip") + + unzip(target_dir => download_task.name).from_path('Remastered Tyrian Graphics') + file(File.expand_path(target_dir)).invoke +end + +Image = Struct.new("Image", :key, :filename, :x1, :y1, :x2, :y2) + +images = [] + +def extract_horizontal_sequence(images, file, key, count, stride, inset, initial_x, initial_y, width, height) + (0...count).each do |offset| + x1 = initial_x + (stride * offset) + inset + x2 = x1 + width + y1 = initial_y + y2 = y1 + height + images << Image.new("#{key}_#{offset}", file, x1, y1, x2, y2) + end +end + +extract_horizontal_sequence(images, "newsh2.shp.000000.png", "u_fighter", 8, 24, 4, 0, 141, 16, 20) + +desc "Setup assets" +task "assets" + +images.each do |image| + filename = File.expand_path("assets/images/#{image.key}#{File.extname(image.filename)}") + source_image = File.expand_path("#{target_dir}/#{image.filename}") + file(source_image => %w(unzip_tyrian_assets)) + file(filename => [source_image]) do + mkdir_p File.dirname(filename) + rm_rf filename + command = "convert -transparent '#bfdcbf' -extract #{image.x2 - image.x1}x#{image.y2 - image.y1}+#{image.x1}+#{image.y1} #{source_image} #{filename}" + sh command + end + task("assets").enhance [filename] +end
Add in start of rake tasks to extract the appropriate assets
diff --git a/lib/typus/configuration.rb b/lib/typus/configuration.rb index abc1234..def5678 100644 --- a/lib/typus/configuration.rb +++ b/lib/typus/configuration.rb @@ -10,20 +10,19 @@ # Typus::Configuration.options[:app_name] = "Your App Name" # Typus::Configuration.options[:per_page] = 15 # - @@options = { - :app_logo => '', - :app_logo_height => '', - :app_logo_width => '', - :app_name => 'Typus Admin', - :app_description => '', - :per_page => 15, - :prefix => 'admin', - :color => '#000', - :version => '', - :signature => '', - :form_rows => '10', - :form_columns => '10' - } + @@options = { :app_logo => '', + :app_logo_height => '', + :app_logo_width => '', + :app_name => 'Typus Admin', + :app_description => '', + :per_page => 15, + :prefix => 'admin', + :color => '#000', + :version => '', + :signature => '', + :form_rows => '10', + :form_columns => '10' } + mattr_reader :options ## @@ -31,11 +30,14 @@ case ENV['RAILS_ENV'] when 'test' config_file = "#{File.dirname(__FILE__)}/../../test/typus.yml" + @@config = YAML.load_file(config_file) else config_file = "#{RAILS_ROOT}/config/typus.yml" + @@config = YAML.load_file(config_file) + Dir['vendor/plugins/*/config/typus.yml'].each do |plugin| + @@config = @@config.merge(YAML.load_file("#{RAILS_ROOT}/#{plugin}")) + end end - - @@config = YAML.load_file(config_file) mattr_reader :config
Load typus.yml on plugins ...
diff --git a/core/enumerator/arithmetic_sequence/new_spec.rb b/core/enumerator/arithmetic_sequence/new_spec.rb index abc1234..def5678 100644 --- a/core/enumerator/arithmetic_sequence/new_spec.rb +++ b/core/enumerator/arithmetic_sequence/new_spec.rb @@ -1,7 +1,7 @@ require_relative '../../../spec_helper' ruby_version_is "2.6" do - describe "Enumerator::ArithmeticSequence#new" do + describe "Enumerator::ArithmeticSequence.new" do it "is not defined" do lambda { Enumerator::ArithmeticSequence.new @@ -9,7 +9,7 @@ end end - describe "Enumerator::ArithmeticSequence#allocate" do + describe "Enumerator::ArithmeticSequence.allocate" do it "is not defined" do lambda { Enumerator::ArithmeticSequence.allocate
Fix a couple small typos
diff --git a/lib/feed2email/database.rb b/lib/feed2email/database.rb index abc1234..def5678 100644 --- a/lib/feed2email/database.rb +++ b/lib/feed2email/database.rb @@ -1,4 +1,3 @@-require 'fileutils' require 'sequel' module Feed2Email
Remove leftover require of FileUtils
diff --git a/lib/interest/definition.rb b/lib/interest/definition.rb index abc1234..def5678 100644 --- a/lib/interest/definition.rb +++ b/lib/interest/definition.rb @@ -19,7 +19,7 @@ __send__ name end - define_method :respond_to_missing? do |name, include_private = true| + define_method :respond_to_missing? do |name, include_private = false| !! (super(name, include_private) or /\A#{target}_.+\Z/ =~ name.to_s) end end
Change default argument value for respond_to_missing?
diff --git a/docks.gemspec b/docks.gemspec index abc1234..def5678 100644 --- a/docks.gemspec +++ b/docks.gemspec @@ -27,7 +27,7 @@ s.add_dependency 'sass', '~> 3.3' s.add_development_dependency 'bundler', '~> 1.3' - s.add_development_dependency 'rake' + s.add_development_dependency 'rake', '~> 10.4' s.add_development_dependency 'rspec', '~> 2.14' s.add_development_dependency 'awesome_print', '~> 1.6' end
Add version dep for rake
diff --git a/lib/jekyll/amp_generate.rb b/lib/jekyll/amp_generate.rb index abc1234..def5678 100644 --- a/lib/jekyll/amp_generate.rb +++ b/lib/jekyll/amp_generate.rb @@ -17,6 +17,9 @@ # Remove non needed keys from data # Excerpt will cause an error if kept self.data.delete('excerpt') + # Generating the page fails silently if page has a permalink and it is copied + # over to the AMP version + self.data.delete('permalink') self.data['canonical_url'] = post.url end
Fix generating posts with permalinks
diff --git a/db/post_migrate/20190301081611_migrate_project_migrate_sidekiq_queue.rb b/db/post_migrate/20190301081611_migrate_project_migrate_sidekiq_queue.rb index abc1234..def5678 100644 --- a/db/post_migrate/20190301081611_migrate_project_migrate_sidekiq_queue.rb +++ b/db/post_migrate/20190301081611_migrate_project_migrate_sidekiq_queue.rb @@ -2,8 +2,6 @@ class MigrateProjectMigrateSidekiqQueue < ActiveRecord::Migration[5.0] include Gitlab::Database::MigrationHelpers - - DOWNTIME = false DOWNTIME = false
Remove duplicate definition of DOWNTIME This silences the warning: 20190301081611_migrate_project_migrate_sidekiq_queue.rb:8: warning: already initialized constant MigrateProjectMigrateSidekiqQueue::DOWNTIME
diff --git a/lib/message_queue/rails.rb b/lib/message_queue/rails.rb index abc1234..def5678 100644 --- a/lib/message_queue/rails.rb +++ b/lib/message_queue/rails.rb @@ -2,7 +2,7 @@ def self.hook_rails! config_file = ::Rails.root.join("config", "message_queue.yml") config = if config_file.exist? - YAML.load_file(config_file) + YAML.load_file(config_file)[::Rails.env] else { :adapter => :memory, :serializer => :json } end
Fix bug in loading settings for Rails env
diff --git a/spec/pptx/smoke/api_bullet_spec.rb b/spec/pptx/smoke/api_bullet_spec.rb index abc1234..def5678 100644 --- a/spec/pptx/smoke/api_bullet_spec.rb +++ b/spec/pptx/smoke/api_bullet_spec.rb @@ -2,6 +2,7 @@ describe 'ApiBullet section tests' do it 'ApiBullet | GetClassType method' do pptx = DocBuilderWrapper.new.build_doc_and_parse('asserts/js/pptx/smoke/api_bullet/get_class_type.js') - expect(pptx).to be_with_data + expect(pptx.slides.first.elements.first.text_body.paragraphs.first.properties.numbering.symbol).to eq('-') + expect(pptx.slides[0].elements.first.text_body.paragraphs.last.characters.first.text).to eq('Class Type = bullet') end end
Add bullet tests for presentation.
diff --git a/spec/tic_tac_toe/view/game_spec.rb b/spec/tic_tac_toe/view/game_spec.rb index abc1234..def5678 100644 --- a/spec/tic_tac_toe/view/game_spec.rb +++ b/spec/tic_tac_toe/view/game_spec.rb @@ -8,4 +8,12 @@ expect(gv.render).to be_a(String).and start_with('<!DOCTYPE html>').and end_with("</html>\n") end + it 'returns the correct value for the current mark image' do + g = TicTacToe::Game.new_game(TicTacToe::Board.empty_board) + gv = TicTacToe::View::Game.new(g) + expect(gv.current_mark).to eq("ex") + g.move(index: 0) + expect(gv.current_mark).to eq("oh") + end + end
Add a view test for current_mark
diff --git a/lib/rodent/test_helpers.rb b/lib/rodent/test_helpers.rb index abc1234..def5678 100644 --- a/lib/rodent/test_helpers.rb +++ b/lib/rodent/test_helpers.rb @@ -1,8 +1,10 @@+require 'multi_json' + module Rodent module Test module Helpers def request(path, *args) - @rodent_response = api.route(path).call(*args) + @rodent_response = MultiJson.load(api.route(path).call(*args)) end def response
Convert response to json in test helper
diff --git a/lib/rom/memory/relation.rb b/lib/rom/memory/relation.rb index abc1234..def5678 100644 --- a/lib/rom/memory/relation.rb +++ b/lib/rom/memory/relation.rb @@ -3,7 +3,7 @@ # Relation subclass for memory adapter # # @example - # class Users < ROM::Relation[:memory + # class Users < ROM::Relation[:memory] # end # # @public
Add missing `]` to class doc of Memory::Relation [ci skip]
diff --git a/lib/tasks/smoke_tests.rake b/lib/tasks/smoke_tests.rake index abc1234..def5678 100644 --- a/lib/tasks/smoke_tests.rake +++ b/lib/tasks/smoke_tests.rake @@ -4,7 +4,5 @@ desc "Run the smoke tests" RSpec::Core::RakeTask.new(:smoke) do |t| t.pattern = "spec/smoke/**/*.rb" - response = `curl --silent -I http://localhost:3000` - raise "Make sure rails is running locally before running webdriver tests" unless response.match "200 OK" end end
Revert "added check for local rails server before running webdriver tests" This reverts commit 130601a6ffb31c0aba06da63544049f0fa315547.
diff --git a/components/plugins/sidebars/xml_controller.rb b/components/plugins/sidebars/xml_controller.rb index abc1234..def5678 100644 --- a/components/plugins/sidebars/xml_controller.rb +++ b/components/plugins/sidebars/xml_controller.rb @@ -7,5 +7,5 @@ setting :trackbacks, false, :input_type => :checkbox setting :format, 'rss20', :input_type => :radio, - :choices => [["rss20", "RSS 2.0"], ["atom10", "Atom 1.0"], ["atom03", "Atom 0.3"]] + :choices => [["rss20", "RSS 2.0"], ["atom10", "Atom 1.0"]] end
Remove Atom 0.3 from the XML sidebar, because we don't support it anymore git-svn-id: 70ab0960c3db1cbf656efd6df54a8f3de72dc710@1118 820eb932-12ee-0310-9ca8-eeb645f39767
diff --git a/lib/cellular/models/sms.rb b/lib/cellular/models/sms.rb index abc1234..def5678 100644 --- a/lib/cellular/models/sms.rb +++ b/lib/cellular/models/sms.rb @@ -1,7 +1,7 @@ module Cellular class SMS - attr_accessor :recipient, :sender, :mesage, :price, :country + attr_accessor :recipient, :sender, :message, :price, :country def initialize(options = {}) @backend = Cellular.config.backend
Fix typo in SMS attr_accessor
diff --git a/ruby/roman.rb b/ruby/roman.rb index abc1234..def5678 100644 --- a/ruby/roman.rb +++ b/ruby/roman.rb @@ -0,0 +1,29 @@+#!/bin/env ruby + +# Demonstrate the use of `method_missing' to create a flexible API +class Roman + def self.method_missing name, *args + roman = name.to_s + .gsub("IV", "IIII") + .gsub("IX", "VIIII") + .gsub("XL", "XXXX") + .gsub("XC", "LXXXX") + + {"I" => 1, + "V" => 5, + "X" => 10, + "L" => 50, + "C" => 100} + .map {|letter, value| roman.count(letter) * value} + .inject(:+) + end +end + +puts Roman.X +# => 10 +puts Roman.XC +# => 90 +puts Roman.XII +# => 12 +puts Roman.XCVIIVIIIIIVVIIVVIC +# => 224
Add a possible use of 'method_missing'
diff --git a/lib/em-c2dm/redis_store.rb b/lib/em-c2dm/redis_store.rb index abc1234..def5678 100644 --- a/lib/em-c2dm/redis_store.rb +++ b/lib/em-c2dm/redis_store.rb @@ -1,7 +1,7 @@ module EventMachine module C2DM class RedisStore - KEY = "em-c2dm:auth_token" + KEY = "em-c2dm:token" def initialize(redis) @redis = if redis.is_a?(String) || redis.nil?
Use uniform language for token
diff --git a/lib/frontend_generators.rb b/lib/frontend_generators.rb index abc1234..def5678 100644 --- a/lib/frontend_generators.rb +++ b/lib/frontend_generators.rb @@ -4,7 +4,11 @@ class Bootstrap def run - + FileUtils.cp(bootstrap_css, css_destination) + end + + def css_destination + File.join(Rails.root, "vendor", "stylesheets", "bootstrap.css") end def bootstrap_css
Add a method to copy the boostrap.css file into the Rails application
diff --git a/test/shopify_app/webhooks_controller_test.rb b/test/shopify_app/webhooks_controller_test.rb index abc1234..def5678 100644 --- a/test/shopify_app/webhooks_controller_test.rb +++ b/test/shopify_app/webhooks_controller_test.rb @@ -22,7 +22,7 @@ test "#carts_update should verify request" do with_application_test_routes do data = {foo: :bar}.to_json - @controller.expects(:validate_hmac).with('secret', data.to_s).returns(true) + @controller.expects(:hmac_valid?).with(data.to_s).returns(true) post :carts_update, data assert_response :ok end @@ -31,7 +31,7 @@ test "un-verified request returns unauthorized" do with_application_test_routes do data = {foo: :bar}.to_json - @controller.expects(:validate_hmac).with('secret', data.to_s).returns(false) + @controller.expects(:hmac_valid?).with(data.to_s).returns(false) post :carts_update, data assert_response :unauthorized end
Update tests for webhook controller