diff
stringlengths 65
26.7k
| message
stringlengths 7
9.92k
|
|---|---|
diff --git a/libraries/helpers.rb b/libraries/helpers.rb
index abc1234..def5678 100644
--- a/libraries/helpers.rb
+++ b/libraries/helpers.rb
@@ -14,7 +14,6 @@ cli_line += " -#{arg} #{value}"
when TrueClass
cli_line += " -#{arg}=true"
- #cli_line += " -#{arg}"
end
end
cli_line
|
Remove extraneous comment in cli_args helper
|
diff --git a/app/controllers/picks_controller.rb b/app/controllers/picks_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/picks_controller.rb
+++ b/app/controllers/picks_controller.rb
@@ -12,6 +12,9 @@ if params[:commit]=="signup"
redirect_to edit_user_path(@user.id), locals: {email: params[:email]}
else
+ if Time.now.min - @user.created_at.time.min < 1
+ @pick.send_email
+ end
flash[:error] = 'email sent'
redirect_to root_path
end
|
Send email to new users on lotifyme click
|
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -10,8 +10,10 @@
def create
@user = User.new(user_params)
+ @user.provider, @user.uid = "not_applicable", "not_applicable"
if @user.save
log_in @user
+ flash[:success] = "Welcome, #{@user.name}!"
redirect_to @user
else
render 'new'
|
Fix sign-up issue for those that prefer regular user registration
|
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -4,6 +4,10 @@ def show
if current_user.id == params[:id].to_i
@user = current_user
+ respond_to do |format|
+ format.html { render :show }
+ format.json { render json: @user }
+ end
else
redirect_to root_path, alert: "ACCESS DENIED."
end
|
Update user show page to render json data
|
diff --git a/spec/config/initializers/active_resource_extension_spec.rb b/spec/config/initializers/active_resource_extension_spec.rb
index abc1234..def5678 100644
--- a/spec/config/initializers/active_resource_extension_spec.rb
+++ b/spec/config/initializers/active_resource_extension_spec.rb
@@ -12,14 +12,14 @@ before(:each) { Thread.current['request-id'] = nil }
after(:each) { FakeWeb.last_request = nil }
- it 'should add a request Id header only if Thread.Current has it' do
+ it 'adds a request Id header only if Thread.Current has it' do
FakeWeb.register_uri(:get, 'http://somethingelse/other_dummies/id.json', status: 200, body: '{}')
OtherDummy.find('id')
request = FakeWeb.last_request
expect(request['X-Request-Id']).to eq(nil)
end
- it 'should add a request Id header' do
+ it 'adds a request Id header' do
Thread.current['request-id'] = 'current-request-id'
FakeWeb.register_uri(:get, 'http://something/dummies/id.json', status: 200, body: '{}')
Dummy.find('id')
|
Remove 'should' from spec description
|
diff --git a/app/serializers/charm_serializer.rb b/app/serializers/charm_serializer.rb
index abc1234..def5678 100644
--- a/app/serializers/charm_serializer.rb
+++ b/app/serializers/charm_serializer.rb
@@ -3,5 +3,5 @@ # app/serializers/charm_serializer.rb
class CharmSerializer < ActiveModel::Serializer
attributes :id, :character_id, :type, :name, :cost, :timing, :duration,
- :keywords, :min_essence, :body, :ref
+ :keywords, :min_essence, :prereqs, :body, :ref
end
|
Add prereqs field to Charm serializer
|
diff --git a/tools/complexity/lib/measurement/condition_counter.rb b/tools/complexity/lib/measurement/condition_counter.rb
index abc1234..def5678 100644
--- a/tools/complexity/lib/measurement/condition_counter.rb
+++ b/tools/complexity/lib/measurement/condition_counter.rb
@@ -2,5 +2,15 @@
module Measurement
class ConditionCounter < Counter
+
+ private
+
+ def leaves(node)
+ if node.respond_to?(:children) && !node.children.empty?
+ node.children.flat_map { |child| leaves(child) }
+ else
+ [node]
+ end
+ end
end
end
|
Add leaves method to ConditionCounter for ABC metric.
|
diff --git a/spec/features/user_registration_spec.rb b/spec/features/user_registration_spec.rb
index abc1234..def5678 100644
--- a/spec/features/user_registration_spec.rb
+++ b/spec/features/user_registration_spec.rb
@@ -16,7 +16,7 @@ expect(page).to have_content(I18n.t('devise.registrations.signed_up_but_unconfirmed'))
open_email(user.email)
- current_email.click_link 'Confirm my account'
+ current_email.click_link '激活帐号'
expect(page).to have_content(I18n.t('devise.confirmations.confirmed'))
end
end
|
Fix the failed features caused by translation
|
diff --git a/spec/services/points_calculator_spec.rb b/spec/services/points_calculator_spec.rb
index abc1234..def5678 100644
--- a/spec/services/points_calculator_spec.rb
+++ b/spec/services/points_calculator_spec.rb
@@ -0,0 +1,40 @@+require 'rails_helper'
+
+RSpec.describe PointsCalculator, type: :class do
+ let(:user) { create(:user) }
+ let(:user2) { create(:user) }
+ let(:campaign) { create(:campaign, users: [user, user2]) }
+ let(:service) { described_class.new(user, campaign) }
+
+ before { service.call }
+
+ describe "there is no campaign" do
+ let(:campaign2) { create(:campaign, users: [user], games: [game]) }
+ let(:game) { create(:game, campaign: campaign2) }
+ let(:post) { create(:post, user: user, content: 'cabaic', game: game) }
+ let(:post2) { create(:post, user: user, content: 'cebaic', game: game) }
+ let(:service) { described_class.new(user) }
+
+ it 'sets default campaign to nil' do
+ expect(service.campaign).to eq nil
+ end
+ # it 'counts all user posts' do
+ # expect(service.call).to eq 2
+ # end
+ end
+ describe "campaign is set" do
+ context "user is campaign member" do
+ let(:game) { create(:game, campaign: campaign) }
+ let(:user_post) { create(:post, game: game) }
+ let(:user2_post) { create(:post, game: game) }
+ # it 'returns Fixnum value' do
+ # expect(service.call).to be_a(Fixnum)
+ # end
+ # it 'returns only users posts' do
+ # expect(service.call).to eq 1
+ # end
+ end
+ context "user is not campaign member" do
+ end
+ end
+end
|
Create spec for PointsCalculator service
|
diff --git a/spec/functional/api/owners_controller_spec.rb b/spec/functional/api/owners_controller_spec.rb
index abc1234..def5678 100644
--- a/spec/functional/api/owners_controller_spec.rb
+++ b/spec/functional/api/owners_controller_spec.rb
@@ -16,5 +16,10 @@ attributes = owner.public_attributes
json_response.should == JSON.parse(attributes.to_json)
end
+
+ it '404s if no such owner is found' do
+ get '/not-even-a-valid-email'
+ last_response.status.should == 404
+ end
end
end
|
[Spec] Verify 404 if no owner is found
|
diff --git a/sinatra-activerecord.gemspec b/sinatra-activerecord.gemspec
index abc1234..def5678 100644
--- a/sinatra-activerecord.gemspec
+++ b/sinatra-activerecord.gemspec
@@ -19,7 +19,7 @@
gem.required_ruby_version = ">= 1.9.2"
- gem.add_dependency "sinatra", "~> 1.0"
+ gem.add_dependency "sinatra", ">= 1.0"
gem.add_dependency "activerecord", ">= 3.2"
gem.add_development_dependency "rake"
|
Allow Sinatra 2 in gemspec
Fixes #72, Fixes #70
|
diff --git a/lib/oauth2/model.rb b/lib/oauth2/model.rb
index abc1234..def5678 100644
--- a/lib/oauth2/model.rb
+++ b/lib/oauth2/model.rb
@@ -8,6 +8,10 @@ autoload :Authorization, ROOT + '/oauth2/model/authorization'
autoload :Client, ROOT + '/oauth2/model/client'
autoload :Schema, ROOT + '/oauth2/model/schema'
+
+ def self.find_access_token(access_token)
+ Authorization.find_by_access_token_hash(OAuth2.hashify(access_token))
+ end
end
end
|
Add a helper method for getting authorizations by access token, hiding the hashing details.
|
diff --git a/preserves.gemspec b/preserves.gemspec
index abc1234..def5678 100644
--- a/preserves.gemspec
+++ b/preserves.gemspec
@@ -18,6 +18,8 @@ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]
+ spec.add_dependency "pg", "~> 0.17.1"
+
spec.add_development_dependency "bundler", "~> 1.6"
spec.add_development_dependency "rake"
spec.add_development_dependency "rspec", "~> 3.0.0.rc1"
|
Add dependency on 'pg' gem for PostgreSQL back end.
|
diff --git a/recipes/link_sudo.rb b/recipes/link_sudo.rb
index abc1234..def5678 100644
--- a/recipes/link_sudo.rb
+++ b/recipes/link_sudo.rb
@@ -8,6 +8,6 @@ link "/opt/local/etc/sudoers" do
to "/etc/sudoers"
link_type :hard
- only_if(File.exists?("/opt/local/etc/sudoers"))
+ only_if { File.exists?("/opt/local/etc/sudoers") }
end
end
|
Fix stephen's lame not_if statement
|
diff --git a/LVGUtilities.podspec b/LVGUtilities.podspec
index abc1234..def5678 100644
--- a/LVGUtilities.podspec
+++ b/LVGUtilities.podspec
@@ -1,7 +1,7 @@ Pod::Spec.new do |s|
s.name = "LVGUtilities"
- s.version = "0.1.3"
+ s.version = "0.2.1"
s.summary = "Basic Swift utility functions."
s.homepage = 'https://github.com/letvargo/LVGUtilities'
s.description = <<-DESC
@@ -13,7 +13,7 @@ s.author = { "Aaron Rasmussen" => "letvargo@gmail.com" }
s.ios.deployment_target = "8.0"
s.osx.deployment_target = "10.10"
- s.source = { :git => "https://github.com/letvargo/LVGUtilities.git", :tag => "0.1.3" }
+ s.source = { :git => "https://github.com/letvargo/LVGUtilities.git", :tag => "0.2.1" }
s.source_files = "Source/**/*"
s.requires_arc = true
|
Update podspec to version 0.2.1
|
diff --git a/db/migrate/20130611210815_increase_snippet_text_column_size.rb b/db/migrate/20130611210815_increase_snippet_text_column_size.rb
index abc1234..def5678 100644
--- a/db/migrate/20130611210815_increase_snippet_text_column_size.rb
+++ b/db/migrate/20130611210815_increase_snippet_text_column_size.rb
@@ -0,0 +1,9 @@+class IncreaseSnippetTextColumnSize < ActiveRecord::Migration
+ def up
+ # MYSQL LARGETEXT for snippet
+ change_column :snippets, :content, :text, :limit => 4294967295
+ end
+
+ def down
+ end
+end
|
Increase snippet content column size.
This will fix issue #3904
|
diff --git a/spec/acceptance/root_spec.rb b/spec/acceptance/root_spec.rb
index abc1234..def5678 100644
--- a/spec/acceptance/root_spec.rb
+++ b/spec/acceptance/root_spec.rb
@@ -21,6 +21,7 @@ :id => { :type => "integer" },
:status => { :type => "string" },
:total_cents => { :type => "integer" },
+ :date => { :type => "date" },
:created_at => { :type => "datetime" },
:updated_at => { :type => "datetime" }
}
|
Add updated schema to specs
|
diff --git a/spec/requests/orders_spec.rb b/spec/requests/orders_spec.rb
index abc1234..def5678 100644
--- a/spec/requests/orders_spec.rb
+++ b/spec/requests/orders_spec.rb
@@ -0,0 +1,19 @@+require 'rails_helper'
+
+RSpec.describe 'Orders', type: :request do
+ describe 'GET /orders' do
+ it 'successful request' do
+ get '/api/orders'
+ expect(response).to have_http_status(200)
+ end
+ end
+
+ describe 'GET /orders/:id' do
+ it 'successful request' do
+ customer = Customer.create(first_name: 'J', last_name: 'C')
+ order = customer.orders.create
+ get "/api/orders/#{order.id}"
+ expect(response).to have_http_status(200)
+ end
+ end
+end
|
Add spec for orders resources
|
diff --git a/lib/rails/generators/fabrication/model/templates/fabricator.rb b/lib/rails/generators/fabrication/model/templates/fabricator.rb
index abc1234..def5678 100644
--- a/lib/rails/generators/fabrication/model/templates/fabricator.rb
+++ b/lib/rails/generators/fabrication/model/templates/fabricator.rb
@@ -1,4 +1,4 @@-Fabricator(:<%= singular_name %>) do
+Fabricator(<%= class_name.match(/::/) ? "'#{class_name}'" : ":#{singular_name}" %>) do
<% attributes.each do |attribute| -%>
<%= attribute.name %> <%= attribute.default.inspect %>
<% end -%>
|
Handle namespaced class names in generator
[closes #47]
|
diff --git a/lib/skywriter/resource/elastic_load_balancing/load_balancer.rb b/lib/skywriter/resource/elastic_load_balancing/load_balancer.rb
index abc1234..def5678 100644
--- a/lib/skywriter/resource/elastic_load_balancing/load_balancer.rb
+++ b/lib/skywriter/resource/elastic_load_balancing/load_balancer.rb
@@ -6,8 +6,10 @@ class LoadBalancer
include Skywriter::Resource
+ property :AccessLoggingProperty
property :AppCookieStickinessPolicy
property :AvailabilityZones
+ property :ConnectionDrainingPolicy
property :CrossZone
property :HealthCheck
property :Instances
|
Add AccessLoggingPolicy and ConnectionDrainingPolicy attributes
|
diff --git a/mongoid_auto_increment_id.gemspec b/mongoid_auto_increment_id.gemspec
index abc1234..def5678 100644
--- a/mongoid_auto_increment_id.gemspec
+++ b/mongoid_auto_increment_id.gemspec
@@ -3,19 +3,15 @@
Gem::Specification.new do |s|
s.name = "mongoid_auto_increment_id"
- s.version = "0.2"
+ s.version = "0.2.1"
s.platform = Gem::Platform::RUBY
s.authors = ["Jason Lee"]
s.email = ["huacnlee@gmail.com"]
s.homepage = "https://github.com/huacnlee/mongoid_auto_increment_id"
s.summary = %q{Override id field with MySQL like auto increment for Mongoid}
- s.description = %q{This gem for change Mongoid id field as Integer like MySQL.
-
- Idea from MongoDB document: [How to Make an Auto Incrementing Field](http://www.mongodb.org/display/DOCS/How+to+Make+an+Auto+Incrementing+Field)}
- s.files = `git ls-files`.split("\n")
- s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
- s.require_paths = ["lib"]
+ s.description = %q{This gem for change Mongoid id field as Integer like MySQL.}
+ s.files = Dir.glob("lib/**/*") + %w(README.md)
+ s.require_path = 'lib'
s.add_dependency "mongoid", ["~> 2.2.0"]
end
|
Fix install in bundler 1.1
|
diff --git a/core/module/ancestors_spec.rb b/core/module/ancestors_spec.rb
index abc1234..def5678 100644
--- a/core/module/ancestors_spec.rb
+++ b/core/module/ancestors_spec.rb
@@ -17,4 +17,23 @@ it "has 1 entry per module or class" do
ModuleSpecs::Parent.ancestors.should == ModuleSpecs::Parent.ancestors.uniq
end
+
+ describe "when called on a singleton class" do
+ it "includes the singleton classes of ancestors" do
+ Parent = Class.new
+ Child = Class.new(Parent)
+ SChild = Child.singleton_class
+
+ SChild.ancestors.should include(SChild,
+ Parent.singleton_class,
+ Object.singleton_class,
+ BasicObject.singleton_class,
+ Class,
+ Module,
+ Object,
+ Kernel,
+ BasicObject)
+
+ end
+ end
end
|
Add spec for ancestors on a singleton class
MRI 1.9 did not include the singleton classes in the list of ancestors
but 2.x does.
|
diff --git a/app/services/edition_publisher.rb b/app/services/edition_publisher.rb
index abc1234..def5678 100644
--- a/app/services/edition_publisher.rb
+++ b/app/services/edition_publisher.rb
@@ -1,12 +1,17 @@ class EditionPublisher < EditionService
def failure_reason
- @failure_reason ||= if !edition.valid?
- "This edition is invalid: #{edition.errors.full_messages.to_sentence}"
- elsif !can_transition?
- "An edition that is #{edition.current_state} cannot be #{past_participle}"
- elsif edition.scheduled_publication.present? && Time.zone.now < edition.scheduled_publication
- "This edition is scheduled for publication on #{edition.scheduled_publication.to_s}, and may not be #{past_participle} before"
- end
+ @failure_reason ||= failure_reasons.first
+ end
+
+ def failure_reasons
+ return @failure_reasons if @failure_reasons
+
+ reasons = []
+ reasons << "This edition is invalid: #{edition.errors.full_messages.to_sentence}" unless edition.valid?
+ reasons << "An edition that is #{edition.current_state} cannot be #{past_participle}" unless can_transition?
+ reasons << "This edition is scheduled for publication on #{edition.scheduled_publication.to_s}, and may not be #{past_participle} before" if scheduled_for_publication?
+
+ @failure_reasons = reasons
end
def verb
@@ -32,4 +37,8 @@ e.supersede! unless e == edition
end
end
+
+ def scheduled_for_publication?
+ edition.scheduled_publication.present? && Time.zone.now < edition.scheduled_publication
+ end
end
|
Rework EditionPublisher to expose multiple failure reasons.
|
diff --git a/obvious_data.gemspec b/obvious_data.gemspec
index abc1234..def5678 100644
--- a/obvious_data.gemspec
+++ b/obvious_data.gemspec
@@ -17,7 +17,7 @@ s.files = Dir["{app,config,db,lib}/**/*"] + ["MIT-LICENSE", "Rakefile", "README.md"]
s.test_files = Dir["spec/**/*"]
- s.add_dependency "rails", ">= 3.0.0", "< 5.0.0"
+ s.add_dependency "rails", ">= 3.2.0", "< 5.0.0"
s.add_development_dependency "pg", "~> 0.18"
s.add_development_dependency "rspec", "~> 3.4"
|
Drop support for Rails < 3.2
|
diff --git a/src/app/models/credential.rb b/src/app/models/credential.rb
index abc1234..def5678 100644
--- a/src/app/models/credential.rb
+++ b/src/app/models/credential.rb
@@ -36,5 +36,5 @@ validates_uniqueness_of :credential_definition_id, :scope => :provider_account_id
attr_protected :id, :provider_account_id, :created_at
- attr_accessible :value, :credential_definition_id
+ attr_accessible :value, :credential_definition_id, :credential_definition
end
|
Fix the new Provider Account form error
|
diff --git a/spec/requests/groups/prefs_spec.rb b/spec/requests/groups/prefs_spec.rb
index abc1234..def5678 100644
--- a/spec/requests/groups/prefs_spec.rb
+++ b/spec/requests/groups/prefs_spec.rb
@@ -0,0 +1,66 @@+require "spec_helper"
+
+describe "Group prefs" do
+
+ def get_field(name)
+ find_field(I18n.t("formtastic.labels.group_pref.#{name}"))
+ end
+
+ context "as a group member" do
+ include_context "signed in as a group member"
+
+ describe "editing the group preferences" do
+ it "should refuse" do
+ visit edit_group_prefs_path(current_group)
+ page.should have_content("You are not authorised to access that page.")
+ end
+ end
+ end
+
+ context "as a group committee member" do
+ include_context "signed in as a committee member"
+
+ describe "editing the group preferences" do
+ it "should be permitted" do
+ visit edit_group_prefs_path(current_group)
+ page.should have_content("Edit Preferences")
+ end
+
+ describe "membership notifications" do
+ let(:field) { get_field("notify_membership_requests") }
+
+ before do
+ visit edit_group_prefs_path(current_group)
+ end
+
+ it "should default to on" do
+ field.should be_checked
+ end
+
+ it "should let you turn them off" do
+ field.set false
+ click_on "Save"
+ page.should have_content(I18n.t(".group.prefs.update.success"))
+ current_group.reload
+ current_group.prefs.notify_membership_requests.should be_false
+ end
+ end
+
+ it "should let you pick a committee member as membership secretary"
+ it "should let you deselect the membership secretary"
+ it "should warn about blank emails"
+ end
+ end
+
+ context "as a site admin" do
+ include_context "signed in as admin"
+
+ describe "editing any group preferences she wants to" do
+ let(:group) { FactoryGirl.create(:quahogcc) }
+ it "should be permitted" do
+ visit edit_group_prefs_path(group)
+ page.should have_content("Edit Preferences")
+ end
+ end
+ end
+end
|
Add some tests for setting group preferences.
|
diff --git a/spec/requests/static_pages_spec.rb b/spec/requests/static_pages_spec.rb
index abc1234..def5678 100644
--- a/spec/requests/static_pages_spec.rb
+++ b/spec/requests/static_pages_spec.rb
@@ -40,7 +40,7 @@ expect(page).to have_title('Contact')
click_link "Home"
click_link "Sign up now!"
- expect(page).to have_title('Sign Up')
+ expect(page).to have_title('Sign up')
click_link "sample app"
expect(page).to have_title('Home')
end
|
Correct spec for static pages
|
diff --git a/db/migrate/20130117193334_remove_name_from_accounts.rb b/db/migrate/20130117193334_remove_name_from_accounts.rb
index abc1234..def5678 100644
--- a/db/migrate/20130117193334_remove_name_from_accounts.rb
+++ b/db/migrate/20130117193334_remove_name_from_accounts.rb
@@ -4,13 +4,13 @@ person = Person.find_by_email(a.email)
if person
person.name = "#{a.name} #{a.surname}"
- person.save!
+ person.save!(:validate => false)
else
a.person =
Person.create({:email => a.email,
:name => "#{a.name} #{a.surname}"},
- :without_protection => true)
- a.save!
+ :without_protection => true, :validate => false)
+ a.save!(:validate => false)
end
end
remove_column :accounts, [:name, :surname]
|
Make migration not validate against new validations
|
diff --git a/roles/security.rb b/roles/security.rb
index abc1234..def5678 100644
--- a/roles/security.rb
+++ b/roles/security.rb
@@ -6,5 +6,5 @@ "recipe[denyhosts]",
"recipe[iptables]",
"recipe[rubygems::ip_security]",
- "recipe[rubygems::iptables]",
+ "recipe[rubygems::iptables]"
)
|
Remove trailing comma in run_list
|
diff --git a/sad_panda.gemspec b/sad_panda.gemspec
index abc1234..def5678 100644
--- a/sad_panda.gemspec
+++ b/sad_panda.gemspec
@@ -21,5 +21,6 @@ spec.add_development_dependency "bundler", "~> 1.3"
spec.add_development_dependency "rake"
spec.add_runtime_dependency "ruby-stemmer"
+ spec.add_development_dependency "pry"
spec.add_development_dependency "rspec"
end
|
Add development dependency 'pry' to gemspec
|
diff --git a/partials/_default.rb b/partials/_default.rb
index abc1234..def5678 100644
--- a/partials/_default.rb
+++ b/partials/_default.rb
@@ -19,6 +19,8 @@ copy_static_file "lib/tasks/#{component}"
end
+get "https://raw.github.com/svenfuchs/rails-i18n/master/rails/locale/pt-BR.yml", "config/locales/pt-BR.yml"
+
gsub_file 'lib/tasks/deploy.rake', /PROJECT/, @app_name
gsub_file 'lib/tasks/integration.rake', /PROJECT/, @app_name
|
Add pt-BR locale file when bootstrapping
|
diff --git a/server/app/models/client.rb b/server/app/models/client.rb
index abc1234..def5678 100644
--- a/server/app/models/client.rb
+++ b/server/app/models/client.rb
@@ -1,5 +1,5 @@ class Client < ActiveRecord::Base
- has_many :metrics
+ has_many :metrics, :dependent => :destroy
accepts_nested_attributes_for :metrics, :allow_destroy => true
|
Set :dependent => :destroy on the has_many :metrics association
|
diff --git a/spec/scraper_spec.rb b/spec/scraper_spec.rb
index abc1234..def5678 100644
--- a/spec/scraper_spec.rb
+++ b/spec/scraper_spec.rb
@@ -13,6 +13,12 @@ new_releases.shipping_date.should_not be_nil
new_releases.categories.should_not be_empty
new_releases.comix.should_not be_empty
+ new_releases.comix.each_with_index { |comic, i|
+ comic.id.should_not be_nil
+ comic.rrp.should_not be_nil
+ comic.title.should_not be_nil
+ comic.category.should_not be_nil
+ }
end
it 'can get upcoming releases' do
@@ -22,6 +28,12 @@ upcoming_releases.shipping_date.should_not be_nil
upcoming_releases.categories.should_not be_empty
upcoming_releases.comix.should_not be_empty
+ upcoming_releases.comix.each_with_index { |comic, i|
+ comic.id.should_not be_nil
+ comic.rrp.should_not be_nil
+ comic.title.should_not be_nil
+ comic.category.should_not be_nil
+ }
end
end
|
Check content of each comic
|
diff --git a/app/converters/shopify/variant_converter.rb b/app/converters/shopify/variant_converter.rb
index abc1234..def5678 100644
--- a/app/converters/shopify/variant_converter.rb
+++ b/app/converters/shopify/variant_converter.rb
@@ -1,13 +1,14 @@ module Shopify
class VariantConverter
- def initialize(spree_variant, shopify_variant)
+ def initialize(spree_variant, shopify_variant, weight_unit = nil)
@spree_variant = spree_variant
@shopify_variant = shopify_variant
+ @weight_unit = weight_unit || default_weight_unit
end
def perform
shopify_variant.weight = spree_variant.weight
- shopify_variant.weight_unit = 'oz'
+ shopify_variant.weight_unit = weight_unit
shopify_variant.price = spree_variant.price
shopify_variant.sku = spree_variant.sku
shopify_variant.updated_at = spree_variant.updated_at
@@ -18,7 +19,7 @@
private
- attr_accessor :spree_variant, :shopify_variant
+ attr_accessor :spree_variant, :shopify_variant, :weight_unit
def generate_options!
assign_variant_uniqueness_constraint(spree_variant.sku)
@@ -31,5 +32,10 @@ def assign_variant_uniqueness_constraint(value)
shopify_variant.option1 = value
end
+
+ # NOTE: The weight_unit can be either 'g', 'kg, 'oz', or 'lb'.
+ def default_weight_unit
+ 'oz'
+ end
end
end
|
Add default value to the type of weight a variant has
|
diff --git a/test/dummy/test/unit/hickwell_test.rb b/test/dummy/test/unit/hickwell_test.rb
index abc1234..def5678 100644
--- a/test/dummy/test/unit/hickwell_test.rb
+++ b/test/dummy/test/unit/hickwell_test.rb
@@ -6,6 +6,6 @@ end
test "should have maskable_attribute foo" do
- assert @hickwell.foo.is_a? MaskableAttribute
+ assert @hickwell.foo.is_a?(MaskableAttribute), "Masked attribute isn't a MaskableAttribute"
end
end
|
Add Message to Dummy Hickwell Test
|
diff --git a/lib/merb-core/rack/adapter/ebb.rb b/lib/merb-core/rack/adapter/ebb.rb
index abc1234..def5678 100644
--- a/lib/merb-core/rack/adapter/ebb.rb
+++ b/lib/merb-core/rack/adapter/ebb.rb
@@ -11,12 +11,11 @@ #
# ==== Options (opts)
# :host<String>:: The hostname that Thin should serve.
- # :port<Fixnum>:: The port Thin should bind to.
- # :app<String>>:: The application name.
+ # :port<Fixnum>:: The port Ebb should bind to.
+ # :app:: The application
def self.start(opts={})
Merb.logger.warn!("Using Ebb adapter")
- server = ::Ebb::Server.new(opts[:app], opts)
- server.start
+ ::Ebb.start_server(opts[:app], opts)
end
end
end
|
Update Ebb adapter to work with latest Ebb 0.1.0 [Ry Dahl]
|
diff --git a/lib/monolith/locations/default.rb b/lib/monolith/locations/default.rb
index abc1234..def5678 100644
--- a/lib/monolith/locations/default.rb
+++ b/lib/monolith/locations/default.rb
@@ -7,7 +7,7 @@ # accessible, and then you have to guess how to check it out.
if File.directory?(@destination)
rel_dest = Monolith.formatter.rel_dir(@destination)
- Monolith.formatter.skip("#{rel_dest} already exists")
+ Monolith.formatter.skip(@cookbook, "#{rel_dest} already exists")
else
Monolith.formatter.install(@cookbook, @destination)
FileUtils.cp_r(@cookbook.path, @destination)
@@ -18,7 +18,7 @@ # There isn't anything to do for updating a community cookbook except
# blowing it away and recreating it. For the moment I'm opting not to do
# that (it may be able ot be an option later)
- Monolith.formatter.skip("Not updating community cookbook")
+ Monolith.formatter.skip(@cookbook, "Not updating community cookbook")
end
end
end
|
Fix formatting exception when skipping a community cookbook
|
diff --git a/lib/ossboard/core/http_request.rb b/lib/ossboard/core/http_request.rb
index abc1234..def5678 100644
--- a/lib/ossboard/core/http_request.rb
+++ b/lib/ossboard/core/http_request.rb
@@ -21,8 +21,6 @@
private
- attr_reader :uri
-
def http(uri)
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
|
Drop unnecessary line of code
|
diff --git a/app/overrides/add_delivery_costs_to_cart.rb b/app/overrides/add_delivery_costs_to_cart.rb
index abc1234..def5678 100644
--- a/app/overrides/add_delivery_costs_to_cart.rb
+++ b/app/overrides/add_delivery_costs_to_cart.rb
@@ -1,4 +1,4 @@ Deface::Override.new(:virtual_path => 'spree/orders/edit',
:name => 'add_delivery_costs_to_cart',
:insert_before => '[data-hook="outside_cart_form"]',
- :erb => "<p>Über die Versandkosten verdienen wir kein Geld. Wir berechnen lediglich die Kosten für Porto, Karton und Packpapier. Das sind <strong>4,50 € bei regulärem Versand</strong> (ab 50 € gratis) und <strong>7,90 € für gekühlte Produkte</strong> (ab 90 € gratis). Frischfleischversand ist teurer, da der Isolierkarton und die Kühlkissen entsprechend mehr kosten.</p>")+ :erb => "<p>Über die Versandkosten verdienen wir kein Geld. Wir berechnen lediglich die Kosten für Porto, Karton und Packpapier. Das sind <strong>4,90 € bei regulärem Versand</strong> (ab 60 € gratis) und <strong>7,90 € für gekühlte Produkte</strong> (ab 90 € gratis). Frischfleischversand ist teurer, da der Isolierkarton und die Kühlkissen entsprechend mehr kosten.</p>")
|
Change text for shipping costs.
|
diff --git a/lib/revision_analytics_service.rb b/lib/revision_analytics_service.rb
index abc1234..def5678 100644
--- a/lib/revision_analytics_service.rb
+++ b/lib/revision_analytics_service.rb
@@ -1,12 +1,14 @@ class RevisionAnalyticsService
def self.dyk_eligible
+ current_course_ids = Course.current.pluck(:id)
+ current_student_ids = CoursesUsers
+ .where(course_id: current_course_ids, role: 0)
+ .pluck(:user_id)
Article
.eager_load(:revisions)
- .eager_load(:courses)
- .references(:all)
- .where{ revisions.wp10 > 5 }
- .where{(namespace == 118) | ((namespace == 2) & (title !~ '%/%'))}
+ .where { revisions.wp10 > 30 }
+ .where(revisions: { user_id: current_student_ids })
+ .where { (namespace == 118) | ((namespace == 2) & ('title like %/%')) }
end
-
end
|
Update query for DYK feed
ArticlesCourses generally only get created for mainspace pages, so we can't use them as an indicator that a page is connected to a current course.
|
diff --git a/lib/workflows/workflow_helpers.rb b/lib/workflows/workflow_helpers.rb
index abc1234..def5678 100644
--- a/lib/workflows/workflow_helpers.rb
+++ b/lib/workflows/workflow_helpers.rb
@@ -3,7 +3,7 @@ module WorkflowHelper
private
- def try_services(*fns, success: success, failure: failure)
+ def try_services(*fns, success:, failure:)
Workflows::Workflow.call_each(*fns, success: success, failure: failure)
end
end
|
Fix warning so code works on Ruby 2.1, 2.3, 2.4
|
diff --git a/library/rbconfig/rbconfig_spec.rb b/library/rbconfig/rbconfig_spec.rb
index abc1234..def5678 100644
--- a/library/rbconfig/rbconfig_spec.rb
+++ b/library/rbconfig/rbconfig_spec.rb
@@ -1,11 +1,23 @@ require_relative '../../spec_helper'
require 'rbconfig'
-describe 'RbConfig::CONFIG values' do
- it 'are all strings' do
+describe 'RbConfig::CONFIG' do
+ it 'values are all strings' do
RbConfig::CONFIG.each do |k, v|
k.should be_kind_of String
v.should be_kind_of String
end
end
+
+ it "['rubylibdir'] returns the directory containing Ruby standard libraries" do
+ rubylibdir = RbConfig::CONFIG['rubylibdir']
+ File.directory?(rubylibdir).should == true
+ File.exist?("#{rubylibdir}/fileutils.rb").should == true
+ end
+
+ it "['archdir'] returns the directory containing standard libraries C extensions" do
+ archdir = RbConfig::CONFIG['archdir']
+ File.directory?(archdir).should == true
+ File.exist?("#{archdir}/etc.#{RbConfig::CONFIG['DLEXT']}").should == true
+ end
end
|
Add specs for some RbConfig::CONFIG values
* rubylibdir and archdir are used by Bootsnap:
https://github.com/Shopify/bootsnap/blob/2390a1a5/lib/bootsnap/explicit_require.rb
|
diff --git a/snow-math.gemspec b/snow-math.gemspec
index abc1234..def5678 100644
--- a/snow-math.gemspec
+++ b/snow-math.gemspec
@@ -11,11 +11,16 @@ s.authors = [ 'Noel Raymond Cower' ]
s.email = 'ncower@gmail.com'
s.files = Dir.glob('lib/**/*.rb') +
- Dir.glob('ext/**/*.{c,h,rb}')# +
- # [ 'COPYING', 'README.md' ]
+ Dir.glob('ext/**/*.{c,h,rb}') +
+ [ 'COPYING', 'README.md' ]
s.extensions << 'ext/extconf.rb'
s.homepage = 'https://github.com/nilium/ruby-snowmath'
s.license = 'Simplified BSD'
+ s.has_rdoc = true
+ s.extra_rdoc_files = [
+ 'README.md',
+ 'COPYING'
+ ]
s.rdoc_options << '--title' << 'snowmath -- 3D Math Types' <<
'--main' << 'README.md' <<
'--line-numbers'
|
Add extra files in gemspec.
|
diff --git a/test/integration/google_authenticator_test.rb b/test/integration/google_authenticator_test.rb
index abc1234..def5678 100644
--- a/test/integration/google_authenticator_test.rb
+++ b/test/integration/google_authenticator_test.rb
@@ -0,0 +1,37 @@+require 'test_helper'
+
+class GoogleAuthenticatorTest < ActionDispatch::IntegrationTest
+ test "should not be able to authenticate without otp" do
+ u = Factory.build(:user)
+ u.require_ga_otp = true
+ u.generate_ga_otp_secret
+ u.save!
+
+ # Authenticating without OTP will fail
+ post user_session_path, :user => {
+ :account => u.account,
+ :password => u.password
+ }
+
+ assert_response :success
+
+ # Wrong OTP should fail too
+ post user_session_path, :user => {
+ :account => u.account,
+ :password => u.password,
+ :ga_otp => "424242"
+ }
+
+ assert_response :success
+
+ # Correct OTP should work
+ post user_session_path, :user => {
+ :account => u.account,
+ :password => u.password,
+ :ga_otp => ROTP::TOTP.new(u.ga_otp_secret).now
+ }
+
+ assert_response :redirect
+ assert_redirected_to account_path
+ end
+end
|
Fix for a bug in Google Authenticator OTP check
|
diff --git a/spec/lita_spec.rb b/spec/lita_spec.rb
index abc1234..def5678 100644
--- a/spec/lita_spec.rb
+++ b/spec/lita_spec.rb
@@ -0,0 +1,39 @@+require "spec_helper"
+
+describe Lita do
+ it "memoizes a hash of Adapters" do
+ adapter_class = double("Adapter")
+ described_class.register_adapter(:foo, adapter_class)
+ expect(described_class.adapters[:foo]).to eql(adapter_class)
+ expect(described_class.adapters).to eql(described_class.adapters)
+ end
+
+ it "memoizes a set of Handlers" do
+ handler_class = double("Handler")
+ described_class.register_handler(handler_class)
+ described_class.register_handler(handler_class)
+ expect(described_class.handlers.to_a).to eq([handler_class])
+ expect(described_class.handlers).to eql(described_class.handlers)
+ end
+
+ it "memoizes a Config" do
+ expect(described_class.config).to be_a(Lita::Config)
+ expect(described_class.config).to eql(described_class.config)
+ end
+
+ describe ".redis" do
+ it "memoizes a Redis::Namespace" do
+ expect(described_class.redis.namespace).to eq(
+ described_class::REDIS_NAMESPACE
+ )
+ expect(described_class.redis).to eql(described_class.redis)
+ end
+ end
+
+ describe ".run" do
+ it "runs a new Robot" do
+ expect_any_instance_of(Lita::Robot).to receive(:run)
+ described_class.run
+ end
+ end
+end
|
Add spec for Lita module.
|
diff --git a/specs/optional.rb b/specs/optional.rb
index abc1234..def5678 100644
--- a/specs/optional.rb
+++ b/specs/optional.rb
@@ -34,8 +34,8 @@ owner = crew.owner
return nil unless owner
user = owner.user
- return user.name if user
- nil
+ return nil unless user
+ user.name
end
|
Refactor so it is more unique.
|
diff --git a/sprockets.gemspec b/sprockets.gemspec
index abc1234..def5678 100644
--- a/sprockets.gemspec
+++ b/sprockets.gemspec
@@ -10,9 +10,10 @@ s.add_dependency "rack", "~> 1.0"
s.add_dependency "tilt", ["~> 1.0", "!= 1.3.0"]
- s.add_development_dependency "execjs"
s.add_development_dependency "coffee-script"
s.add_development_dependency "ejs"
+ s.add_development_dependency "execjs"
+ s.add_development_dependency "rake"
s.authors = ["Sam Stephenson", "Joshua Peek"]
s.email = "sstephenson@gmail.com"
|
Add rake to dev deps
|
diff --git a/app/models/table_reservation.rb b/app/models/table_reservation.rb
index abc1234..def5678 100644
--- a/app/models/table_reservation.rb
+++ b/app/models/table_reservation.rb
@@ -9,7 +9,7 @@ private
def ended_at_greater_than_started_at
- if self.started_at > self.ended_at
+ if self.started_at && (self.started_at > self.ended_at)
self.errors.add(:started_at, "can't be greater than Ended at")
end
end
|
Fix validation in case, when started at is nil.
|
diff --git a/config/initializers/secret_token.rb b/config/initializers/secret_token.rb
index abc1234..def5678 100644
--- a/config/initializers/secret_token.rb
+++ b/config/initializers/secret_token.rb
@@ -4,4 +4,9 @@ # If you change this key, all old signed cookies will become invalid!
# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to dictionary attacks.
-Coursemology::Application.config.secret_token = ENV['APP_SECRET']
+Coursemology::Application.config.secret_token =
+ if Rails.env.development? or Rails.env.test?
+ '6646d49dfcbde9fd877fe9317c14d417a6d433e36b1694441029109af312b3dde6356f47b8b422389cabb8e9e65ac1c75ea8ebfa60b46b8708ff9945fa3f58e7'
+ else
+ ENV['APP_SECRET']
+ end
|
Set default secrets for development/test
|
diff --git a/lib/barcelona/network/auto_scaling_group.rb b/lib/barcelona/network/auto_scaling_group.rb
index abc1234..def5678 100644
--- a/lib/barcelona/network/auto_scaling_group.rb
+++ b/lib/barcelona/network/auto_scaling_group.rb
@@ -11,6 +11,10 @@ j.DesiredCapacity desired_capacity
j.Cooldown 0
j.HealthCheckGracePeriod 0
+ # * 2: When instances are being replaced, instance count temporarily becomes
+ # desired_count * 2
+ # + 1: There's a limitation "MinInstancesInService must be less than the autoscaling group's MaxSize"
+ # without + 1, ASG cannot satisfy this requirement when desired_count == 0
j.MaxSize(desired_capacity * 2 + 1)
j.MinSize desired_capacity
j.HealthCheckType "EC2"
|
Add comment about MaxSize number
|
diff --git a/lib/devise_ldap_authenticatable/strategy.rb b/lib/devise_ldap_authenticatable/strategy.rb
index abc1234..def5678 100644
--- a/lib/devise_ldap_authenticatable/strategy.rb
+++ b/lib/devise_ldap_authenticatable/strategy.rb
@@ -2,7 +2,7 @@
module Devise
module Strategies
- class LdapAuthenticatable < Autheneticatable
+ class LdapAuthenticatable < Authenticatable
# Tests whether the returned resource exists in the database and the
# credentials are valid. If the resource is in the database and the credentials
|
Fix class name for Devise::Authenticatable
|
diff --git a/lib/stacks/services/virtual_sftp_service.rb b/lib/stacks/services/virtual_sftp_service.rb
index abc1234..def5678 100644
--- a/lib/stacks/services/virtual_sftp_service.rb
+++ b/lib/stacks/services/virtual_sftp_service.rb
@@ -11,12 +11,6 @@ def configure
@downstream_services = []
@ports = [21, 22, 2222]
- end
-
- def ssh_dependant_instances_fqdns(networks = [:mgmt])
- virtual_service_children = get_children_for_virtual_services(virtual_services_that_depend_on_me)
- virtual_service_children.reject! { |machine_def| machine_def.class != Stacks::Services::AppServer }
- machine_defs_to_fqdns(virtual_service_children, networks).sort
end
def to_loadbalancer_config(location)
|
rpearce: Remove this function it has been replaced
|
diff --git a/mipt/app/controllers/teachers_controller.rb b/mipt/app/controllers/teachers_controller.rb
index abc1234..def5678 100644
--- a/mipt/app/controllers/teachers_controller.rb
+++ b/mipt/app/controllers/teachers_controller.rb
@@ -1,7 +1,7 @@ class TeachersController < ApplicationController
def index
- @teachers = Teacher.all
+ @teachers = Teacher.all.sort_by &:full_name
end
def show
|
Add sort by teacher name alphabetically on teacher show page
|
diff --git a/railties/lib/rails/tasks/dev.rake b/railties/lib/rails/tasks/dev.rake
index abc1234..def5678 100644
--- a/railties/lib/rails/tasks/dev.rake
+++ b/railties/lib/rails/tasks/dev.rake
@@ -1,7 +1,6 @@ namespace :dev do
+ desc 'Toggle development mode caching on/off'
task :cache do
- desc 'Toggle development mode caching on/off'
-
if File.exist? 'tmp/caching-dev.txt'
File.delete 'tmp/caching-dev.txt'
puts 'Development mode is no longer being cached.'
|
Move the desc one level up
Make the task visible (from rake -T) by moving the desc one level up
|
diff --git a/vagrant_base/nodejs/attributes/multi.rb b/vagrant_base/nodejs/attributes/multi.rb
index abc1234..def5678 100644
--- a/vagrant_base/nodejs/attributes/multi.rb
+++ b/vagrant_base/nodejs/attributes/multi.rb
@@ -1,3 +1,3 @@-default[:nodejs][:versions] = ["0.4.11", "0.5.5"]
-default[:nodejs][:aliases] = {"0.5.5".to_sym => "latest", "0.4.11".to_sym => "stable"}
-default[:nodejs][:default] = "0.4.11"
+default[:nodejs][:versions] = ["0.4.12", "0.5.8"]
+default[:nodejs][:aliases] = {"0.5.8".to_sym => "latest", "0.4.12".to_sym => "stable"}
+default[:nodejs][:default] = "0.4.12"
|
Update node.js versions to latest.
- Stable is now v0.4.12
- Unstable is now v0.5.8
|
diff --git a/lib/travis/scheduler/serialize/worker/config/addons.rb b/lib/travis/scheduler/serialize/worker/config/addons.rb
index abc1234..def5678 100644
--- a/lib/travis/scheduler/serialize/worker/config/addons.rb
+++ b/lib/travis/scheduler/serialize/worker/config/addons.rb
@@ -16,6 +16,7 @@ mariadb
postgresql
rethinkdb
+ sonarqube
ssh_known_hosts
)
|
Allow sonarqube addon on external PRs
In this case, addon runs without sensitive data
|
diff --git a/lib/awesome_print/formatters/simple_formatter.rb b/lib/awesome_print/formatters/simple_formatter.rb
index abc1234..def5678 100644
--- a/lib/awesome_print/formatters/simple_formatter.rb
+++ b/lib/awesome_print/formatters/simple_formatter.rb
@@ -0,0 +1,22 @@+require_relative 'base_formatter'
+
+module AwesomePrint
+ module Formatters
+ class SimpleFormatter < BaseFormatter
+
+ attr_reader :string, :type, :inspector, :options, :indentation
+
+ def initialize(string, type, inspector)
+ @string = string
+ @type = type
+ @inspector = inspector
+ @options = inspector.options
+ @indentation = @options[:indent].abs
+ end
+
+ def format
+ colorize(string, type)
+ end
+ end
+ end
+end
|
Add simple formatter for BigDecimal and his friends
|
diff --git a/lib/wulin_master/components/grid/grid_columns.rb b/lib/wulin_master/components/grid/grid_columns.rb
index abc1234..def5678 100644
--- a/lib/wulin_master/components/grid/grid_columns.rb
+++ b/lib/wulin_master/components/grid/grid_columns.rb
@@ -4,21 +4,19 @@
included do
class_eval do
- class << self
- attr_reader :columns_pool
- end
+ class_attribute :columns_pool
end
end
module ClassMethods
# Private - executed when class is subclassed
def initialize_columns
- @columns_pool ||= [Column.new(:id, self, {:visible => false, :editable => false, :sortable => true})]
+ self.columns_pool ||= [Column.new(:id, self, {:visible => false, :editable => false, :sortable => true})]
end
# Add a column
def column(name, options={})
- @columns_pool += [Column.new(name, self, options)]
+ self.columns_pool += [Column.new(name, self, options)]
end
# Remove columns for exactly screens
@@ -26,7 +24,7 @@ return unless scope[:screen].present?
r_columns = r_columns.map(&:to_s)
- @columns_pool.each do |column|
+ self.columns_pool.each do |column|
if r_columns.include? column.name.to_s
column.options[:except] = scope[:screen]
end
@@ -35,7 +33,7 @@
# For the old caller, in some old code, there some call like: +grid_class.columns+
def columns
- @columns_pool
+ self.columns_pool
end
end
|
Revert "MISC - use attr_reader i/o class_attribute for columns_pool"
This reverts commit ead8c75abbfc1cd6adb66dee63d21e1ed66f8cd6.
|
diff --git a/core/app/workers/migrate_fact_relation_activities_worker.rb b/core/app/workers/migrate_fact_relation_activities_worker.rb
index abc1234..def5678 100644
--- a/core/app/workers/migrate_fact_relation_activities_worker.rb
+++ b/core/app/workers/migrate_fact_relation_activities_worker.rb
@@ -12,13 +12,17 @@ end
def self.migrate_activity a, type
- fr = FactRelation.find(type: type, from_fact_id: a.subject.id,
- fact_id: a.object.id).first
+ if a.still_valid?
+ fr = FactRelation.find(type: type, from_fact_id: a.subject.id,
+ fact_id: a.object.id).first
- if fr
- a.subject = fr
- a.action = :created_fact_relation
- a.save!
+ if fr
+ a.subject = fr
+ a.action = :created_fact_relation
+ a.save!
+ else
+ a.delete
+ end
else
a.delete
end
|
Delete invalid activities in migration
|
diff --git a/core/enumerator/lazy/lazy_spec.rb b/core/enumerator/lazy/lazy_spec.rb
index abc1234..def5678 100644
--- a/core/enumerator/lazy/lazy_spec.rb
+++ b/core/enumerator/lazy/lazy_spec.rb
@@ -0,0 +1,11 @@+# -*- encoding: us-ascii -*-
+
+require File.expand_path('../../../../spec_helper', __FILE__)
+
+ruby_version_is "2.0" do
+ describe "Enumerator::Lazy" do
+ it "is a subclass of Enumerator" do
+ enumerator_class::Lazy.superclass.should equal(enumerator_class)
+ end
+ end
+end
|
Write a spec for Enumerator::Lazy
|
diff --git a/spec/adapter/simple_spec.rb b/spec/adapter/simple_spec.rb
index abc1234..def5678 100644
--- a/spec/adapter/simple_spec.rb
+++ b/spec/adapter/simple_spec.rb
@@ -7,6 +7,20 @@
client = Rack::Client::Simple.new(app)
client.get('/hitme').body.should == "rack-client #{Rack::Client::VERSION} (app: Proc)"
+ end
+ end
+
+ describe "HTTP_HOST" do
+ let(:app) { lambda {|env| [200, {}, [env['HTTP_HOST']]]} }
+
+ it 'adds the host as the hostname of REQUEST_URI' do
+ client = Rack::Client::Simple.new(app, 'http://example.org/')
+ client.get('/foo').body.should == 'example.org'
+ end
+
+ it 'adds the host and port for explicit ports in the REQUEST_URI' do
+ client = Rack::Client::Simple.new(app, 'http://example.org:81/')
+ client.get('/foo').body.should == 'example.org:81'
end
end
|
Add tests for the HTTP_HOST hedaer in the Simple adapter.
|
diff --git a/spec/dummy/config/routes.rb b/spec/dummy/config/routes.rb
index abc1234..def5678 100644
--- a/spec/dummy/config/routes.rb
+++ b/spec/dummy/config/routes.rb
@@ -4,7 +4,7 @@
resource :home, only: [:index, :show]
- match '/protected_page', to: 'home#show', as: :protected_page
+ get '/protected_page', to: 'home#show', as: :protected_page
root to: 'home#index'
end
|
Add http verb to protected page route
|
diff --git a/app/models/artist.rb b/app/models/artist.rb
index abc1234..def5678 100644
--- a/app/models/artist.rb
+++ b/app/models/artist.rb
@@ -11,19 +11,20 @@ Artist.all.shuffle[1]
end
- def assign_elo_points(artists)
+ def assign_elo_points(voted_artists)
k_factor = 32
- winner_expectation = calc_expectation(artists)
+ winner_expectation = calc_expectation(voted_artists)
loser_expectation = 1 - winner_expectation
- artists[:winner].elo_score += (k_factor * (1 - winner_expectation)).to_i
- artists[:loser].elo_score += (k_factor * (0 - loser_expectation)).to_i
+ voted_artists[:winner] += (k_factor * (1 - winner_expectation)).to_i
+ voted_artists[:loser] += (k_factor * (0 - loser_expectation)).to_i
+ return voted_artists
end
private
- def calc_expectation(artists)
- winner_score = artists[:winner].elo_score
- loser_score = artists[:loser].elo_score
+ def calc_expectation(voted_artists)
+ winner_score = voted_artists[:winner]
+ loser_score = voted_artists[:loser]
expectation_denominator =
1 + 10**((loser_score - winner_score)/400.0)
return 1.0/expectation_denominator
|
Remove references to database elo score in calculations
|
diff --git a/app/models/recipe.rb b/app/models/recipe.rb
index abc1234..def5678 100644
--- a/app/models/recipe.rb
+++ b/app/models/recipe.rb
@@ -7,11 +7,28 @@ # has_many :recipe_cuisines
# has_many :cuisines, through: :recipe_cuisines
belongs_to :cuisine
-
+ after_create :assign_course_names
+
def course_names
self.courses.collect{|course| course.name}
end
+ def assign_course_names
+ if !(self.course_names & Course::COURSES["Appetizers"]).empty?
+ self.appetizer = true
+ end
+ if !(self.course_names & Course::COURSES["Main Dishes"]).empty?
+ self.main = true
+ end
+ if !(self.course_names & Course::COURSES["Side Dishes"]).empty?
+ self.side = true
+ end
+ if !(self.course_names & Course::COURSES["Desserts"]).empty?
+ self.dessert = true
+ end
+ self.save
+ end
+
end
|
Add callback function to Recipe.
|
diff --git a/app/controllers/admin/invitation_controller.rb b/app/controllers/admin/invitation_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/admin/invitation_controller.rb
+++ b/app/controllers/admin/invitation_controller.rb
@@ -5,7 +5,7 @@
def update
invitation = Invitation.find_by(token: params[:invitation][:id])
- invitation.update_attributes(attending: true, verified: true, verified_by: current_user)
+ invitation.update(attending: true, verified: true, verified_by: current_user)
EventInvitationMailer.attending(invitation.event, invitation.member, invitation).deliver_now
@@ -14,7 +14,7 @@
def verify
invitation = Invitation.find_by(token: params[:invitation_id])
- invitation.update_attributes(verified: true, verified_by: current_user)
+ invitation.update(verified: true, verified_by_id: current_user.id)
EventInvitationMailer.attending(invitation.event, invitation.member, invitation).deliver_now
@@ -23,7 +23,7 @@
def cancel
invitation = Invitation.find_by(token: params[:invitation_id])
- invitation.update_attribute(:attending, false)
+ invitation.update(attending: false)
redirect_to :back, notice: "You have cancelled #{invitation.member.full_name}'s attendance."
end
|
Fix bullet unoptimised query error
```
Bullet::Notification::UnoptimizedQueryError:
user: despo
POST /admin/events/omnis-1/invitation/e5jkug2T-bpuY0Yeqegb3A/verify
AVOID eager loading detected
Invitation => [:verified_by]
Remove from your finder: :includes => [:verified_by]
```
|
diff --git a/app/controllers/admin/references_controller.rb b/app/controllers/admin/references_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/admin/references_controller.rb
+++ b/app/controllers/admin/references_controller.rb
@@ -11,7 +11,8 @@ end
def autocomplete
- @references = Reference.search(params[:query])
+ @references = Reference.search(params[:query]).
+ order(:citation)
@references.map! do |r|
{
:id => r.id,
|
Order autocomplete results by citation
|
diff --git a/test/cli/command/test_generator.rb b/test/cli/command/test_generator.rb
index abc1234..def5678 100644
--- a/test/cli/command/test_generator.rb
+++ b/test/cli/command/test_generator.rb
@@ -0,0 +1,91 @@+# frozen_string_literal: true
+
+require "helpers"
+
+# Tests for KBSecret::CLI::Command::Generator
+class KBSecretCommandGeneratorTest < Minitest::Test
+ include Helpers
+ include Helpers::CLI
+
+ def test_generator_help
+ generator_helps = [
+ %w[generator --help],
+ %w[generator -h],
+ %w[help generator],
+ ]
+
+ generator_helps.each do |generator_help|
+ stdout, = kbsecret(*generator_help)
+ assert_match "Usage:", stdout
+ end
+ end
+
+ def test_generator_too_few_arguments
+ _, stderr = kbsecret "generator"
+
+ assert_match "Too few arguments given", stderr
+
+ _, stderr = kbsecret "generator", "new"
+
+ assert_match "Too few arguments given", stderr
+ end
+
+ def test_generator_unknown_subcommand
+ _, stderr = kbsecret "generator", "made-up-subcommand", "foo"
+
+ assert_match "Unknown subcommand", stderr
+ end
+
+ def test_generator_new
+ kbsecret "generator", "new", "test-generator-new"
+
+ assert KBSecret::Config.generator?("test-generator-new")
+
+ kbsecret "generator", "new", "-F", "base64", "-l", "32", "test-generator-new-flags"
+
+ assert KBSecret::Config.generator?("test-generator-new-flags")
+ ensure
+ kbsecret "generator", "rm", "test-generator-new"
+ end
+
+ def test_generator_rm
+ kbsecret "generator", "new", "test-generator-rm"
+
+ assert KBSecret::Config.generator?("test-generator-rm")
+
+ kbsecret "generator", "rm", "test-generator-rm"
+
+ refute KBSecret::Config.generator?("test-generator-rm")
+ end
+
+ def test_generator_rm_fails_on_unknown_generator
+ _, stderr = kbsecret "generator", "rm", "this-should-not-exist"
+
+ assert_match "Unknown generator profile", stderr
+ end
+
+ def test_generator_fails_on_overwrite
+ kbsecret "generator", "new", "test-generator-overwrite-fail"
+ _, stderr = kbsecret "generator", "new", "test-generator-overwrite-fail"
+
+ assert_match "Refusing to overwrite an existing generator without --force", stderr
+ ensure
+ kbsecret "rm", "test-generator-overwrite-fail"
+ end
+
+ def test_generator_force_overwrite
+ kbsecret "generator", "new", "test-generator-overwrite", "-F", "base64", "-l", "32"
+
+ gen = KBSecret::Generator.new "test-generator-overwrite"
+
+ assert_equal :base64, gen.format
+ assert_equal 32, gen.length
+
+ kbsecret "generator", "new", "-f", "test-generator-overwrite", "-F", "hex", "-l", "16"
+
+ gen = KBSecret::Generator.new "test-generator-overwrite"
+
+ assert_equal :hex, gen.format
+ assert_equal 16, gen.length
+ end
+end
|
test/cli: Add tests for `kbsecret generator`
|
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.3'
+ s.version = '0.2.4'
s.authors = ['']
s.require_paths = ['lib']
s.files = Dir.glob('{lib}/**/*')
|
Package version increased from 0.2.3 to 0.2.4
|
diff --git a/spec/unit/resource/cron_d_spec.rb b/spec/unit/resource/cron_d_spec.rb
index abc1234..def5678 100644
--- a/spec/unit/resource/cron_d_spec.rb
+++ b/spec/unit/resource/cron_d_spec.rb
@@ -1,5 +1,5 @@ #
-# Copyright:: Copyright 2018, Chef Software, Inc.
+# Copyright:: Copyright 2018-2020, Chef Software, Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -33,4 +33,16 @@ it "the cron_name property is the name_property" do
expect(resource.cron_name).to eql("cronify")
end
+
+ it "the mode property defaults to '0600'" do
+ expect(resource.mode).to eql("0600")
+ end
+
+ it "the user property defaults to 'root'" do
+ expect(resource.user).to eql("root")
+ end
+
+ it "the command property is required" do
+ expect { resource.command nil }.to raise_error(Chef::Exceptions::ValidationFailed)
+ end
end
|
Add additional specs to the cron_d resource
Why not
Signed-off-by: Tim Smith <764ef62106582a09ed09dfa0b6bff7c05fd7d1e4@chef.io>
|
diff --git a/spec/functions/split_spec.rb b/spec/functions/split_spec.rb
index abc1234..def5678 100644
--- a/spec/functions/split_spec.rb
+++ b/spec/functions/split_spec.rb
@@ -10,7 +10,9 @@ expected_error = Puppet::ParseError
end
- if Puppet.version.to_f >= 4.0
+ if Puppet.version.to_f >= 4.3
+ expected_error_message = /expects \d+ arguments/
+ elsif Puppet.version.to_f >= 4.0
expected_error_message = /mis-matched arguments/
else
expected_error_message = /number of arguments/
|
Fix expected argument mismatch message on Puppet 4.3.0
The exception message raised under Puppet 4.3.0 for arity mismatches in
functions changed:
expected split("foo") to have raised ArgumentError matching /mis-matched arguments/
instead of ArgumentError('split' expects 2 arguments, got 1)
|
diff --git a/spec/generators/heat_spec.rb b/spec/generators/heat_spec.rb
index abc1234..def5678 100644
--- a/spec/generators/heat_spec.rb
+++ b/spec/generators/heat_spec.rb
@@ -0,0 +1,24 @@+# Copyright 2012 Red Hat, Inc.
+# Licensed under the Apache License, Version 2.0, see README for details.
+
+require 'spec_helper'
+require 'cbf'
+
+describe 'Heat generator' do
+ it "must produce a minimal Heat template" do
+ source = {
+ :description => 'sample template',
+ :parameters => [],
+ :resources => [],
+ }
+
+ template = CBF.generate(:heat, source)
+ template.wont_be_empty
+
+ parsed = JSON.parse(template)
+ parsed['Description'].must_equal(source[:description])
+ parsed.must_include 'Parameters'
+ parsed.must_include 'Resources'
+ parsed.must_include 'Outputs'
+ end
+end
|
Add a basic spec for the Heat generator
Signed-off-by: Tomas Sedovic <2bc6038c3dfca09b2da23c8b6da8ba884dc2dcc2@sedovic.cz>
|
diff --git a/features/step_definitions/lockfile_steps.rb b/features/step_definitions/lockfile_steps.rb
index abc1234..def5678 100644
--- a/features/step_definitions/lockfile_steps.rb
+++ b/features/step_definitions/lockfile_steps.rb
@@ -6,8 +6,12 @@ delete_path expand('$tmp').to_lockfile_path
end
-Then 'I get lockfile' do |content|
+Then 'a lockfile is created with:' do |content|
# For some reason, Cucumber drops the last newline from every docstring...
- File.open(expand('$tmp').to_lockfile_path, 'r').read().should ==
- (content == '' ? '' : expand(content) + "\n")
+ steps %Q{
+ Then the file "#{'.'.to_lockfile_path}" should contain exactly:
+ """
+ #{content == '' ? '' : expand(content) + "\n"}
+ """
+ }
end
|
Rewrite a step to verify a lockfile content
|
diff --git a/spec/controllers/distributors_controller_spec.rb b/spec/controllers/distributors_controller_spec.rb
index abc1234..def5678 100644
--- a/spec/controllers/distributors_controller_spec.rb
+++ b/spec/controllers/distributors_controller_spec.rb
@@ -4,13 +4,32 @@ describe Spree::DistributorsController do
include Spree::Core::CurrentOrder
+ before do
+ stub!(:before_save_new_order)
+ stub!(:after_save_new_order)
+ end
+
+
it "selects distributors" do
d = create(:distributor)
spree_get :select, :id => d.id
+ response.should be_redirect
order = current_order(false)
order.distributor.should == d
+ end
+
+ it "deselects distributors" do
+ d = create(:distributor)
+ order = current_order(true)
+ order.distributor = d
+ order.save!
+
+ spree_get :deselect
response.should be_redirect
+
+ order.reload
+ order.distributor.should be_nil
end
end
|
Add controller spec for deselecting distributors
|
diff --git a/event_store-client-http.gemspec b/event_store-client-http.gemspec
index abc1234..def5678 100644
--- a/event_store-client-http.gemspec
+++ b/event_store-client-http.gemspec
@@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = 'event_store-client-http'
- s.version = '0.4.0.0'
+ s.version = '0.4.0.1'
s.summary = 'HTTP Client for EventStore'
s.description = ' '
|
Package version is increased from 0.4.0.0 to 0.4.0.1
|
diff --git a/test/unit/null_store_test.rb b/test/unit/null_store_test.rb
index abc1234..def5678 100644
--- a/test/unit/null_store_test.rb
+++ b/test/unit/null_store_test.rb
@@ -0,0 +1,21 @@+require 'test_helper'
+
+class NullStoreTest < Minitest::Test
+ def store; @store ||= AccessToken::NullStore.new; end
+
+ test 'implements set' do
+ assert store.set('key', 'value', 3600)
+ end
+
+ test 'implements get' do
+ assert store.get('key')
+ end
+
+ test 'implements del' do
+ assert store.del('key')
+ end
+
+ test 'implements key?' do
+ assert store.key?('key')
+ end
+end
|
Add tests for null store.
|
diff --git a/Library/Formula/gnome-themes-standard.rb b/Library/Formula/gnome-themes-standard.rb
index abc1234..def5678 100644
--- a/Library/Formula/gnome-themes-standard.rb
+++ b/Library/Formula/gnome-themes-standard.rb
@@ -0,0 +1,25 @@+require 'formula'
+
+class GnomeThemesStandard < Formula
+ homepage 'http://gnome.org/'
+ url 'http://ftp.gnome.org/Public/GNOME/sources/gnome-themes-standard/3.12/gnome-themes-standard-3.12.0.tar.xz'
+ sha256 'a05d1b7ca872b944a69d0c0cc2369408ece32ff4355e37f8594a1b70d13c3217'
+
+ depends_on 'librsvg'
+ depends_on 'intltool' => :build
+ depends_on 'libsvg-cairo' => :build
+ depends_on 'pkg-config' => :build
+ depends_on 'gtk+' => :optional
+ depends_on 'gtk+3' => :recommended
+ depends_on 'gdk-pixbuf'
+
+ def install
+ args = []
+ args << "--disable-gtk2-engine" if build.without? 'gtk+'
+ args << "--disable-gtk3-engine" if build.without? 'gtk+3'
+
+ system "./configure", *args
+ ENV["GDK_PIXBUF_MODULEDIR"]="#{HOMEBREW_PREFIX}/lib/gdk-pixbuf-2.0/2.10.0/loaders"
+ system "make install"
+ end
+end
|
Add standard GNOME themes for gtk+3 and for gtk+ (optionally)
|
diff --git a/app/controllers/loc_search_controller.rb b/app/controllers/loc_search_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/loc_search_controller.rb
+++ b/app/controllers/loc_search_controller.rb
@@ -1,4 +1,7 @@ class LocSearchController < ApplicationController
+ before_filter :authenticate_user!
+ before_filter :check_librarian
+
def index
if params[:page].to_i <= 0
page = 1
@@ -36,4 +39,11 @@ end
end
end
+
+ private
+ def check_librarian
+ unless current_user.try(:has_role?, 'Librarian')
+ access_denied
+ end
+ end
end
|
Add a check if user is logged in and has a Librarian role.
|
diff --git a/app/decorators/kennedy/post_decorator.rb b/app/decorators/kennedy/post_decorator.rb
index abc1234..def5678 100644
--- a/app/decorators/kennedy/post_decorator.rb
+++ b/app/decorators/kennedy/post_decorator.rb
@@ -19,7 +19,7 @@
def categorized_url options={}
category = options[:category] || source.categories.first
- [category.try(:slug), source.slug].join('/')
+ [category.try(:slug), source.slug].compact.join('/')
end
def blog_slug
|
Remove addionial slash / in article url when no categories
|
diff --git a/app/presenters/consultation_presenter.rb b/app/presenters/consultation_presenter.rb
index abc1234..def5678 100644
--- a/app/presenters/consultation_presenter.rb
+++ b/app/presenters/consultation_presenter.rb
@@ -18,11 +18,11 @@ end
def next_appointment_date
- next_appointment.strftime('%F')
+ next_appointment&.strftime('%F')
end
def next_appointment_long_date
- next_appointment.strftime('%b %d, %Y')
+ next_appointment&.strftime('%b %d, %Y')
end
def next_appointment?
|
Fix certificates download without next appointment
|
diff --git a/lib/librato/rails/subscribers/controller.rb b/lib/librato/rails/subscribers/controller.rb
index abc1234..def5678 100644
--- a/lib/librato/rails/subscribers/controller.rb
+++ b/lib/librato/rails/subscribers/controller.rb
@@ -30,10 +30,10 @@ end
if http_method
- http_method.downcase!
+ verb = http_method.to_s.downcase!
r.group 'method' do |m|
- m.increment http_method
- m.timing "#{http_method}.time", event.duration
+ m.increment verb
+ m.timing "#{verb}.time", event.duration
end
end
|
Fix downcase issue on rails 4
|
diff --git a/lib/swagger_docs_generator/parser/parser.rb b/lib/swagger_docs_generator/parser/parser.rb
index abc1234..def5678 100644
--- a/lib/swagger_docs_generator/parser/parser.rb
+++ b/lib/swagger_docs_generator/parser/parser.rb
@@ -18,7 +18,7 @@ end
def temporary_file
- File.join(SwaggerDocsGenerator.temporary_folder, controller_json)
+ File.join(SwaggerDocsGenerator.temporary_folder, tmp_json)
end
private
@@ -27,8 +27,8 @@ @controller.controller_name
end
- def controller_json
- "#{controller_name}.json"
+ def tmp_json
+ "#{@tag_name}.json"
end
end
end
|
Use name tag for create temporary file
|
diff --git a/tomato_paste.gemspec b/tomato_paste.gemspec
index abc1234..def5678 100644
--- a/tomato_paste.gemspec
+++ b/tomato_paste.gemspec
@@ -10,13 +10,15 @@ spec.email = ["mariozig@gmail.com"]
spec.description = %q{A concentrated version of the Pomodoro technique written in Ruby just for you (and me)}
spec.summary = %q{A quick and dirty pomodoro timer}
- spec.homepage = ""
+ spec.homepage = "http://github.com/mariozig/tomato_paste"
spec.license = "MIT"
spec.files = `git ls-files`.split($/)
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]
+
+ spec.add_dependency "term-ansicolor"
spec.add_development_dependency "bundler", "~> 1.3"
spec.add_development_dependency "rake"
@@ -25,5 +27,4 @@ spec.add_development_dependency "guard-rspec"
spec.add_development_dependency "rb-fsevent"
spec.add_development_dependency "terminal-notifier-guard"
- spec.add_development_dependency "term-ansicolor"
end
|
Update gemspec with dependency and homepage
|
diff --git a/apache2/definitions/apache_site.rb b/apache2/definitions/apache_site.rb
index abc1234..def5678 100644
--- a/apache2/definitions/apache_site.rb
+++ b/apache2/definitions/apache_site.rb
@@ -24,7 +24,10 @@ execute "a2ensite #{params[:name]}" do
command "/usr/sbin/a2ensite #{params[:name]}"
notifies :restart, resources(:service => "apache2")
- not_if do File.symlink?("#{node[:apache][:dir]}/sites-enabled/#{params[:name]}") end
+ not_if do
+ File.symlink?("#{node[:apache][:dir]}/sites-enabled/#{params[:name]}") or
+ File.symlink?("#{node[:apache][:dir]}/sites-enabled/000-#{params[:name]}")
+ end
end
else
execute "a2dissite #{params[:name]}" do
|
Fix needless extra restarts by picking up 000 priority symlinks.
|
diff --git a/examples/sinatra/config/warble.rb b/examples/sinatra/config/warble.rb
index abc1234..def5678 100644
--- a/examples/sinatra/config/warble.rb
+++ b/examples/sinatra/config/warble.rb
@@ -10,4 +10,5 @@ require 'socket'
config.webxml.ENV_OUTPUT = File.expand_path('../../servers', __FILE__)
config.webxml.ENV_HOST = Socket.gethostname
+ config.webxml.jruby.rack.ignore.env = true
end
|
Make generated war ignore its environment
|
diff --git a/app/controllers/kuroko2/api/job_instances_controller.rb b/app/controllers/kuroko2/api/job_instances_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/kuroko2/api/job_instances_controller.rb
+++ b/app/controllers/kuroko2/api/job_instances_controller.rb
@@ -1,4 +1,3 @@-require 'api/job_instance_resource'
class Kuroko2::Api::JobInstancesController < Kuroko2::Api::ApplicationController
include Garage::RestfulActions
@@ -11,7 +10,7 @@ private
def require_resources
- protect_resource_as Api::JobInstanceResource
+ protect_resource_as ::Api::JobInstanceResource
end
def create_resource
@@ -29,7 +28,7 @@
def require_resource
instance = JobInstance.find(params[:id])
- @resource = Api::JobInstanceResource.new(instance)
+ @resource = ::Api::JobInstanceResource.new(instance)
end
def env_script
|
Stop require resource model and fix namespace
|
diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/home_controller.rb
+++ b/app/controllers/home_controller.rb
@@ -1,18 +1,17 @@ class HomeController < ApplicationController
def index
- @users = User.all
- clj = JRClj.new
- clj.inc 0
+# clj = JRClj.new
+# # clj.inc 0
- circle = JRClj.new "circle.init"
+ # circle = JRClj.new "circle.init"
- db = JRClj.new "circle.db"
- db.run "circle.db/init"
+ # db = JRClj.new "circle.db"
+ # db.run "circle.db/init"
- circle.run "circle.init/-main"
- circle.init
+ # circle.run "circle.init/-main"
+ # circle.init
- JRClj.new("circle.util.time").ju_now
+ # JRClj.new("circle.util.time").ju_now
end
end
|
Remove JRClj testing code from Home controller.
|
diff --git a/app/controllers/tail_controller.rb b/app/controllers/tail_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/tail_controller.rb
+++ b/app/controllers/tail_controller.rb
@@ -16,7 +16,7 @@ elsif params[:log] == "retrieve-content"
file = File.join([`echo $RSNA_ROOT`.strip,"logs","retrieve-content.log"])
else
- file = File.join([`echo $RSNA_ROOT`.strip,"glassfishv3","glassfish","domains","domain1","logs","server.log"])
+ file = File.join([`echo $RSNA_ROOT`.strip,"torquebox-3.x.incremental.1870","jboss","standalone","log","server.log"])
params[:log] = "token-app"
end
|
Use correct server log location
|
diff --git a/app/presenters/state_change_presenter.rb b/app/presenters/state_change_presenter.rb
index abc1234..def5678 100644
--- a/app/presenters/state_change_presenter.rb
+++ b/app/presenters/state_change_presenter.rb
@@ -20,7 +20,8 @@ 'authorised' => {"CaseWorker" => "Claim authorised", "Advocate" => "Your claim has been authorised"},
'part_authorised' => {"CaseWorker" => "Claim part authorised", "Advocate" => "Your claim has been part-authorised"},
'rejected' => {"CaseWorker" => "Claim rejected", "Advocate" => "Your claim has been rejected"},
- 'refused' => {"CaseWorker" => "Claim refused", "Advocate" => "Your claim has been refused"}
+ 'refused' => {"CaseWorker" => "Claim refused", "Advocate" => "Your claim has been refused"},
+ 'archived_pending_delete' => {"CaseWorker" => "Claim archived", "Advocate" => "Your claim has been archived"}
}
end
|
Add "archive_pending_delete" to state presenter
|
diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb
index abc1234..def5678 100644
--- a/spec/rails_helper.rb
+++ b/spec/rails_helper.rb
@@ -20,4 +20,6 @@ config.include ActiveSupport::Testing::TimeHelpers
config.include FactoryGirl::Syntax::Methods
config.include UserHelpers
+
+ config.after(:each) { ActionMailer::Base.deliveries.clear }
end
|
Clear deliveries after spec runs
|
diff --git a/applications/NPB/MPI/igor_mpi_intsort.rb b/applications/NPB/MPI/igor_mpi_intsort.rb
index abc1234..def5678 100644
--- a/applications/NPB/MPI/igor_mpi_intsort.rb
+++ b/applications/NPB/MPI/igor_mpi_intsort.rb
@@ -38,7 +38,7 @@
expect :mops_total
- $filtered = results{|t| t.select(:id, :mpibfs, :scale, :nnode, :ppn, :run_at, :run_time, :mops_total) }
+ $filtered = results{|t| t.select(:id, :problem, :nnode, :ppn, :run_at, :run_time, :mops_total, :mops_per_process) }
interact # enter interactive mode
end
|
Intsort: Fix igor script, add plot script.
|
diff --git a/config/initializers/sitemap_generator.rb b/config/initializers/sitemap_generator.rb
index abc1234..def5678 100644
--- a/config/initializers/sitemap_generator.rb
+++ b/config/initializers/sitemap_generator.rb
@@ -5,7 +5,7 @@ SitemapGenerator::Sitemap.adapter = SitemapGenerator::WaveAdapter.new
SitemapGenerator::Sitemap.create do
- UserGroup.find_each do |ug|
- add user_groups_path(ug)
- end
+ #UserGroup.find_each do |ug|
+ #add user_groups_path(ug)
+ #end
end
|
Disable SM generation of UG's for now
|
diff --git a/app/policies/application_policy.rb b/app/policies/application_policy.rb
index abc1234..def5678 100644
--- a/app/policies/application_policy.rb
+++ b/app/policies/application_policy.rb
@@ -26,34 +26,36 @@ false
end
- def logged_in?
- !!user
- end
-
- def owner?
- logged_in? && user.id == record.user_id
- end
-
- def moderator?
- logged_in? && 'moderator'.in?(user_roles)
- end
-
- def admin?
- logged_in? && 'admin'.in?(user_roles)
- end
-
- def user_roles
- (section_roles + zooniverse_roles).uniq
- end
-
- def section_roles
- return [] unless logged_in? && record.respond_to?(:section)
- user.roles.fetch record.section, []
- end
-
- def zooniverse_roles
- return [] unless logged_in?
- user.roles.fetch 'zooniverse', []
+ concerning :UserPredicates do
+ def logged_in?
+ !!user
+ end
+
+ def owner?
+ logged_in? && user.id == record.user_id
+ end
+
+ def moderator?
+ logged_in? && 'moderator'.in?(user_roles)
+ end
+
+ def admin?
+ logged_in? && 'admin'.in?(user_roles)
+ end
+
+ def user_roles
+ (section_roles + zooniverse_roles).uniq
+ end
+
+ def section_roles
+ return [] unless logged_in? && record.respond_to?(:section)
+ user.roles.fetch record.section, []
+ end
+
+ def zooniverse_roles
+ return [] unless logged_in?
+ user.roles.fetch 'zooniverse', []
+ end
end
def scope
@@ -61,6 +63,7 @@ end
class Scope
+ include UserPredicates
attr_reader :user, :scope
def initialize(user, scope)
|
Refactor to include policy user predicates into policy scopes
|
diff --git a/test/lib/ruby-prof/rails/profiles_mock_module.rb b/test/lib/ruby-prof/rails/profiles_mock_module.rb
index abc1234..def5678 100644
--- a/test/lib/ruby-prof/rails/profiles_mock_module.rb
+++ b/test/lib/ruby-prof/rails/profiles_mock_module.rb
@@ -44,9 +44,7 @@ end
def mock_request
- OpenStruct.new(
- session_options: {id: 1234}
- )
+ OpenStruct.new(session_options: {id: 1234})
end
def find_printer
|
Fix for one liner OpenStruct method
|
diff --git a/lib/versatile_rjs/proxy/framework_dependent.rb b/lib/versatile_rjs/proxy/framework_dependent.rb
index abc1234..def5678 100644
--- a/lib/versatile_rjs/proxy/framework_dependent.rb
+++ b/lib/versatile_rjs/proxy/framework_dependent.rb
@@ -24,7 +24,7 @@ implementation_class_name = [class_dirnames, framework_module, class_basename].flatten.join('::')
require implementation_class_name.underscore
- base.implementation_class = implementation_class_name.constantize
+ implementation_class_name.constantize
end
end
end
|
Fix to return simply class instance.
|
diff --git a/spec/support/command_execution.rb b/spec/support/command_execution.rb
index abc1234..def5678 100644
--- a/spec/support/command_execution.rb
+++ b/spec/support/command_execution.rb
@@ -3,18 +3,7 @@ module Spec
CommandExecution = Struct.new(:command, :working_directory, :exitstatus, :stdout, :stderr) do
def to_s
- c = Shellwords.shellsplit(command.strip).map {|s| s.include?("\n") ? " \\\n <<EOS\n#{s.gsub(/^/, " ").chomp}\nEOS" : Shellwords.shellescape(s) }
- c = c.reduce("") do |acc, elem|
- concat = acc + " " + elem
-
- last_line = concat.match(/.*\z/)[0]
- if last_line.size >= 100
- acc + " \\\n " + elem
- else
- concat
- end
- end
- "$ #{c.strip}"
+ "$ #{command}"
end
alias_method :inspect, :to_s
|
Remove stuff making errors harder to figure out
|
diff --git a/spec/features/likes_spec.rb b/spec/features/likes_spec.rb
index abc1234..def5678 100644
--- a/spec/features/likes_spec.rb
+++ b/spec/features/likes_spec.rb
@@ -0,0 +1,31 @@+require 'rails_helper'
+require 'spec_helper'
+
+RSpec.feature "Likes", type: :feature do
+ describe "With a single like" do
+ let!(:user_moderator){ FactoryGirl.create(:user_moderator) }
+ let!(:idea_approved){ FactoryGirl.create(:idea_approved) }
+ let!(:user){ FactoryGirl.create(:user) }
+
+
+ before :each do
+ page.set_rack_session(:user_id => user_moderator.id)
+ page.visit '/ideas?basket=Approved'
+ end
+
+ it "should not be liked at first" do
+ expect(page).to have_selector(:link_or_button, '0')
+ end
+
+ it "should be liked after clicking" do
+ click_on('0')
+ expect(page).to have_selector(:link_or_button, '1')
+ end
+ it "should be unliked after clicking again" do
+ click_on('0')
+ expect(page).to have_selector(:link_or_button, '1')
+ click_on('1')
+ expect(page).to have_selector(:link_or_button, '0')
+ end
+ end
+end
|
Add capybara tests for liking and dislike
|
diff --git a/spec/toy/connection_spec.rb b/spec/toy/connection_spec.rb
index abc1234..def5678 100644
--- a/spec/toy/connection_spec.rb
+++ b/spec/toy/connection_spec.rb
@@ -7,45 +7,41 @@ Toy.store.should == RedisStore
end
- it "should use the default store, if present" do
- remove_constants("Challenge")
- class Challenge
- include Toy::Store
- end
-
+ it "including Toy::Store should use the default store, if present" do
Toy.store = MongoStore
- Challenge.store.should == MongoStore
+ klass = Class.new { include Toy::Store }
+ klass.store.should == MongoStore
end
end
-
+
describe "logger" do
it "should set the default logger" do
logger = stub
Toy.logger = logger
Toy.logger.should == logger
end
-
+
it "should be an instance of Logger if not set" do
Toy.logger = nil
Toy.logger.should be_instance_of(Logger)
end
-
+
it "should use RAILS_DEFAULT_LOGGER if defined" do
remove_constants("RAILS_DEFAULT_LOGGER")
RAILS_DEFAULT_LOGGER = stub
-
+
Toy.logger = nil
Toy.logger.should == RAILS_DEFAULT_LOGGER
- end
+ end
end
-
+
describe "key_factory" do
it "should set the default key_factory" do
key_factory = stub
Toy.key_factory = key_factory
Toy.key_factory.should == key_factory
end
-
+
it "should default to the UUIDKeyFactory" do
Toy.key_factory = nil
Toy.key_factory.should be_instance_of(Toy::Identity::UUIDKeyFactory)
|
Use a simple dynamic class instead of constant stuff to test default store.
|
diff --git a/sqlserver_adapter.rb b/sqlserver_adapter.rb
index abc1234..def5678 100644
--- a/sqlserver_adapter.rb
+++ b/sqlserver_adapter.rb
@@ -1,6 +1,5 @@ require DataMapper.root / 'lib' / 'dm-core' / 'adapters' / 'data_objects_adapter'
-gem 'do_sqlserver', '~>0.0.1'
require 'do_sqlserver'
module DataMapper
|
Remove usage of RubyGems in newly added SQLServer adapter
Signed-off-by: Alex Coles <60c6d277a8bd81de7fdde19201bf9c58a3df08f4@alexcolesportfolio.com>
|
diff --git a/yaks/lib/yaks/html5_forms.rb b/yaks/lib/yaks/html5_forms.rb
index abc1234..def5678 100644
--- a/yaks/lib/yaks/html5_forms.rb
+++ b/yaks/lib/yaks/html5_forms.rb
@@ -50,7 +50,8 @@ step: nil,
list: nil,
placeholder: nil,
- checked: false
+ checked: false,
+ disabled: false
}
end
|
Add disabled to list of field attributes
|
diff --git a/lib/airbrush/processors/rmagick.rb b/lib/airbrush/processors/rmagick.rb
index abc1234..def5678 100644
--- a/lib/airbrush/processors/rmagick.rb
+++ b/lib/airbrush/processors/rmagick.rb
@@ -4,7 +4,7 @@ module Processors
class Rmagick < Processor
def resize(image, width, height)
- img = Magick::Image.read(image)
+ img = Magick::Image.from_blob(image).first
img.change_geometry("#{width}x#{height}") { |cols, rows, image| img.resize!(cols, rows) }
img.to_blob
end
|
Update use of RMagick API to read the image data from a blob since the content comes via arguments and not a local file
git-svn-id: 6d9b9a8f21f96071dc3ac7ff320f08f2a342ec80@33 daa9635f-4444-0410-9b3d-b8c75a019348
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.