als_typograf 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -23,7 +23,7 @@ end
23
23
  require 'rake/testtask'
24
24
  Rake::TestTask.new(:test) do |test|
25
25
  test.libs << 'lib' << 'test'
26
- test.pattern = 'test/**/test_*.rb'
26
+ test.pattern = 'test/**/*_test.rb'
27
27
  test.verbose = true
28
28
  end
29
29
 
@@ -31,7 +31,7 @@ begin
31
31
  require 'rcov/rcovtask'
32
32
  Rcov::RcovTask.new do |test|
33
33
  test.libs << 'test'
34
- test.pattern = 'test/**/test_*.rb'
34
+ test.pattern = 'test/**/*_test.rb'
35
35
  test.verbose = true
36
36
  end
37
37
  rescue LoadError
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.4
1
+ 0.0.5
data/als_typograf.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{als_typograf}
8
- s.version = "0.0.4"
8
+ s.version = "0.0.5"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Alexander Semyonov"]
@@ -31,8 +31,8 @@ Gem::Specification.new do |s|
31
31
  "test/database.yml",
32
32
  "test/helper.rb",
33
33
  "test/schema.rb",
34
- "test/test_als_typograf.rb",
35
- "test/test_article.rb"
34
+ "test/unit/als_typograf_test.rb",
35
+ "test/unit/article_test.rb"
36
36
  ]
37
37
  s.homepage = %q{http://github.com/rotuka/als_typograf}
38
38
  s.rdoc_options = ["--charset=UTF-8"]
@@ -41,9 +41,9 @@ Gem::Specification.new do |s|
41
41
  s.summary = %q{ArtLebedevStudio.RemoteTypograf}
42
42
  s.test_files = [
43
43
  "test/helper.rb",
44
- "test/test_als_typograf.rb",
45
44
  "test/schema.rb",
46
- "test/test_article.rb"
45
+ "test/unit/als_typograf_test.rb",
46
+ "test/unit/article_test.rb"
47
47
  ]
48
48
 
49
49
  if s.respond_to? :specification_version then
data/lib/als_typograf.rb CHANGED
@@ -2,11 +2,13 @@ $KCODE = 'u'
2
2
 
3
3
  require 'activesupport'
4
4
  require 'httparty'
5
- require 'als_typograf/request'
6
5
 
7
6
  # ruby-implementation of ArtLebedevStudio.RemoteTypograf class (web-service client)
8
7
  # @author Alexander Semyonov
9
8
  module AlsTypograf
9
+ autoload :Request, 'als_typograf/request'
10
+ autoload :ActiveRecord, 'als_typograf/active_record'
11
+
10
12
  HTML_ENTITIES = 1
11
13
  XML_ENTITIES = 2
12
14
  NO_ENTITIES = 3
@@ -6,7 +6,7 @@ module AlsTypograf
6
6
  self.class.typograf_fields.each do |column, options|
7
7
  send(:"#{column}=",
8
8
  AlsTypograf.process(send(column).to_s,
9
- options))
9
+ options)) if send(:"#{column}?") && send(:"#{column}_changed?")
10
10
  end
11
11
  end
12
12
  end
data/test/database.yml CHANGED
@@ -1,10 +1,10 @@
1
1
  sqlite:
2
2
  :adapter: sqlite
3
- :database: vendor/plugins/als_typograf/test/als_typograf_plugin.sqlite.db
3
+ :database: test/als_typograf_plugin.sqlite.db
4
4
 
5
5
  sqlite3:
6
6
  :adapter: sqlite3
7
- :database: vendor/plugins/als_typograf/test/als_typograf_plugin.sqlite3.db
7
+ :database: test/als_typograf_plugin.sqlite3.db
8
8
 
9
9
  postgresql:
10
10
  :adapter: postgresql
data/test/helper.rb CHANGED
@@ -1,28 +1,21 @@
1
- ENV['RAILS_ENV'] = 'test'
2
- ENV['RAILS_ROOT'] ||= File.join(File.dirname(__FILE__), '../../../..')
1
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
3
3
 
4
4
  require 'rubygems'
5
- require 'test/unit'
5
+ require 'activerecord'
6
6
  require 'shoulda'
7
7
  require 'redgreen' rescue nil
8
- require File.expand_path(File.join(ENV['RAILS_ROOT'], 'config/environment.rb'))
9
-
10
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
11
- $LOAD_PATH.unshift(File.dirname(__FILE__))
12
8
  require 'als_typograf'
9
+ require 'active_support/test_case'
13
10
 
14
- class Test::Unit::TestCase
11
+ class ActiveSupport::TestCase
15
12
  def self.process_assertions(assertions)
16
13
  assertions.each do |from, to|
17
14
  should "process '#{from}' to '#{to}'" do
18
- assert_equal to, process(from)
15
+ assert_equal to, AlsTypograf.process(from)
19
16
  end
20
17
  end
21
18
  end
22
-
23
- def process(text)
24
- AlsTypograf.process(text)
25
- end
26
19
  end
27
20
 
28
21
  def load_schema
@@ -34,7 +27,6 @@ def load_schema
34
27
  # no db passed, try one of these fine config-free DBs before bombing.
35
28
  db_adapter ||=
36
29
  begin
37
- require 'rubygems'
38
30
  require 'sqlite'
39
31
  'sqlite'
40
32
  rescue MissingSourceFile
@@ -1,10 +1,6 @@
1
1
  require 'helper'
2
2
 
3
- class TestAlsTypograf < Test::Unit::TestCase
4
-
5
- class Article < ActiveRecord::Base
6
- end
7
-
3
+ class AlsTypografTest < ActiveSupport::TestCase
8
4
  # TODO: need more tests or not?
9
5
  context 'with default configuration' do
10
6
  setup { AlsTypograf.default_options! }
@@ -1,6 +1,6 @@
1
1
  require 'helper'
2
- require 'als_typograf/active_record'
3
- require 'pp'
2
+ require 'shoulda/active_record/matchers'
3
+ require 'shoulda/active_record/macros'
4
4
 
5
5
  load_schema
6
6
 
@@ -10,11 +10,11 @@ class Article < ActiveRecord::Base
10
10
  typograf(:skills, :achievements, :description, :use_br => false)
11
11
  end
12
12
 
13
- class TestArticle < Test::Unit::TestCase
14
- def self.described_type; Article end
13
+ class ArticleTest < ActiveSupport::TestCase
14
+ extend Shoulda::ActiveRecord::Macros
15
15
 
16
16
  should_have_class_methods :typograf
17
- should_have_instance_methods :typograf_fields
17
+ should_have_instance_methods :typograf_fields, :typograf_current_fields
18
18
 
19
19
  should 'load schema correctly' do
20
20
  assert_equal [], Article.all
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: als_typograf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Semyonov
@@ -76,8 +76,8 @@ files:
76
76
  - test/database.yml
77
77
  - test/helper.rb
78
78
  - test/schema.rb
79
- - test/test_als_typograf.rb
80
- - test/test_article.rb
79
+ - test/unit/als_typograf_test.rb
80
+ - test/unit/article_test.rb
81
81
  has_rdoc: true
82
82
  homepage: http://github.com/rotuka/als_typograf
83
83
  licenses: []
@@ -108,6 +108,6 @@ specification_version: 3
108
108
  summary: ArtLebedevStudio.RemoteTypograf
109
109
  test_files:
110
110
  - test/helper.rb
111
- - test/test_als_typograf.rb
112
111
  - test/schema.rb
113
- - test/test_article.rb
112
+ - test/unit/als_typograf_test.rb
113
+ - test/unit/article_test.rb