diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/app/representers/api/promise_representer.rb b/app/representers/api/promise_representer.rb index abc1234..def5678 100644 --- a/app/representers/api/promise_representer.rb +++ b/app/representers/api/promise_representer.rb @@ -14,6 +14,7 @@ represented.parties.map do |p| { title: p.name, + slug: p.slug, href: api_party_url(p) } end
Add slug to party links
diff --git a/lib/modulr.rb b/lib/modulr.rb index abc1234..def5678 100644 --- a/lib/modulr.rb +++ b/lib/modulr.rb @@ -12,6 +12,8 @@ require 'modulr/collector' require 'modulr/global_export_collector' require 'modulr/minifier' + require 'modulr/dependency_graph' + require 'open-uri' require 'modulr/version' PATH_TO_MODULR_JS = File.join(LIB_DIR, '..', 'assets', 'modulr.js') @@ -27,6 +29,18 @@ minify(collector.to_js, options[:minify]) end + def self.graph(file, options = {}) + dir = File.dirname(file) + mod_name = File.basename(file, '.js') + mod = JSModule.new(mod_name, dir, file) + uri = DependencyGraph.new(mod).to_yuml + output = options[:dependency_graph] + if output == true + output = "#{dir}/#{mod_name}.png" + end + File.open(output, 'w').write(open(uri).read) + end + protected def self.minify(output, options) if options
Add a Modulr.graph class method which creates and saves a dependency graph of the specified module.
diff --git a/lib/yard/generators/helpers/method_helper.rb b/lib/yard/generators/helpers/method_helper.rb index abc1234..def5678 100644 --- a/lib/yard/generators/helpers/method_helper.rb +++ b/lib/yard/generators/helpers/method_helper.rb @@ -2,10 +2,11 @@ module Generators::Helpers module MethodHelper def format_args(object) - if object.signature - h object.signature[/#{Regexp.quote object.name.to_s}\s*(.*)/, 1] + unless object.parameters.empty? + args = object.parameters.map {|n, v| v ? "#{n} = #{v}" : n.to_s }.join(", ") + h("(#{args})") else - h "def #{object.name}" + "" end end
Update format_args to use object.parameters instead of object.signature parsing
diff --git a/lib/rulers.rb b/lib/rulers.rb index abc1234..def5678 100644 --- a/lib/rulers.rb +++ b/lib/rulers.rb @@ -1,2 +1,11 @@ module Rulers + class Application + def call(env) + [ + 200, + {'Content-Type' => 'text/html'}, + ['Hello from your favorite framework!'] + ] + end + end end
Add most basic rack app
diff --git a/dump_serengeti_talk.rb b/dump_serengeti_talk.rb index abc1234..def5678 100644 --- a/dump_serengeti_talk.rb +++ b/dump_serengeti_talk.rb @@ -0,0 +1,26 @@+#!/usr/bin/env ruby + +require 'bundler/setup' +require 'mongo' +require 'csv' + +db = Mongo::Client.new('mongodb://localhost:27017/talk') + +CSV.open("talk.csv", 'wb', headers: [:discussion_id, :comment_id, :subject_id, :user_id, :body, :timestamp]) do |csv| + db['discussions'].find(project_id: BSON::ObjectId("5077375154558fabd7000001")).each do |discussion| + print '.' + + discussion["comments"].each do |comment| + next if comment["body"].nil? + + csv << { + discussion_id: discussion["_id"], + comment_id: comment["_id"], + subject_id: discussion["focus"]["_id"], + user_id: comment["user_id"], + body: comment["body"], + timestamp: comment["created_at"] + } + end + end +end
Add script to dump talk to csv
diff --git a/tidy-html5.gemspec b/tidy-html5.gemspec index abc1234..def5678 100644 --- a/tidy-html5.gemspec +++ b/tidy-html5.gemspec @@ -10,4 +10,5 @@ s.homepage = 'https://github.com/moneyadviceservice/tidy-html5-gem' s.extensions = ['ext/extconf.rb'] s.executables = ['tidy'] + s.add_development_dependency 'rake' end
Add Rake to development dependencies
diff --git a/bosh-monitor/spec/support/buffered_logger.rb b/bosh-monitor/spec/support/buffered_logger.rb index abc1234..def5678 100644 --- a/bosh-monitor/spec/support/buffered_logger.rb +++ b/bosh-monitor/spec/support/buffered_logger.rb @@ -1,6 +1,5 @@ require 'rspec' require 'logger' -require 'mono_logger' require 'logging' module BufferedLogger @@ -20,7 +19,6 @@ c.before do @test_log_buffer = StringIO.new @test_logger = Logging.logger(@test_log_buffer) - allow(MonoLogger).to receive(:new).and_return(@test_logger) allow(Logging).to receive(:logger).and_return(@test_logger) allow(Logger).to receive(:new).and_return(@test_logger) end
Switch bosh-monitor to use Logging instead of MonoLogger [#81611698] Signed-off-by: Karl Isenberg <ad8fead3baba6d58cb6c266b80834d1b78f48a29@pivotal.io>
diff --git a/lib/cucumber/formatter/console_counts.rb b/lib/cucumber/formatter/console_counts.rb index abc1234..def5678 100644 --- a/lib/cucumber/formatter/console_counts.rb +++ b/lib/cucumber/formatter/console_counts.rb @@ -6,43 +6,30 @@ include Console def initialize(config) - @test_case_summary = Core::Test::Result::Summary.new - @test_step_summary = Core::Test::Result::Summary.new - - config.on_event :test_case_finished do |event| - event.result.describe_to @test_case_summary - end - - config.on_event :test_step_finished do |event| - event.result.describe_to @test_step_summary if from_gherkin?(event.test_step) - end + @summary = Core::Report::Summary.new(config.event_bus) end def to_s [ - [scenario_count, status_counts(@test_case_summary)].compact.join(' '), - [step_count, status_counts(@test_step_summary)].compact.join(' ') + [scenario_count, status_counts(@summary.test_cases)].compact.join(' '), + [step_count, status_counts(@summary.test_steps)].compact.join(' ') ].join("\n") end private - def from_gherkin?(test_step) - test_step.source.last.location.file.match(/\.feature$/) - end - def scenario_count - count = @test_case_summary.total + count = @summary.test_cases.total "#{count} scenario" + (count == 1 ? '' : 's') end def step_count - count = @test_step_summary.total + count = @summary.test_steps.total "#{count} step" + (count == 1 ? '' : 's') end def status_counts(summary) - counts = [:failed, :skipped, :undefined, :pending, :passed].map { |status| + counts = Core::Test::Result::TYPES.map { |status| count = summary.total(status) [status, count] }.select { |status, count|
Reduce duplication between ConsoleCounts and Cucumber-Ruby-Core Use the Cucumber::Core::Test::Result::TYPES and Cucumber::Core::Report::Summary to reduce the duplication between ConsoleCounts and Cucumber-Ruby-Core.
diff --git a/lib/formalist/element/class_interface.rb b/lib/formalist/element/class_interface.rb index abc1234..def5678 100644 --- a/lib/formalist/element/class_interface.rb +++ b/lib/formalist/element/class_interface.rb @@ -6,11 +6,14 @@ def attribute(name, type) attributes(name => type) end - # TODO: add attr_reader methods for each attribute here def attributes(new_schema) prev_schema = schema || {} @schema = prev_schema.merge(new_schema) + + attr_reader *(new_schema.keys - prev_schema.keys) + + self end def schema
Add attr_readers for form element attributes
diff --git a/lib/typing_hero/server/client_handler.rb b/lib/typing_hero/server/client_handler.rb index abc1234..def5678 100644 --- a/lib/typing_hero/server/client_handler.rb +++ b/lib/typing_hero/server/client_handler.rb @@ -23,25 +23,19 @@ end def send_world(words, players) - world = build_world(words, players).to_json - @socket.puts(world) + world = build_world(words, players) + puts(world) end def inform_about_correct_word(word) - @socket.puts( - { + puts( :type => "word_correct", :word => word.content - }.to_json ) end def inform_about_incorrect_word - @socket.puts( - { - :type => "word_incorrect" - }.to_json - ) + puts(:type => "word_incorrect") end def build_world(words, players) @@ -64,6 +58,10 @@ } end + def puts(message) + @socket.puts(message.to_json) + end + end end end
Move puts to common method
diff --git a/test/factories/teaching_period_factory.rb b/test/factories/teaching_period_factory.rb index abc1234..def5678 100644 --- a/test/factories/teaching_period_factory.rb +++ b/test/factories/teaching_period_factory.rb @@ -6,5 +6,10 @@ year { start_date.year } end_date { start_date + 14.weeks } active_until { end_date + rand(1..2).weeks } + end + factory :breaks do + start_date {start_date.Time.zone.now} + number_of_weeks {number_of_weeks.rand(1..3)} + end end
TEST: Add breaks to teaching period factory
diff --git a/test/models/travel_advice_edition_test.rb b/test/models/travel_advice_edition_test.rb index abc1234..def5678 100644 --- a/test/models/travel_advice_edition_test.rb +++ b/test/models/travel_advice_edition_test.rb @@ -2,7 +2,9 @@ class TravelAdviceEditionTest < ActiveSupport::TestCase setup do - @ta = TravelAdviceEdition.new(:country_slug => "narnia") + @ta = FactoryGirl.create(:travel_advice_edition, + :country_slug => "narnia", + :state => "draft") end test "country slug must be present" do @@ -12,7 +14,6 @@ end test "country slug must be unique for state" do - @ta.save! another_edition = FactoryGirl.create(:travel_advice_edition, :country_slug => "liliputt", :state => "draft") @@ -24,7 +25,7 @@ end test "a new travel advice edition is a draft" do - assert @ta.draft? + assert TravelAdviceEdition.new.draft? end test "publishing a draft travel advice edition" do
Use travel advice edition factory
diff --git a/definitions/ppa.rb b/definitions/ppa.rb index abc1234..def5678 100644 --- a/definitions/ppa.rb +++ b/definitions/ppa.rb @@ -10,7 +10,6 @@ ppa = params[:name] user, archive = ppa.split('/') key_id = params[:key_id] - distribution = params[:distribution] || node[:lsb][:codename] unless key_id # use the Launchpad API to get the correct archive signing key id @@ -23,9 +22,9 @@ end # let the apt_repo definition do the heavy lifting - apt_repo "#{user}-#{archive}-#{distribution}" do + apt_repo "#{user}_#{archive}.ppa" do key_id key_id - distribution distribution + distribution params[:distribution] keyserver "keyserver.ubuntu.com" url "http://ppa.launchpad.net/#{ppa}/ubuntu" end
Use better filename for PPA apt sources
diff --git a/utils/generator.rb b/utils/generator.rb index abc1234..def5678 100644 --- a/utils/generator.rb +++ b/utils/generator.rb @@ -24,7 +24,18 @@ next if choice.include? ' ' next if choice == '' - keywords << choice + # in some DOCUMENTATION sections choice might be double + # quoted, which does not get interpreted by Ruby's YAML, but + # is common in python. In the final generated list these + # double quotes break elisp. + if choice.start_with? '["' and choice.end_with? '"]' + choice.gsub(/\A\[|]\Z/, '').split(',').each do |choice_quote| + keywords << choice_quote.gsub(/\A"|"\Z/, '') + end + else + # normally, add directly + keywords << choice + end end end end
Allow for double quoted DOCUMENTATION choices In github_issue.py in the ansible modules they have an options section in the documentation that is a double quoted array. This looks like: company-ansible/utils/repos/stable-2.4/lib/ansible/modules/source_control/github_issue.py ["get_status"] After, this ends up being poorly quoted in the resulting in the keywords file having a poorly formed string in the list. the elisp ... "Yearly" "["get_status"]" "[NO]BYPASSRLS" "[NO]CREATEDB"
diff --git a/lib/twitch.rb b/lib/twitch.rb index abc1234..def5678 100644 --- a/lib/twitch.rb +++ b/lib/twitch.rb @@ -4,6 +4,11 @@ module User def self.find_by_oauth_token(oauth_token) HTTParty.get(uri(oauth_token: oauth_token)).parsed_response + end + + def self.uri(query) URI.parse('https://api.twitch.tv/kraken/user').tap do |uri| + uri.query = query.to_query + end end end @@ -18,12 +23,4 @@ end end end - - private - - def self.uri(query) - URI.parse('https://api.twitch.tv/kraken/user').tap do |uri| - uri.query = query.to_query - end - end end
Fix a broken `uri` call
diff --git a/lib/armor_payments/api/accounts.rb b/lib/armor_payments/api/accounts.rb index abc1234..def5678 100644 --- a/lib/armor_payments/api/accounts.rb +++ b/lib/armor_payments/api/accounts.rb @@ -2,7 +2,7 @@ class Accounts < Resource def create data - headers = authenticator.secure_headers 'get', uri + headers = authenticator.secure_headers 'post', uri request :post, { path: uri, headers: headers, body: JSON.generate(data) } end
Fix request method type for account creation.
diff --git a/lib/metriks/reporter/proc_title.rb b/lib/metriks/reporter/proc_title.rb index abc1234..def5678 100644 --- a/lib/metriks/reporter/proc_title.rb +++ b/lib/metriks/reporter/proc_title.rb @@ -46,7 +46,9 @@ val = block.call val = "%.#{@rounding}f" % val if val.is_a?(Float) - if suffix + if suffix == '%' + "#{name}: #{val}#{suffix}" + elsif suffix "#{name}: #{val}/#{suffix}" else "#{name}: #{val}"
Fix display if proc title suffix is %
diff --git a/lib/gitlab/ci/pipeline/expression/statement.rb b/lib/gitlab/ci/pipeline/expression/statement.rb index abc1234..def5678 100644 --- a/lib/gitlab/ci/pipeline/expression/statement.rb +++ b/lib/gitlab/ci/pipeline/expression/statement.rb @@ -31,8 +31,8 @@ end ## - # Our syntax is very simple, so we don't need yet to implement a - # recurisive parser, we can use the most simple approach to create + # Our syntax is very simple, so we don't yet need to implement a + # recursive parser, we can use the most simple approach to create # a reverse descent parse tree "by hand". # def parse_tree @@ -42,7 +42,7 @@ raise ParserError, 'Unknown pipeline expression!' end - if lexemes.many? + if tokens.many? Expression::Equals.new(tokens.first.build, tokens.last.build) else tokens.first.build @@ -50,6 +50,11 @@ end def evaluate + if tokens.many? + parse_tree.evaluate + else + parse_tree.evaluate.present? + end end end end
Add code that evaluates pipelines expressions
diff --git a/connect_four.rb b/connect_four.rb index abc1234..def5678 100644 --- a/connect_four.rb +++ b/connect_four.rb @@ -1,17 +1,38 @@ class Board + attr_reader :board def initialize(board_size, win_size) @board_size = board_size @win_size = win_size + @board = [] end def create_cells - + y_position = 1 + @board_size.times do + x_position = "A" + row = [] + @board_size.times do + row << Cell.new(x_position, y_position) + x_position = x_position.next + end + @board << row + y_position += 1 + end end end class Cell + attr_accessor :x_position, :y_position def initialize(x_position, y_position) @x_position = x_position @y_position = y_position end -end+end + +board = Board.new(7, 4) +board.create_cells +board.board.each do |row| + p row + puts +end +
Add create-cells method to board
diff --git a/lib/pansophy/remote/create_file.rb b/lib/pansophy/remote/create_file.rb index abc1234..def5678 100644 --- a/lib/pansophy/remote/create_file.rb +++ b/lib/pansophy/remote/create_file.rb @@ -29,8 +29,8 @@ def call(options = {}) prevent_overwrite! unless options[:overwrite] - params = options.slice(*ALLOWED_ATTRS).merge(key: @pathname.to_s, body: @body.dup) - directory.files.create(params) + file_attributes = options.delete_if { |k,v| !ALLOWED_ATTRS.include?(k) } + directory.files.create(file_attributes.merge(key: @pathname.to_s, body: @body.dup)) end private
Remove use of Rails slice method
diff --git a/spec/absorb_spec.rb b/spec/absorb_spec.rb index abc1234..def5678 100644 --- a/spec/absorb_spec.rb +++ b/spec/absorb_spec.rb @@ -1,18 +1,4 @@ require_relative 'spec_helper' describe Absorb do - - ['test.txt', 'test2.txt'].each do |file| - - describe "file" do - - it "should store #{file} in s3" do - Absorb::AmazonS3.expects(:store_file).with file - Absorb.file file - end - - end - - end - end
Remove failing tests, will bring them back in a bit.
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 @@ -37,7 +37,6 @@ c.cassette_library_dir = 'spec/cassettes' c.hook_into :webmock # or :fakeweb c.configure_rspec_metadata! - c.filter_sensitive_data('<SA_MEMBER_ID>') { ENV["SERMONAUDIO_MEMBER_ID"] } c.filter_sensitive_data('<SA_PASSWORD>') { ENV["SERMONAUDIO_PASSWORD"] } end
Fix Travis specs and protect data I'm using the same church as an example for data in specs and in the README.md. Needed to stop filtering the SA MemberID from the recorded SOAP request cassettes.
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,7 +1,9 @@ require 'activemerchant-bpoint' require 'support/gateway_helpers' - RSpec.configure do |config| config.include GatewayHelpers end + +GATEWAY_LOGIN = '' +GATEWAY_PASSWORD = ''
Add blank gateway login details to the spec helper.
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 @@ -4,4 +4,5 @@ require 'winnow' RSpec.configure do |config| + config.color_enabled = true end
Add color to RSpec tests.
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 @@ -12,4 +12,11 @@ # the seed, which is printed after each run. # --seed 1234 config.order = 'random' + + # Remove defined constants + config.before :each do + if Object.const_defined?(:Car) + Object.send(:remove_const, :Car) + end + end end
Change to clean each unit test.
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 @@ -8,3 +8,11 @@ ::Dir.glob(::File.expand_path('../support/*.rb', __FILE__)).each { |f| require_relative f } ::Dir.glob(::File.expand_path('../support/**/*.rb', __FILE__)).each { |f| require_relative f } end + +RSpec.configure do |c| + c.filter_run focus: true + c.run_all_when_everything_filtered = true + unless system('which brew > /dev/null') + c.filter_run_excluding integration: true + end +end
Exclude integration test when `brew` command not found
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 @@ -31,11 +31,11 @@ class Mapper def load(tuple) - tuple + Hash[tuple.header.map { |attribute| [attribute.name, tuple[attribute]] }] end def dump(object) - object.to_h + object end end
Add all RA ops to ROM::Relation
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 @@ require 'chefspec' require 'chefspec/berkshelf' +require 'rspec/expectations' at_exit { ChefSpec::Coverage.report! }
Fix for 'uninitialized constant RSpec::Matchers::BuiltIn::RaiseError::MatchAliases (NameError)'
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,5 +1,11 @@+require 'simplecov' require 'coveralls' -Coveralls.wear! + +SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[ + SimpleCov::Formatter::HTMLFormatter, + Coveralls::SimpleCov::Formatter +] +SimpleCov.start require 'pry' require 'whos_dated_who'
Use HTML Simplecov formatter as well
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 @@ -53,3 +53,10 @@ key :id end end + +TEST_ENV.mapping do + users do + model mock_model(:id, :name) + map :id, :name + end +end
Establish mapping for testing and simplify spec
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,13 +3,16 @@ require File.dirname(__FILE__) + '/../lib/github' -module GitHub - load 'helpers.rb' - load 'commands.rb' -end - # prevent the use of `` in tests Spec::Runner.configure do |configuration| + # load this here so it's covered by the `` guard + configuration.prepend_before(:all) do + module GitHub + load 'helpers.rb' + load 'commands.rb' + end + end + backtick = nil # establish the variable in this scope configuration.prepend_before(:all) do # raise an exception if the `` operator is used
Load helpers.rb and commands.rb inside the `` guard
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 @@ -8,4 +8,5 @@ RSpec.configure do |config| config.include Warden::Test::Helpers + config.order = "random" end
Make sure tests are randomized
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -6,6 +6,8 @@ RSpec.configure do |c| c.module_path = File.join(fixture_path, 'modules') c.manifest_dir = File.join(fixture_path, 'manifests') + c.parser = 'future' if Puppet.version.to_f >= 4.0 + c.environmentpath = File.expand_path(File.join(Dir.pwd, 'spec')) if Puppet.version.to_f >= 4.0 end at_exit { RSpec::Puppet::Coverage.report! }
Enable future parser in serverspec
diff --git a/spec/winnow_spec.rb b/spec/winnow_spec.rb index abc1234..def5678 100644 --- a/spec/winnow_spec.rb +++ b/spec/winnow_spec.rb @@ -20,7 +20,7 @@ it 'hashes strings to get keys' do # if t = k = 1, then each character will become a fingerprint fprinter = Winnow::Fingerprinter.new(t: 1, k: 1) - fprints = fingerprinter.fingerprints("abcdefg") + fprints = fprinter.fingerprints("abcdefg") hashes = Set.new(('a'..'g').map(&:hash)) fprint_hashes = Set.new(fprints.map(&:value))
Fix misnamed variable in winnow spec.
diff --git a/lib/tasks/cleanup_attachments.rake b/lib/tasks/cleanup_attachments.rake index abc1234..def5678 100644 --- a/lib/tasks/cleanup_attachments.rake +++ b/lib/tasks/cleanup_attachments.rake @@ -0,0 +1,11 @@+namespace :attachments do + + desc "Clean attachments older than 2 years" + + task :cleanup => :environment do + Invoice.where("pdf_updated_at < ?", 2.years.ago).each do |i| + i.pdf.clear + i.save + end + end +end
Add task to cleanup attachments
diff --git a/fix-db-schema-conflicts.gemspec b/fix-db-schema-conflicts.gemspec index abc1234..def5678 100644 --- a/fix-db-schema-conflicts.gemspec +++ b/fix-db-schema-conflicts.gemspec @@ -24,5 +24,5 @@ spec.add_development_dependency 'rails' spec.add_development_dependency 'sqlite3' - spec.add_dependency "rubocop", ">= 0.36.0" + spec.add_dependency "rubocop", ">= 0.38.0" end
Upgrade Rubocop to get major performance boost
diff --git a/fluentd-plugin-nicorepo.gemspec b/fluentd-plugin-nicorepo.gemspec index abc1234..def5678 100644 --- a/fluentd-plugin-nicorepo.gemspec +++ b/fluentd-plugin-nicorepo.gemspec @@ -18,6 +18,8 @@ spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] + spec.add_runtime_dependency "fluentd" + spec.add_runtime_dependency "nicorepo" spec.add_development_dependency "bundler", "~> 1.6" spec.add_development_dependency "rake" end
Add dipendencies for fluentd and nicorepo
diff --git a/spec/acceptance/attribute_aliases_spec.rb b/spec/acceptance/attribute_aliases_spec.rb index abc1234..def5678 100644 --- a/spec/acceptance/attribute_aliases_spec.rb +++ b/spec/acceptance/attribute_aliases_spec.rb @@ -3,23 +3,44 @@ describe "attribute aliases" do before do - define_model('User') + define_model('User', :name => :string, :age => :integer) define_model('Post', :user_id => :integer) do belongs_to :user end FactoryGirl.define do - factory :user + factory :user do + factory :user_with_name do + name "John Doe" + end + end factory :post do user end + + factory :post_with_named_user, :class => Post do + user :factory => :user_with_name, :age => 20 + end end end - it "doesn't assign both an association and its foreign key" do - FactoryGirl.build(:post, :user_id => 1).user_id.should == 1 + context "assigning an association by foreign key" do + subject { FactoryGirl.build(:post, :user_id => 1) } + + it "doesn't assign both an association and its foreign key" do + subject.user_id.should == 1 + end + end + + context "assigning an association by passing factory" do + subject { FactoryGirl.create(:post_with_named_user).user } + + it "assigns attributes correctly" do + subject.name.should == "John Doe" + subject.age.should == 20 + end end end
Add acceptance spec covering assigning associations via :factory Closes #100
diff --git a/lib/domreactor-redglass/archive.rb b/lib/domreactor-redglass/archive.rb index abc1234..def5678 100644 --- a/lib/domreactor-redglass/archive.rb +++ b/lib/domreactor-redglass/archive.rb @@ -36,7 +36,7 @@ is_valid = false if File.directory? file dir_files = Dir.entries(file).delete_if {|name| name == '.' || name == '..'} - is_valid = true if dir_files == REQUIRED_ARCHIVE_FILES + is_valid = dir_files.sort == REQUIRED_ARCHIVE_FILES.sort end is_valid end
Sort file names before comparing them.
diff --git a/lib/grid_pattern_editor/command.rb b/lib/grid_pattern_editor/command.rb index abc1234..def5678 100644 --- a/lib/grid_pattern_editor/command.rb +++ b/lib/grid_pattern_editor/command.rb @@ -22,23 +22,29 @@ parser = OptionParser.new + parser.banner = "grid_pattern_editor [FILE_PATH] [OPTION]..." + parser.on("-w", "--width=WIDTH", - Integer) do |width| + Integer, + "Window width size (px)") do |width| options[:width] = width end parser.on("-h", "--height=HEIGHT", - Integer) do |height| + Integer, + "Window height size (px)") do |height| options[:height] = height end - parser.on("--columns=NUMBER_OF_COLUMUNS", - Integer) do |columns| + parser.on("--columns=COLUMUNS", + Integer, + "Number of columns") do |columns| options[:columns] = columns end - parser.on("--rows=NUMBER_OF_ROWS", - Integer) do |rows| + parser.on("--rows=ROWS", + Integer, + "Number of rows") do |rows| options[:rows] = rows end
Add descriptions to help message
diff --git a/files/unifiedpush-cookbooks/unifiedpush/recipes/postgresql_database_schema.rb b/files/unifiedpush-cookbooks/unifiedpush/recipes/postgresql_database_schema.rb index abc1234..def5678 100644 --- a/files/unifiedpush-cookbooks/unifiedpush/recipes/postgresql_database_schema.rb +++ b/files/unifiedpush-cookbooks/unifiedpush/recipes/postgresql_database_schema.rb @@ -30,6 +30,6 @@ execute "initialize unifiedpush-server database" do cwd "#{install_dir}/embedded/apps/unifiedpush-server/initdb/bin" - command "./init-unifiedpush-db.sh #{database_name} -Daerobase.config.dir=/tmp/db.properties" + command "./init-unifiedpush-db.sh --database=#{database_name} --config-path=/tmp/db.properties" action :nothing end
Improve script parameters and help command
diff --git a/lib/optical/filters/only_unique.rb b/lib/optical/filters/only_unique.rb index abc1234..def5678 100644 --- a/lib/optical/filters/only_unique.rb +++ b/lib/optical/filters/only_unique.rb @@ -5,18 +5,11 @@ class Optical::Filters::OnlyUnique < Optical::Filters::NullFilter def filter_to(output_bam) if @lib.is_paired? - only_unique_pairs(output_bam) + filter_through_awk_script(File.join(File.dirname(__FILE__),"paired_end_only_unique.awk"), + output_bam,@conf.min_map_quality_score) else - only_unique_singles(output_bam) + filter_through_awk_script(File.join(File.dirname(__FILE__),"single_end_only_unique.awk"), + output_bam,@conf.min_map_quality_score) end end - - def only_unique_pairs(output_bam) - return false - end - - def only_unique_singles(output_bam) - filter_through_awk_script(File.join(File.dirname(__FILE__),"single_end_only_unique.awk"), - output_bam,@conf.min_map_quality_score) - end end
Refactor out a method call
diff --git a/lib/saxerator/document_fragment.rb b/lib/saxerator/document_fragment.rb index abc1234..def5678 100644 --- a/lib/saxerator/document_fragment.rb +++ b/lib/saxerator/document_fragment.rb @@ -10,6 +10,8 @@ end def each(&block) + return to_enum unless block_given? + # Always have to start at the beginning of a File @source.rewind if @source.respond_to?(:rewind)
Return an enumerator if no block is given This is the typical pattern for Enumerable objects, and was an oversight that it was not already-included here. See http://ruby-doc.org/core-2.4.1/Object.html#method-i-to_enum
diff --git a/lib/data_store/base.rb b/lib/data_store/base.rb index abc1234..def5678 100644 --- a/lib/data_store/base.rb +++ b/lib/data_store/base.rb @@ -16,7 +16,7 @@ # For example: "[5,4,3]" => [5,4,3] def compression_schema value = self.values[:compression_schema] - eval(value) if value.is_a?(String) #convert string into array + value.gsub(/\[|\]/,'').split(',').map(&:to_i) unless value.nil? end private
Replace eval with a 'saver' string to array convert mechanism
diff --git a/app/helpers/guesses_helper.rb b/app/helpers/guesses_helper.rb index abc1234..def5678 100644 --- a/app/helpers/guesses_helper.rb +++ b/app/helpers/guesses_helper.rb @@ -1,6 +1,7 @@ module GuessesHelper def sanitize(answer) - return answer.downcase.gsub(/\s+/, '') + # return answer.downcase.gsub(/\s+/, '') + return answer.downcase.gsub(/<i>|\s+|<\/i>/, '') end end
Update the gsub regex statement
diff --git a/Casks/cocos-code-ide.rb b/Casks/cocos-code-ide.rb index abc1234..def5678 100644 --- a/Casks/cocos-code-ide.rb +++ b/Casks/cocos-code-ide.rb @@ -0,0 +1,17 @@+cask :v1 => 'cocos-code-ide' do + version '1.2.0' + sha256 'b588d3d7993204d0828ee954eabab09824f66dfc44c8fc3d6fe774ed8b25a23e' + + url "http://www.cocos2d-x.org/filedown/cocos-code-ide-mac64-#{version}.dmg" + name 'Cocos Code IDE' + homepage 'http://www.cocos2d-x.org' + license :unknown + + app 'Cocos Code IDE.app' + + zap :delete => [ + '~/Library/Caches/org.cocos.platform.ide', + '~/Library/Saved Application State/org.cocos.platform.ide.savedState', + '~/Library/Preferences/org.cocos.platform.ide.plist', + ] +end
Add Cocos Code Ide.app v1.2.0
diff --git a/lib/rusttrace/usage.rb b/lib/rusttrace/usage.rb index abc1234..def5678 100644 --- a/lib/rusttrace/usage.rb +++ b/lib/rusttrace/usage.rb @@ -0,0 +1,63 @@+module Rusttrace + class Usage + class CallCount < FFI::Struct + layout :count, :uint, + :method_length, :uint, + :method_name, :string + + def inspect + "#<CallCount method_name=#{method_name} count=#{count}>" + end + + def method_name + self[:method_name] + end + + def count + self[:count] + end + end + + class Report < FFI::Struct + include Enumerable + + layout :length, :uint, + :call_counts, :pointer + + def each + self[:length].times do |i| + yield CallCount.new(self[:call_counts] + (i * CallCount.size)) + end + end + end + + module Rust + extend FFI::Library + + ffi_lib 'target/debug/librusttrace.dylib' + + attach_function :new_usage, [], :pointer + attach_function :record, [:pointer, :string, :string, :int, :string, :string], :void + attach_function :report, [:pointer], Report.by_value + end + + def initialize + @value = 0 + @usage = Rust.new_usage + end + + def attach + set_trace_func proc { |event, file, line, id, binding, classname| + Rust.record(@usage, event, file, line, id.to_s, classname.to_s) + } + end + + def report + Rust.report(@usage) + end + + private + + attr_reader :value + end +end
Write Ruby interface for Rust backend
diff --git a/lib/silent-postgres.rb b/lib/silent-postgres.rb index abc1234..def5678 100644 --- a/lib/silent-postgres.rb +++ b/lib/silent-postgres.rb @@ -8,7 +8,8 @@ def self.included(base) SILENCED_METHODS.each do |m| - base.send :alias_method_chain, m, :silencer + base.send :alias_method, "#{m}_without_silencer", m + base.send :alias_method, m, "#{m}_with_silencer" end end
Use alias_method instead of deprecated alias_method_chain
diff --git a/OGCSensorThings.podspec b/OGCSensorThings.podspec index abc1234..def5678 100644 --- a/OGCSensorThings.podspec +++ b/OGCSensorThings.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |s| s.name = "OGCSensorThings" - s.version = "0.2.0" + s.version = "0.2.1" s.summary = "Easily consume OGCSensorThings services." s.description = <<-DESC
Update to 0.2.1 because of failed push :)
diff --git a/lib/youtrack/client.rb b/lib/youtrack/client.rb index abc1234..def5678 100644 --- a/lib/youtrack/client.rb +++ b/lib/youtrack/client.rb @@ -26,9 +26,11 @@ true == @admin end - def initialize(options={}) + def initialize(options={}, &block) @cookies = {} @admin = false + + yield(self) if block_given? end # the server endpoint
Add block style initialization for Client
diff --git a/lib/zebra/print_job.rb b/lib/zebra/print_job.rb index abc1234..def5678 100644 --- a/lib/zebra/print_job.rb +++ b/lib/zebra/print_job.rb @@ -30,7 +30,7 @@ def send_to_printer(path) puts "* * * * * * * * * * * * Sending file to printer #{@printer} at #{@remote_ip} * * * * * * * * * * " # `lp -h #{@remote_ip} -d #{@printer} -o raw #{path}` - `lp -h #{@remote_ip} -d #{@printer} -o raw ../zpl_test.zpl` + `lp -h #{@remote_ip} -d #{@printer} -o raw zpl_test.zpl` end end end
Change path to zpl test file
diff --git a/actionpack/lib/action_view/renderable_partial.rb b/actionpack/lib/action_view/renderable_partial.rb index abc1234..def5678 100644 --- a/actionpack/lib/action_view/renderable_partial.rb +++ b/actionpack/lib/action_view/renderable_partial.rb @@ -4,7 +4,7 @@ # So you can not set or modify any instance variables def variable_name - @variable_name ||= name.gsub(/^_/, '').to_sym + @variable_name ||= name.sub(/\A_/, '').to_sym end def counter_name
Use sub instead of gsub Signed-off-by: Joshua Peek <c028c213ed5efcf30c3f4fc7361dbde0c893c5b7@joshpeek.com>
diff --git a/Library/Homebrew/cask/lib/hbc/container/gpg.rb b/Library/Homebrew/cask/lib/hbc/container/gpg.rb index abc1234..def5678 100644 --- a/Library/Homebrew/cask/lib/hbc/container/gpg.rb +++ b/Library/Homebrew/cask/lib/hbc/container/gpg.rb @@ -6,12 +6,12 @@ class Container class Gpg < Base def self.me?(criteria) - criteria.extension(/GPG/n) + criteria.extension(/GPG|SIG/n) end def import_key if @cask.gpg.nil? - raise CaskError, "Expected to find gpg public key in formula. Cask '#{@cask}' must add: key_id or key_url" + raise CaskError, "Expected to find gpg public key in formula. Cask '#{@cask}' must add: 'gpg :embedded, key_id: [Public Key ID]' or 'gpg :embedded, key_url: [Public Key URL]'" end args = if @cask.gpg.key_id
Support GPG (signed data) container in Homebrew Cask
diff --git a/pushable.gemspec b/pushable.gemspec index abc1234..def5678 100644 --- a/pushable.gemspec +++ b/pushable.gemspec @@ -16,7 +16,8 @@ s.files = Dir['{app,config,db,lib}/**/*', 'MIT-LICENSE', 'Rakefile', 'README.rdoc'] - s.add_dependency 'rails', '~> 4' + s.add_dependency 'rails', '~> 4.2' + s.add_dependency 'activejob', '~> 4.2' s.add_dependency 'responders', '~> 2.0' s.add_dependency 'mercurius', '~> 0.0'
Update dependencies to include ActiveJob
diff --git a/xtables_version.rb b/xtables_version.rb index abc1234..def5678 100644 --- a/xtables_version.rb +++ b/xtables_version.rb @@ -0,0 +1,76 @@+# +# xtables_version.rb +# +# This fact provides version of the user-space utilities like "iptables", +# "ebtables" and "arptables" when present. All these tools interact with +# modern Linux Kernel and its firewall called Netfilter (the kernel-space +# component) and work either in Layer 2 or Layer 3 OSI networking model ... +# +# Known utilities, their names and short description: +# +# iptables - "Administration tool for IPv4 packet filtering and NAT", +# ip6tables - "IPv6 packet filter administration", +# ebtables - "Ethernet bridge frame table administration", +# arptables - "ARP table administration"; +# + +require 'facter' + +if Facter.value(:kernel) == 'Linux' + # We grab the class to use for any future calls to static "exec" method ... + resolution = Facter::Util::Resolution + + # + # Modern Linux distributions offer "iptables", "ebtables" and "arptables" + # binaries from under the "/sbin" directory. Therefore we will simply use + # "/sbin/iptables" (similarly for "ebtables", etc ...) when asking for the + # software version ... + # + + # We work-around an issue in Facter #10278 by forcing locale settings ... + ENV['LANG'] = 'POSIX' + ENV['LC_ALL'] = 'POSIX' + + # Both "iptables" and "ip6tables" will have the same version in 99% of cases ... + if File.exists?('/sbin/iptables') + Facter.add('iptables_version') do + confine :kernel => :linux + setcode do + version = resolution.exec('/sbin/iptables -V 2> /dev/null').strip + version.split(/\s+v?/)[1] + end + end + end + + if File.exists?('/sbin/ebtables') + Facter.add('ebtables_version') do + confine :kernel => :linux + setcode do + version = resolution.exec('/sbin/ebtables -V 2> /dev/null').strip + version.split(/\s+v?/)[1] + end + end + end + + # + # Worth noting is that "arptables" will complain for non-root users but + # even despite that we can still retrieve its version ... + # + # When it complains the output will resemble the following format: + # + # arptables v0.0.3.4: can't initialize arptables table `filter': Permission denied (you must be root) + # Perhaps arptables or your kernel needs to be upgraded. + # + if File.exists?('/sbin/arptables') + Facter.add('arptables_version') do + confine :kernel => :linux + setcode do + version = resolution.exec('/sbin/arptables -V 2>&1').split('\n')[0] + version.split(/\s+v?/)[1].sub(':', '') + end + end + end +end + +# vim: set ts=2 sw=2 et : +# encoding: utf-8
Add Facter fact that provides versions for "iptables", "ebtables" and "arptables". This fact will provide version number details for "iptables" (including "ip6tables" as this is the same package in 99% of cases), "ebtables" and "arptables". Signed-off-by: Krzysztof Wilczynski <9bf091559fc98493329f7d619638c79e91ccf029@linux.com>
diff --git a/ivy/app/models/calculator.rb b/ivy/app/models/calculator.rb index abc1234..def5678 100644 --- a/ivy/app/models/calculator.rb +++ b/ivy/app/models/calculator.rb @@ -1,8 +1,17 @@ # Takes a Refinery graph and computes loads. -module Calculator - module_function +class Calculator + def self.calculate(graph) + new(graph).calculate + end - # Public: Given a graph, calculated the load bottom-up. + # Public: Creates a new calculator for determining the load across the entire + # given +graph+. + def initialize(graph) + @graph = graph + @visited = {} + end + + # Public: Calculates the load bottom-up. # # Starting with the leaf ("sink") nodes, the load of the graph is calculated # by summing the loads of any child nodes (including negative (supply) loads) @@ -13,11 +22,13 @@ # calculated has one or more children which have not yet themselves been # calculated, the node will be skipped and returned to later. # - # Returns the given graph. - def calculate(graph) - nodes = graph.nodes.reject { |n| n.out_edges.any? } + # Returns the graph. + def calculate + nodes = @graph.nodes.reject { |n| n.out_edges.any? } while node = nodes.shift + next if @visited.key?(node) + if node.out.get(:load).any?(&:nil?) # One or more children haven't yet got a load. nodes.push(node) @@ -25,16 +36,22 @@ end calculate_node(node) + nodes.push(*node.in.to_a) - nodes.push(*node.in.to_a) + @visited[node] = true end - graph + @graph end + + ####### + private + ####### # Internal: Computed the load of a single node. # - # Returns nothing. + # Returns the calculated demand, or nil if the node had already been + # calculated. def calculate_node(node) return if node.get(:load)
Improve performance of larger graphs
diff --git a/recipes/backup.rb b/recipes/backup.rb index abc1234..def5678 100644 --- a/recipes/backup.rb +++ b/recipes/backup.rb @@ -3,7 +3,7 @@ # Recipe:: backup # -node.set['percona']['backup']['configure'] = true +node.default['percona']['backup']['configure'] = true include_recipe 'percona::package_repo'
Change from node.set to node.default
diff --git a/recipes/vidyo.rb b/recipes/vidyo.rb index abc1234..def5678 100644 --- a/recipes/vidyo.rb +++ b/recipes/vidyo.rb @@ -29,6 +29,13 @@ checksum '9d2455dc29bfa7db5cf3ec535ffd2a8c86c5a71f78d7d89c40dbd744b2c15707' end -package 'libqt4-gui' +package [ + 'libqt4-designer', + 'libqt4-opengl', + 'libqt4-svg', + 'libqtgui4' + ] do + action :upgrade +end dpkg_package deb_path
Use modern package names instead of deprecated 'libqt4-gui'
diff --git a/lib/adhearsion/twilio/plugin.rb b/lib/adhearsion/twilio/plugin.rb index abc1234..def5678 100644 --- a/lib/adhearsion/twilio/plugin.rb +++ b/lib/adhearsion/twilio/plugin.rb @@ -31,17 +31,18 @@ # Defining a Rake task is easy # The following can be invoked with: - # rake plugin_demo:info + # rake adhearsion:twilio:info # tasks do - namespace :twilio do - desc "Prints the PluginTemplate information" - task :info do - STDOUT.puts "adhearsion-twilio plugin v. #{VERSION}" + namespace :adhearsion do + namespace :twilio do + desc "Prints the adhearsion-twilio information" + task :info do + STDOUT.puts "adhearsion-twilio plugin v. #{VERSION}" + end end end end - end end end
Tidy up rake task for printing version info
diff --git a/api/lib/controllers/auto_renderer.rb b/api/lib/controllers/auto_renderer.rb index abc1234..def5678 100644 --- a/api/lib/controllers/auto_renderer.rb +++ b/api/lib/controllers/auto_renderer.rb @@ -21,7 +21,8 @@ "application/x-tar" => :tar, "application/x-shell" => :shell, "application/x-sh" => :shell, - "application/json" => :json + "application/json" => :json, + "application/javascript" => :json } attr :default_renderer, true
Set :json as the default renderer for javascript
diff --git a/lib/hanami/config/load_paths.rb b/lib/hanami/config/load_paths.rb index abc1234..def5678 100644 --- a/lib/hanami/config/load_paths.rb +++ b/lib/hanami/config/load_paths.rb @@ -13,7 +13,7 @@ @root = root each do |path| - Dir.glob(path.join(PATTERN)).each { |file| require file } + Dir.glob(path.join(PATTERN)).sort.each { |file| require file } end end
Add .sort to glob, possibly fixing OS X / Linux discrepancy
diff --git a/app/controllers/flickr_controller.rb b/app/controllers/flickr_controller.rb index abc1234..def5678 100644 --- a/app/controllers/flickr_controller.rb +++ b/app/controllers/flickr_controller.rb @@ -1,12 +1,12 @@ class FlickrController < ApplicationController - def index - - begin - @photos = flickr.photos.search(:text => "srnsw.*") - rescue - @photos = Array.new + def index + + begin + @photos = flickr.photos.search(:machine_tags => "srnsw.*=") + rescue + @photos = Array.new end - + render :partial => 'index' - end + end end
Use machine_tags instead of text for Flickr's search
diff --git a/app/controllers/skills_controller.rb b/app/controllers/skills_controller.rb index abc1234..def5678 100644 --- a/app/controllers/skills_controller.rb +++ b/app/controllers/skills_controller.rb @@ -44,6 +44,6 @@ end def skill_params - params.require(:skill).permit(:name, :skill_category_id, :user_id) + params.require(:skill).permit(:name, :skill_category_id) end end
Remove :user_id as an accepted attribute from SkillsController Signed-off-by: Max Fierke <0706025b2bbcec1ed8d64822f4eccd96314938d0@maxfierke.com>
diff --git a/app/controllers/spaces_controller.rb b/app/controllers/spaces_controller.rb index abc1234..def5678 100644 --- a/app/controllers/spaces_controller.rb +++ b/app/controllers/spaces_controller.rb @@ -1,6 +1,6 @@ class SpacesController < ApplicationController def index @dojo_count = Dojo.count - @regions_and_dojos = Dojo.eager_load(:prefecture).default_order.group_by { |dojo| dojo.prefecture.region } + @regions_and_dojos = Dojo.group_by_region end end
Use a class method instead
diff --git a/lib/ups/parsers/track_parser.rb b/lib/ups/parsers/track_parser.rb index abc1234..def5678 100644 --- a/lib/ups/parsers/track_parser.rb +++ b/lib/ups/parsers/track_parser.rb @@ -15,6 +15,10 @@ status_type_description: status_type_description, status_type_code: status_type_code } + end + + def activities + normalize_response_into_array(root_response[:Shipment][:Package][:Activity]) end def status_date @@ -39,10 +43,6 @@ activities.sort_by {|a| [a[:GMTDate], a[:GMTTime]] }.last end - def activities - normalize_response_into_array(root_response[:Shipment][:Package][:Activity]) - end - def root_response parsed_response[:TrackResponse] end
Allow all shipment activities to be accessed YP-22
diff --git a/Snap.podspec b/Snap.podspec index abc1234..def5678 100644 --- a/Snap.podspec +++ b/Snap.podspec @@ -8,7 +8,7 @@ s.social_media_url = 'http://twitter.com/robertjpayne' s.source = { :git => 'https://github.com/Masonry/Snap.git', :tag => '0.0.2' } - s.ios.deployment_target = '7.0' + s.ios.deployment_target = '8.0' s.osx.deployment_target = '10.9' s.source_files = 'Snap/*.swift'
Revert "Allow iOS 7.0 for Cocoapods" This reverts commit 24de96971a132f9717ace5e9ad9659b7b70ef94f.
diff --git a/features/step_definitions/parse_csv_steps.rb b/features/step_definitions/parse_csv_steps.rb index abc1234..def5678 100644 --- a/features/step_definitions/parse_csv_steps.rb +++ b/features/step_definitions/parse_csv_steps.rb @@ -4,8 +4,9 @@ Given(/^it is stored at the url "(.*?)"$/) do |url| @url = url + content_type = @content_type || "text/csv" charset = @encoding || "UTF-8" - stub_request(:get, url).to_return(:status => 200, :body => @csv, :headers => {"Content-Type" => "text/csv; charset=#{charset}"}) + stub_request(:get, url).to_return(:status => 200, :body => @csv, :headers => {"Content-Type" => "#{content_type}; charset=#{charset}"}) end When(/^I ask if the CSV is valid$/) do
Allow content type to be explicitly set in tests
diff --git a/features/step_definitions/splitjoin_steps.rb b/features/step_definitions/splitjoin_steps.rb index abc1234..def5678 100644 --- a/features/step_definitions/splitjoin_steps.rb +++ b/features/step_definitions/splitjoin_steps.rb @@ -1,14 +1,6 @@ Given /^the splitjoin plugin is loaded$/ do plugin_dir = File.expand_path('../../..', __FILE__) puts @vim.add_plugin plugin_dir, 'plugin/splitjoin.vim' -end - -Given /^"([^"]*)" is set$/ do |boolean_setting| - @vim.command("set #{boolean_setting}") -end - -Given /^"([^"]*)" is set to "([^"]*)"$/ do |setting, value| - @vim.command("set #{setting}=#{value}") end When /^I split the line$/ do
Move some steps to cucumber-vimscript
diff --git a/mongo_utils.gemspec b/mongo_utils.gemspec index abc1234..def5678 100644 --- a/mongo_utils.gemspec +++ b/mongo_utils.gemspec @@ -20,8 +20,7 @@ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) } s.require_paths = ["lib"] - s.add_dependency 'mongo', '~> 1.3.0' + s.add_dependency 'bson_ext' s.add_dependency 'activesupport', '~> 3.0' - s.add_dependency 'mongoid', '~> 2.0' - s.add_dependency 'bson_ext' + s.add_development_dependency 'mongoid', '~> 2.0' end
Make mongoid a dev dep; remove mongo dep
diff --git a/dashboards.rb b/dashboards.rb index abc1234..def5678 100644 --- a/dashboards.rb +++ b/dashboards.rb @@ -36,5 +36,5 @@ end before '/company' do - redirect to '/company/2013' + redirect to '/company/2014' end
Make company/2014 the default dashboard
diff --git a/routes/general.rb b/routes/general.rb index abc1234..def5678 100644 --- a/routes/general.rb +++ b/routes/general.rb @@ -37,7 +37,8 @@ end app.get '/characters/?' do - @characters = Character.desc(:updated_at) + @characters = Character.unscoped + .desc(:updated_at) .limit(100) .only(:name, :server)
Speed up /characters by unscoping the query
diff --git a/lib/generators/chanko/unit/unit_generator.rb b/lib/generators/chanko/unit/unit_generator.rb index abc1234..def5678 100644 --- a/lib/generators/chanko/unit/unit_generator.rb +++ b/lib/generators/chanko/unit/unit_generator.rb @@ -32,7 +32,7 @@ private def create_assets_symlink(type) - from = "app/assets/#{type}/units/#{file_name}" + from = "app/assets/#{type}/#{directory_name}/#{file_name}" to = "../../../../#{directory}/#{type}" create_link(from, to) end @@ -40,6 +40,10 @@ def directory "#{Chanko::Config.units_directory_path}/#{file_name}" end + + def directory_name + Chanko::Config.units_directory_path.split("/").last + end end end end
Fix symlink directory name from "unit" to user defined
diff --git a/lib/mas/development_dependencies/cucumber.rb b/lib/mas/development_dependencies/cucumber.rb index abc1234..def5678 100644 --- a/lib/mas/development_dependencies/cucumber.rb +++ b/lib/mas/development_dependencies/cucumber.rb @@ -24,6 +24,12 @@ desc 'Run all features' task :all => [:ok, :wip] end + + # In case we don't have the generic Rails test:prepare hook, append a + # no-op task that we can depend upon. + task 'test:prepare' do + end + desc 'Alias for cucumber:ok' task :cucumber => 'cucumber:ok'
Add a no-op 'test:prepare' task hook for Cucumber
diff --git a/lib/arel/visitors/postgresql.rb b/lib/arel/visitors/postgresql.rb index abc1234..def5678 100644 --- a/lib/arel/visitors/postgresql.rb +++ b/lib/arel/visitors/postgresql.rb @@ -19,6 +19,14 @@ else super end + end + + def visit_Arel_Nodes_Matches o + "#{visit o.left} ILIKE #{visit o.right}" + end + + def visit_Arel_Nodes_DoesNotMatch o + "#{visit o.left} NOT ILIKE #{visit o.right}" end def using_distinct_on?(o)
Make PostgreSQL play nice with its friends. (matches -> ILIKE instead of LIKE)
diff --git a/lib/ello/kinesis_consumer/base_processor.rb b/lib/ello/kinesis_consumer/base_processor.rb index abc1234..def5678 100644 --- a/lib/ello/kinesis_consumer/base_processor.rb +++ b/lib/ello/kinesis_consumer/base_processor.rb @@ -17,7 +17,8 @@ end def run! - @stream_reader.run! do |record, schema_name| + batch_size = Integer(ENV['CONSUMER_BATCH_SIZE'] || StreamReader::DEFAULT_BATCH_SIZE) + @stream_reader.run!(batch_size: batch_size) do |record, schema_name| @logger.info "#{schema_name}: #{record}" method_name = schema_name.underscore send method_name, record if respond_to?(method_name)
Allow the Kinesis batch size to be customized with an ENV var
diff --git a/lib/omniauth/strategies/wordpress_hosted.rb b/lib/omniauth/strategies/wordpress_hosted.rb index abc1234..def5678 100644 --- a/lib/omniauth/strategies/wordpress_hosted.rb +++ b/lib/omniauth/strategies/wordpress_hosted.rb @@ -8,7 +8,7 @@ # This is where you pass the options you would pass when # initializing your consumer from the OAuth gem. - option :client_options, { token_url: "/oauth/token", authorize_url: "/oauth/authorize" } + option :client_options, { } # These are called after authentication has succeeded. If @@ -22,10 +22,18 @@ { name: raw_info['display_name'], email: raw_info['user_email'], - nickname: raw_info['user_nicename'] + nickname: raw_info['user_nicename'], + urls: { "Website" => raw_info['user_url'] } } end + extra do + { :raw_info => raw_info } + end + + def raw_info + @raw_info ||= access_token.get('/me').parsed + end end end end
Update endpoints used by WP OAuth Server 3.1.3
diff --git a/app/lib/link_scraper.rb b/app/lib/link_scraper.rb index abc1234..def5678 100644 --- a/app/lib/link_scraper.rb +++ b/app/lib/link_scraper.rb @@ -5,7 +5,7 @@ nodes = document.css('a[href], img[src], video[src]') uris = nodes.map do |node| - node[:href].strip.presence || node[:src].strip.presence + node[:href]&.strip&.presence || node[:src]&.strip&.presence end remove_self(keep_web uris.compact)
Fix potential bug in link scraper
diff --git a/sass-spec.gemspec b/sass-spec.gemspec index abc1234..def5678 100644 --- a/sass-spec.gemspec +++ b/sass-spec.gemspec @@ -22,4 +22,6 @@ spec.add_dependency "minitest", "~> 5.8.0" spec.add_development_dependency "sass", "~> 3.4" + spec.add_development_dependency "bundler", "~> 1.7" + spec.add_development_dependency "rake", "~> 10.0" end
Revert "These are not dependencies, actually." This reverts commit 9a3bf839d156dcc45138688b6ae76d7a303492d8.
diff --git a/app/controllers/jmd/competitions_controller.rb b/app/controllers/jmd/competitions_controller.rb index abc1234..def5678 100644 --- a/app/controllers/jmd/competitions_controller.rb +++ b/app/controllers/jmd/competitions_controller.rb @@ -5,7 +5,7 @@ def index # @competitions are fetched by CanCan - @competitions = @competitions.order(:begins) + @competitions = @competitions.includes(:host, :round).order(:begins) end # new: @competition is built by CanCan
Fix n+1 query problem in competition index
diff --git a/app/models/concerns/physical_media_metadata.rb b/app/models/concerns/physical_media_metadata.rb index abc1234..def5678 100644 --- a/app/models/concerns/physical_media_metadata.rb +++ b/app/models/concerns/physical_media_metadata.rb @@ -14,14 +14,14 @@ def materials_and_measurements_to_solr measurement_hash = { "measurement_tesim" => [], "measurement_sim" => [] } measurements.each do |m| - measurement = [m.measurement.try(:to_s), m.measurement_type, m.measurement_unit].reject(&:empty?).join(" ") + measurement = [m.measurement.try(:to_s), m.measurement_type, m.measurement_unit].reject(&:blank?).join(" ") measurement_hash["measurement_tesim"] << measurement measurement_hash["measurement_sim"] << measurement end material_hash = { "material_tesim" => [], "material_sim" => [] } materials.each do |m| - material = [m.material.try(:to_s), m.material_type.try(:to_s)].reject(&:empty?).join(", ") + material = [m.material.try(:to_s), m.material_type.try(:to_s)].reject(&:blank?).join(", ") material_hash["material_tesim"] << material material_hash["material_sim"] << material end
Use blank? instead of empty? to check materials and measurements
diff --git a/recipes/configure_rundeck.rb b/recipes/configure_rundeck.rb index abc1234..def5678 100644 --- a/recipes/configure_rundeck.rb +++ b/recipes/configure_rundeck.rb @@ -34,6 +34,15 @@ }) end + if project['ssh_key'] + file "/var/rundeck/projects/#{project['name']}/.id_rsa" do + content project['ssh_key'] + owner "rundeck" + group "rundeck" + mode 00600 + end + end + # Todo, user project['node_search'] to find nodes to populate # resources.xml with. end
Deploy ssh-key to project if its specified.
diff --git a/src/order_parser.rb b/src/order_parser.rb index abc1234..def5678 100644 --- a/src/order_parser.rb +++ b/src/order_parser.rb @@ -7,6 +7,12 @@ def status summary[0].to_i + end + + def description + lines[6..-1].map(&:strip).each_slice(2).map do |s| + "#{s[1].split.first} #{s[0]}" + end.join(", ") end private
Add description to the OrderParser
diff --git a/proxy.rb b/proxy.rb index abc1234..def5678 100644 --- a/proxy.rb +++ b/proxy.rb @@ -13,12 +13,6 @@ end end - def response(env) - client_id = env['HTTP_CLIENT_ID'] - - space = redis.get "clients:#{client_id}:space" - access_token = redis.get "clients:#{client_id}:access_token" - next_sync_url = redis.get "clients:#{client_id}:next_sync_url" def render_output(format, items) case format when :rss @@ -28,36 +22,26 @@ end end - unless space && access_token + def response(env) + begin + client = Client.find(redis, env['HTTP_CLIENT_ID']) + rescue Errors::ClientNotFound return [401, {}, "Authentication failed."] end - url = if next_sync_url.nil? - "https://cdn.contentful.com/spaces/#{space}/sync?initial=true" + url = if client.next_sync_url.nil? + "https://cdn.contentful.com/spaces/#{client.space}/sync?initial=true" else - next_sync_url + client.next_sync_url end - items = [] - response = nil - begin - content = EM::HttpRequest.new(url).get query: {'access_token' => access_token} - if content.response_header.status == 200 - logger.info "Received #{content.response_header.status} from Contentful" - response = JSON.parse(content.response) - items += response['items'] - else - raise ::ContentfulSyncRss::Errors::SyncApiError - end - end while url = response['nextPageUrl'] + response = RequestHandler.request(url, client.access_token) + output = render_output(:rss, response.items) - rss = builder(:rss, locals: {items: items}) + client.next_sync_url = response.next_sync_url + client.save(redis) - if response['nextSyncUrl'] - redis.set("clients:#{client_id}:next_sync_url", response['nextSyncUrl']) - end - - [200, {}, rss] + [200, {}, output] end end
Apply changes to main application (extensible rendering, models, request/response classes)
diff --git a/spec/controllers/categories_controller_spec.rb b/spec/controllers/categories_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/categories_controller_spec.rb +++ b/spec/controllers/categories_controller_spec.rb @@ -2,35 +2,37 @@ describe CategoriesController do describe 'GET #index' do + before(:each) do + get :index + end + it 'responds with status code 200' do - get :index expect(response).to have_http_status 200 end it 'assigns all categories to @categories' do - get :index expect(assigns(:categories)).to eq Category.all end it 'renders the :index template' do - get :index expect(response).to render_template(:index) end end describe 'GET #show' do + before(:each) do + get :show, params: { id: Category.first.id } + end + it 'responds with status code 200' do - get :show, params: { id: Category.first.id } expect(response).to have_http_status 200 end it 'assigns the correct category to @category' do - get :show, params: { id: Category.first.id } expect(assigns(:category)).to eq Category.first end it 'renders the :show template' do - get :show, params: { id: Category.first.id } expect(response).to render_template(:show) end end
Refactor categories controller specs with before eaches
diff --git a/spec/renderers/redcarpet_html_renderer_spec.rb b/spec/renderers/redcarpet_html_renderer_spec.rb index abc1234..def5678 100644 --- a/spec/renderers/redcarpet_html_renderer_spec.rb +++ b/spec/renderers/redcarpet_html_renderer_spec.rb @@ -0,0 +1,36 @@+require 'spec_helper' + +module Shopify + RSpec.describe RedcarpetHTMLRenderer do + include_context 'spree_builders' + + let(:product) { build_spree_product } + subject { described_class.new } + + describe '.initialize' do + it 'returns an instance of the redcarpet html renderer' do + expect(subject).to be_a described_class + end + end + + describe '.render' do + describe 'when the content is nil' do + it 'returns an empty string' do + result = subject.render(nil) + expect(result).to eql('') + end + end + + describe 'when passes a non-nil content' do + before do + allow_any_instance_of(Redcarpet::Markdown).to receive(:render).and_return('string') + end + + it 'returns a string that is not empty' do + result = subject.render('hello') + expect(result).not_to be_empty + end + end + end + end +end
Add unit tests for the RedcarpetHTMLRenderer Fixes https://github.com/glossier/solidus_retail/issues/23
diff --git a/lib/rock_rms/resources/transaction_detail.rb b/lib/rock_rms/resources/transaction_detail.rb index abc1234..def5678 100644 --- a/lib/rock_rms/resources/transaction_detail.rb +++ b/lib/rock_rms/resources/transaction_detail.rb @@ -11,11 +11,20 @@ Response::TransactionDetail.format(res) end - def update_transaction_detail(id, fund_id: nil, amount: nil, fee_amount: nil) + def update_transaction_detail( + id, + fund_id: nil, + amount: nil, + fee_amount: nil, + entity_type_id: nil, + entity_id: nil + ) options = {} - options['AccountId'] = fund_id if fund_id - options['Amount'] = amount if amount - options['FeeAmount'] = fee_amount if fee_amount + options['AccountId'] = fund_id if fund_id + options['Amount'] = amount if amount + options['FeeAmount'] = fee_amount if fee_amount + options['EntityTypeId'] = entity_type_id if entity_type_id + options['EntityId'] = entity_id if entity_id patch(transaction_detail_path(id), options) end
Add entity_type_id and entity_id to TransactionDetail
diff --git a/lib/sprinkle/extensions/arbitrary_options.rb b/lib/sprinkle/extensions/arbitrary_options.rb index abc1234..def5678 100644 --- a/lib/sprinkle/extensions/arbitrary_options.rb +++ b/lib/sprinkle/extensions/arbitrary_options.rb @@ -0,0 +1,16 @@+module ArbitraryOptions + + def self.included(base) + base.extend ClassMethods + end + + module ClassMethods + + def method_missing_with_arbitrary_options(sym, *args, &block) + self.class.dsl_accessor sym + send(sym, *args, &block) + end + + alias_method_chain :method_missing, :arbitrary_options + end +end
Add extension module that allows arbitrary options to be added to any class
diff --git a/lib/xcode/configurations/boolean_property.rb b/lib/xcode/configurations/boolean_property.rb index abc1234..def5678 100644 --- a/lib/xcode/configurations/boolean_property.rb +++ b/lib/xcode/configurations/boolean_property.rb @@ -36,11 +36,19 @@ value.to_s =~ /^(?:NO|false)$/ ? "NO" : "YES" end + # + # @note Appending boolean properties has no real good default operation. What + # happens in this case is that whatever you decide to append will automatically + # override the previously existing settings. + # + # @param [Types] original the original value to be appended + # @param [Types] value Description + # def append(original,value) - save(original) | save(value) + save(value) end end end -end+end
FIX appending to boolean property by taking the new property
diff --git a/spec/classes/course/virtual/fundamentals_spec.rb b/spec/classes/course/virtual/fundamentals_spec.rb index abc1234..def5678 100644 --- a/spec/classes/course/virtual/fundamentals_spec.rb +++ b/spec/classes/course/virtual/fundamentals_spec.rb @@ -3,7 +3,6 @@ describe 'classroom::course::virtual::fundamentals' do parameter_matrix = [ - { :offline => true }, { :offline => true, :control_owner => 'puppetlabs-education' }, { :control_owner => 'puppetlabs-education' } ]
Remove the test that omits setting control_owner, because it is required now
diff --git a/config/software/postgresql.rb b/config/software/postgresql.rb index abc1234..def5678 100644 --- a/config/software/postgresql.rb +++ b/config/software/postgresql.rb @@ -0,0 +1,55 @@+# +# Copyright:: Copyright (c) 2012-2014 Chef Software, Inc. +# License:: Apache License, Version 2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +name "postgresql" +default_version "9.2.9" + +dependency "zlib" +dependency "openssl" +dependency "libedit" +dependency "ncurses" + +version "9.2.9" do + source :md5 => "38b0937c86d537d5044c599273066cfc" +end + +version "9.2.8" do + source :md5 => "c5c65a9b45ee53ead0b659be21ca1b97" +end + +version "9.3.4" do + source :md5 => "d0a41f54c377b2d2fab4a003b0dac762" +end + +source :url => "http://ftp.postgresql.org/pub/source/v#{version}/postgresql-#{version}.tar.bz2" +relative_path "postgresql-#{version}" + +configure_env = { + "LDFLAGS" => "-L#{install_dir}/embedded/lib -I#{install_dir}/embedded/include", + "CFLAGS" => "-L#{install_dir}/embedded/lib -I#{install_dir}/embedded/include", + "LD_RUN_PATH" => "#{install_dir}/embedded/lib" +} + +build do + command ["./configure", + "--prefix=#{install_dir}/embedded", + "--with-libedit-preferred", + "--with-openssl --with-includes=#{install_dir}/embedded/include", + "--with-libraries=#{install_dir}/embedded/lib"].join(" "), :env => configure_env + command "make -j #{max_build_jobs}", :env => {"LD_RUN_PATH" => "#{install_dir}/embedded/lib"} + command "make install" +end
Update postgres to 9.2.9 to pick up security patches But for now do so w/o pulling in a newer omnibus-software, b/c there are lots of changes there that are outside the current scope.
diff --git a/serialize.gemspec b/serialize.gemspec index abc1234..def5678 100644 --- a/serialize.gemspec +++ b/serialize.gemspec @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = 'serialize' - s.version = '0.1.0' + s.version = '0.1.1' s.summary = 'Common interface for serialization and deserialization, and serializer discovery' s.description = ' '
Package version is increased from 0.1.0 to 0.1.1
diff --git a/spec/feature/component_generator_spec.rb b/spec/feature/component_generator_spec.rb index abc1234..def5678 100644 --- a/spec/feature/component_generator_spec.rb +++ b/spec/feature/component_generator_spec.rb @@ -2,16 +2,15 @@ require 'English' RSpec.feature 'Component generator', :js do + load 'lib/generators/generate_component.thor' + let(:test_component_path) do UiComponents::Engine.root.join('app', 'cells', 'test_component') end before do expect(Dir.exist?(test_component_path)).to be(false) - - output = `bundle exec thor generate_component test_component 2>&1` - raise output unless $CHILD_STATUS.success? - + GenerateComponent.start(%w(test_component)) expect(Dir.exist?(test_component_path)).to be(true) require test_component_path.join('test_component_cell') end
Fix issue with `bundle` not being found on CircleCI
diff --git a/spec/features/create_an_exercise_spec.rb b/spec/features/create_an_exercise_spec.rb index abc1234..def5678 100644 --- a/spec/features/create_an_exercise_spec.rb +++ b/spec/features/create_an_exercise_spec.rb @@ -0,0 +1,33 @@+require 'rails_helper' + +describe "Create an exercise", type: :feature do + let(:exercise) { build(:exercise) } + before do + login_as create(:user) + visit new_exercise_url + end + + context "whit valid attributes" do + subject do + fill_in "exercise_title", with: exercise.title + fill_in "exercise_description", with: exercise.description + click_on "Criar" + end + + it "create the exercise" do + expect{ subject }.to change(Exercise, :count).by(1) + expect(page).to have_current_path(exercise_path(Exercise.first.id)) + end + end + + context "whit invalid attributes" do + subject do + click_on "Criar" + end + + it "doesn't create the exercise" do + expect{ subject }.to change(Exercise, :count).by(0) + expect(page).to have_selector("div.alert.alert-danger") + end + end +end
Add test to 'create exercise' feature
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,8 @@ # Be sure to restart your server when you modify this file. -Gitlab::Application.config.session_store :cookie_store, key: '_gitlab_session' +Gitlab::Application.config.session_store :cookie_store, key: '_gitlab_session', + secure: Gitlab::Application.config.force_ssl, + httponly: true # Use the database for sessions instead of the cookie-based default, # which shouldn't be used to store highly confidential information
Secure and httponly options on cookie.
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 @@ -2,7 +2,7 @@ Gitlab::Application.config.session_store( :redis_store, # Using the cookie_store would enable session replay attacks. - servers: Gitlab::Application.config.cache_store[1], # re-use the Redis config from the Rails cache store + servers: Gitlab::Application.config.cache_store[1].merge(namespace: 'session:gitlab'), # re-use the Redis config from the Rails cache store key: '_gitlab_session', secure: Gitlab.config.gitlab.https, httponly: true,
Store sessions in a Redis namespace This makes less of a mess of the Redis root.
diff --git a/tests/aws/models/auto_scaling/groups_test.rb b/tests/aws/models/auto_scaling/groups_test.rb index abc1234..def5678 100644 --- a/tests/aws/models/auto_scaling/groups_test.rb +++ b/tests/aws/models/auto_scaling/groups_test.rb @@ -20,7 +20,7 @@ end test("setting attributes in the constructor") do - group = Fog::AWS[:auto_scaling].groups.new(min_size: 1, max_size: 2) + group = Fog::AWS[:auto_scaling].groups.new(:min_size => 1, :max_size => 2) group.min_size == 1 && group.max_size == 2 end
Use old hash syntax to support older ruby versions
diff --git a/lib/neighborparrot/constants.rb b/lib/neighborparrot/constants.rb index abc1234..def5678 100644 --- a/lib/neighborparrot/constants.rb +++ b/lib/neighborparrot/constants.rb @@ -1,12 +1,4 @@ module Neighborparrot - ROOT_PATH = File.expand_path(File.dirname(__FILE__) + '/../../') - SERVER_URL = "https://neighborparrot.net" - ASSETS_URL = "https://neighborparrot.com" - SERVICES = %w(ws es) # WebSockets, EventSource - WS_INDEX = "#{ROOT_PATH}/templates/web_sockets.html.erb" - ES_INDEX = "#{ROOT_PATH}/templates/event_source.html.erb" - KEEP_ALIVE_TIMER = 10 - def self.test? Neighborparrot.env == :test @@ -24,4 +16,19 @@ Goliath.env rescue ENV['RACK_ENV'] || :development end + ROOT_PATH = File.expand_path(File.dirname(__FILE__) + '/../../') + if Neighborparrot::prod? + SERVER_URL = "https://neighborparrot.net" + ASSETS_URL = "https://neighborparrot.com" + else + SERVER_URL = "" + ASSETS_URL = "" + end + SERVICES = %w(ws es) # WebSockets, EventSource + WS_INDEX = "#{ROOT_PATH}/templates/web_sockets.html.erb" + ES_INDEX = "#{ROOT_PATH}/templates/event_source.html.erb" + KEEP_ALIVE_TIMER = 10 + + + end
Set localhost as server and asset_server in test and development enviroment
diff --git a/lib/thinking_sphinx/sphinxql.rb b/lib/thinking_sphinx/sphinxql.rb index abc1234..def5678 100644 --- a/lib/thinking_sphinx/sphinxql.rb +++ b/lib/thinking_sphinx/sphinxql.rb @@ -13,5 +13,5 @@ self.count = '@count' end - self.variables! + self.functions! end
Use Sphinx 2.1.x functions instead of variables by default. This can be changed back to the old behaviour by putting this call in an initialiser: ThinkingSphinx::SphinxQL.variables!
diff --git a/spec/models/film_spec.rb b/spec/models/film_spec.rb index abc1234..def5678 100644 --- a/spec/models/film_spec.rb +++ b/spec/models/film_spec.rb @@ -20,6 +20,8 @@ end describe 'associations' do - + it { should belong_to(:category) } + it { should have_many(:reviews) } + it { should have_many(:ratings) } end end
Add associations tests to Film model spec
diff --git a/spec/models/rule_spec.rb b/spec/models/rule_spec.rb index abc1234..def5678 100644 --- a/spec/models/rule_spec.rb +++ b/spec/models/rule_spec.rb @@ -0,0 +1,13 @@+require 'fast_spec_helper' +require 'app/models/rule' + +describe Rule, '#violated?' do + context 'when child class does not implement the method' do + it 'raises an exception' do + class TestRule < Rule; end + rule = TestRule.new('test') + + expect { rule.violated? }.to raise_error(/Must implement #violated\?/) + end + end +end
Add spec for Rule class