Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix trailing spaces.

  • Loading branch information...
commit 3ee81cc182b1710a4f26b021c3f36d5d6e576c93 1 parent 1569d67
@threedaymonk threedaymonk authored
View
2  app/controllers/application_controller.rb
@@ -4,6 +4,6 @@ class ApplicationController < ActionController::Base
slimmer_template :admin
before_filter :authenticate_user!
-
+
# protect_from_forgery
end
View
2  app/models/related_item.rb
@@ -1,6 +1,6 @@
class RelatedItem < ActiveRecord::Base
belongs_to :source_artefact, :class_name => 'Artefact'
belongs_to :artefact, :counter_cache => true
-
+
validates_uniqueness_of :source_artefact_id, :scope => :artefact_id
end
View
2  config/initializers/messenger.rb
@@ -10,7 +10,7 @@
if defined?(PhusionPassenger)
PhusionPassenger.on_event(:starting_worker_process) do |forked|
if forked
- Messenger.transport = Stomp::Client.new stomp_url
+ Messenger.transport = Stomp::Client.new stomp_url
ActiveRecord::Base.marples_transport = Stomp::Client.new stomp_url
end
end
View
8 lib/bulk_section_setter.rb
@@ -1,11 +1,11 @@
class BulkSectionSetter
attr_accessor :artefacts
-
+
def initialize(filename, logger = nil)
@artefacts = load(filename)
@logger = logger || NullLogger.instance
end
-
+
def load(filename)
artefacts = []
section = nil
@@ -25,7 +25,7 @@ def load(filename)
end
artefacts
end
-
+
def set_all
@artefacts.each do |record|
artefact = Artefact.find_by_name(record[:title])
@@ -37,7 +37,7 @@ def set_all
@logger.info("Set '#{record[:title]}' to set section '#{section}'")
rescue => e
@logger.warn("Couldn't save '#{record[:title]}' because '#{e}'")
- end
+ end
else
@logger.warn("Couldn't find '#{record[:title]}' to set section '#{section}'")
end
View
12 lib/need_listener.rb
@@ -1,19 +1,19 @@
class NeedListener
-
+
def initialize
- @marples = Messenger.instance.client
+ @marples = Messenger.instance.client
end
-
+
def listen
Signal.trap('TERM') do
client.close
exit
end
-
+
listen_on_updated
@marples.join
- end
-
+ end
+
def listen_on_updated
@marples.when 'need-o-tron', 'needs', 'updated' do |need|
logger.info "Found need #{need}"
View
4 test/integration/integration_test_helper.rb
@@ -8,7 +8,7 @@
class ActionDispatch::IntegrationTest
include Capybara::DSL
self.use_transactional_fixtures = false
-
+
def setup
DatabaseCleaner.clean
end
@@ -16,7 +16,7 @@ def setup
def teardown
DatabaseCleaner.clean
end
-
+
end
Capybara.app = Rack::Builder.new do
View
4 test/unit/artefact_test.rb
@@ -6,13 +6,13 @@ class ArtefactTest < ActiveSupport::TestCase
a.valid?
assert a.errors[:slug].empty?
end
-
+
test "it doesn't allow apostrophes in slugs" do
a = Artefact.new(:slug => "it's-a-nice-day")
assert ! a.valid?
assert a.errors[:slug].any?
end
-
+
test "it doesn't allow spaces in slugs" do
a = Artefact.new(:slug => "it is-a-nice-day")
assert ! a.valid?
View
12 test/unit/bulk_section_setter_test.rb
@@ -5,34 +5,34 @@ class BulkSectionSetterTest < ActiveSupport::TestCase
def sample_bulk_section_settings_file
File.expand_path("../fixtures/sample_bulk_section_settings.txt", File.dirname(__FILE__))
end
-
+
test "Reads settings from a file" do
setter = BulkSectionSetter.new(sample_bulk_section_settings_file)
assert_equal 1, setter.artefacts.size
expected_artefact = {title: "Article Title", section: "Section", subsection: "SubSection"}
assert_equal expected_artefact, setter.artefacts.first
end
-
+
test "Apply section to artefacts which can be found" do
artefact = stub_everything("Article")
Artefact.expects(:find_by_name).with('Article Title').returns(artefact)
s = sequence("setting section")
artefact.expects(:section=).with("Section:SubSection").in_sequence(s)
artefact.expects(:save!).in_sequence(s)
-
+
setter = BulkSectionSetter.new(sample_bulk_section_settings_file)
setter.set_all
end
-
+
test "Keep a log of artefacts which could not be found" do
logger = stub("Logger")
Artefact.stubs(:find_by_name).returns(nil)
logger.expects(:warn).with("Couldn't find 'Article Title' to set section 'Section:SubSection'")
-
+
setter = BulkSectionSetter.new(sample_bulk_section_settings_file, logger)
setter.set_all
end
-
+
test "Catch validation errors on save" do
artefact = stub("Article")
artefact.stubs(:section=)
Please sign in to comment.
Something went wrong with that request. Please try again.