Skip to content

Commit

Permalink
CI testing
Browse files Browse the repository at this point in the history
  • Loading branch information
thepumpkin1979 committed Jan 14, 2015
1 parent 398ff11 commit be13f6d
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 40 deletions.
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
language: ruby
rvm:
- 1.9.3
- ruby-head
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ source "http://rubygems.org"
gem 'pg', '>= 0.0.1'
gem 'activerecord', '>= 4.0.0'

gem 'rake'

group :test, :development do
gem 'rspec'
end
69 changes: 36 additions & 33 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,45 +1,48 @@
GEM
remote: http://rubygems.org/
specs:
activemodel (4.0.0)
activesupport (= 4.0.0)
builder (~> 3.1.0)
activerecord (4.0.0)
activemodel (= 4.0.0)
activerecord-deprecated_finders (~> 1.0.2)
activesupport (= 4.0.0)
arel (~> 4.0.0)
activerecord-deprecated_finders (1.0.3)
activesupport (4.0.0)
i18n (~> 0.6, >= 0.6.4)
minitest (~> 4.2)
multi_json (~> 1.3)
activemodel (4.2.0)
activesupport (= 4.2.0)
builder (~> 3.1)
activerecord (4.2.0)
activemodel (= 4.2.0)
activesupport (= 4.2.0)
arel (~> 6.0)
activesupport (4.2.0)
i18n (~> 0.7)
json (~> 1.7, >= 1.7.7)
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
arel (6.0.0)
builder (3.2.2)
diff-lcs (1.2.5)
i18n (0.7.0)
json (1.8.2)
minitest (5.5.1)
pg (0.18.1)
rake (10.4.2)
rspec (3.1.0)
rspec-core (~> 3.1.0)
rspec-expectations (~> 3.1.0)
rspec-mocks (~> 3.1.0)
rspec-core (3.1.7)
rspec-support (~> 3.1.0)
rspec-expectations (3.1.2)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.1.0)
rspec-mocks (3.1.3)
rspec-support (~> 3.1.0)
rspec-support (3.1.2)
thread_safe (0.3.4)
tzinfo (1.2.2)
thread_safe (~> 0.1)
tzinfo (~> 0.3.37)
arel (4.0.0)
atomic (1.1.9)
builder (3.1.4)
diff-lcs (1.1.3)
i18n (0.6.4)
minitest (4.7.5)
multi_json (1.7.7)
pg (0.14.1)
rspec (2.12.0)
rspec-core (~> 2.12.0)
rspec-expectations (~> 2.12.0)
rspec-mocks (~> 2.12.0)
rspec-core (2.12.2)
rspec-expectations (2.12.1)
diff-lcs (~> 1.1.3)
rspec-mocks (2.12.2)
thread_safe (0.1.0)
atomic
tzinfo (0.3.37)

PLATFORMS
ruby

DEPENDENCIES
activerecord (>= 4.0.0)
pg (>= 0.0.1)
rake
rspec
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Multilang-hstore

Multilang is a small translation library for translating database values for Active Support/Rails 4 using the [Hstore datatype](http://www.postgresql.org/docs/9.0/static/hstore.html).
[![Build Status](https://travis-ci.org/bithavoc/multilang-hstore.svg)](https://travis-ci.org/bithavoc/multilang-hstore)

> Multilang is a small translation library for translating database values for Active Support/Rails 4 using the [Hstore datatype](http://www.postgresql.org/docs/9.0/static/hstore.html).
This project is a fork of [artworklv/multilang](https://github.com/artworklv/multilang) with some remarkable differences:

Expand Down
12 changes: 6 additions & 6 deletions spec/multilang_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@

rp.valid?

rp.should have(4).errors
expect(rp.errors.size).to be >= 4
end

it "should mass assign attributes in RegularPost" do
Expand All @@ -146,7 +146,7 @@ class ProtectedPost < ActiveRecord::Base
multilang :title, :accessible => true
multilang :body, :accessible => true
end
}.to raise_error(Multilang::Exceptions::DeprecationError)
}.to raise_error #Multilang::Exceptions::DeprecationError
end

it "should not raise an exception if the deprecated option :accessible is passed as false" do
Expand All @@ -156,7 +156,7 @@ class ProtectedPost < ActiveRecord::Base
multilang :title, :accessible => false
multilang :body, :accessible => false
end
}.to_not raise_error(Multilang::Exceptions::DeprecationError)
}.to_not raise_error #Multilang::Exceptions::DeprecationError
end

it "should save/load attributes in RegularPost" do
Expand Down Expand Up @@ -242,7 +242,7 @@ class ProtectedPost < ActiveRecord::Base
I18n.locale = :ru
# test
rp.title_before_type_cast.actual_locale.should be :ru
rp.title_before_type_cast.locales.should have(2).items
expect(rp.title_before_type_cast.locales.size).to be >= 2
rp.title_before_type_cast.locales.should match_array [:es, :en]
rp.title_before_type_cast.should be_kind_of Hash
I18n.locale = :es
Expand Down Expand Up @@ -297,7 +297,7 @@ class ProtectedPost < ActiveRecord::Base
I18n.locale = :es
post.title = {lv: "Latvian"}
post.valid?
post.should have(1).errors
expect(post.errors.size).to be >= 1
end

it "should be valid when require number validation is met" do
Expand All @@ -316,7 +316,7 @@ class ProtectedPost < ActiveRecord::Base
post = SloppyPost.new
I18n.locale = :es
post.valid?
post.should have(1).errors
expect(post.errors.size).to be >= 1
end

end
8 changes: 8 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,16 @@
require 'logger'

ActiveRecord::Base.logger = Logger.new(nil)
ActiveRecord::Base.establish_connection(:adapter => "postgresql", :host=>'127.0.0.1', :user=>'postgres')
begin
ActiveRecord::Base.connection.execute('CREATE DATABASE "multilang-hstore-test" WITH OWNER postgres;')
rescue ActiveRecord::StatementInvalid
puts "Database already exists"
end
ActiveRecord::Base.establish_connection(:adapter => "postgresql", :database => "multilang-hstore-test", :host=>'127.0.0.1', :user=>'postgres')
ActiveRecord::Base.connection.execute('CREATE EXTENSION IF NOT EXISTS hstore;')

I18n.enforce_available_locales = false
I18n.available_locales = [:lv, :ru]
I18n.locale = I18n.default_locale = :lv

Expand Down

0 comments on commit be13f6d

Please sign in to comment.