Skip to content

Commit

Permalink
Adding JRuby support to FactoryGirl
Browse files Browse the repository at this point in the history
  JRuby are affected by inconsistent behavior of overriding
  #respond_to? that is causing an unconditional call to
  #respond_to_missing.

  Current change does not affect MRI users in any way,
  JRuby-specific things are wrapped into the RUBY_PLATFORM
  check.

  Adding docs, modifying gemspec and travis.yml to make factory_girl to pass on Travis.

  Wire up tests
  • Loading branch information
ifesdjeen authored and joshuaclayton committed Jul 27, 2012
1 parent e038bf8 commit d48b760
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .travis.yml
@@ -1,9 +1,12 @@
rvm:
- 1.9.2
- 1.9.3
- jruby-19mode
before_install:
- gem update --system
script: "bundle exec rake spec:unit spec:acceptance features"
jdk:
- openjdk6
gemfile:
- gemfiles/3.0.gemfile
- gemfiles/3.1.gemfile
Expand Down
7 changes: 7 additions & 0 deletions GETTING_STARTED.md
Expand Up @@ -16,6 +16,13 @@ If you're *not* using Rails, you'll just have to change the required version of
gem "factory_girl", "~> 3.0"
```

JRuby users: FactoryGirl works with JRuby starting with 1.6.7.2 (latest stable, as per July 2012).
JRuby has to be used in 1.9 mode, for that, use JRUBY_OPTS environment variable:

```
export JRUBY_OPTS=--1.9
```

Once your Gemfile is updated, you'll want to update your bundle.

Using Without Bundler
Expand Down
5 changes: 5 additions & 0 deletions Gemfile.lock
Expand Up @@ -40,10 +40,14 @@ GEM
term-ansicolor (>= 1.0.6)
diff-lcs (1.1.3)
ffi (1.0.11)
ffi (1.0.11-java)
gherkin (2.9.3)
json (>= 1.4.6)
gherkin (2.9.3-java)
json (>= 1.4.6)
i18n (0.6.0)
json (1.7.0)
json (1.7.0-java)
metaclass (0.0.1)
mocha (0.10.5)
metaclass (~> 0.0.1)
Expand All @@ -70,6 +74,7 @@ GEM
yard (0.8.1)

PLATFORMS
java
ruby

DEPENDENCIES
Expand Down
9 changes: 8 additions & 1 deletion factory_girl.gemspec
Expand Up @@ -31,7 +31,14 @@ Gem::Specification.new do |s|
s.add_development_dependency("mocha")
s.add_development_dependency("bourne")
s.add_development_dependency("appraisal", "~> 0.4")
s.add_development_dependency("sqlite3-ruby")

if RUBY_PLATFORM == "java"
s.add_development_dependency("activerecord-jdbcsqlite3-adapter")
s.add_development_dependency("jdbc-sqlite3")
else
s.add_development_dependency("sqlite3-ruby")
end

s.add_development_dependency("yard")
end

5 changes: 5 additions & 0 deletions gemfiles/3.0.gemfile.lock
Expand Up @@ -39,10 +39,14 @@ GEM
term-ansicolor (>= 1.0.6)
diff-lcs (1.1.3)
ffi (1.0.11)
ffi (1.0.11-java)
gherkin (2.9.3)
json (>= 1.4.6)
gherkin (2.9.3-java)
json (>= 1.4.6)
i18n (0.5.0)
json (1.7.0)
json (1.7.0-java)
metaclass (0.0.1)
mocha (0.10.5)
metaclass (~> 0.0.1)
Expand All @@ -69,6 +73,7 @@ GEM
yard (0.8.1)

PLATFORMS
java
ruby

DEPENDENCIES
Expand Down
5 changes: 5 additions & 0 deletions gemfiles/3.1.gemfile.lock
Expand Up @@ -40,10 +40,14 @@ GEM
term-ansicolor (>= 1.0.6)
diff-lcs (1.1.3)
ffi (1.0.11)
ffi (1.0.11-java)
gherkin (2.9.3)
json (>= 1.4.6)
gherkin (2.9.3-java)
json (>= 1.4.6)
i18n (0.6.0)
json (1.7.0)
json (1.7.0-java)
metaclass (0.0.1)
mocha (0.10.5)
metaclass (~> 0.0.1)
Expand All @@ -70,6 +74,7 @@ GEM
yard (0.8.1)

PLATFORMS
java
ruby

DEPENDENCIES
Expand Down
5 changes: 5 additions & 0 deletions gemfiles/3.2.gemfile.lock
Expand Up @@ -40,10 +40,14 @@ GEM
term-ansicolor (>= 1.0.6)
diff-lcs (1.1.3)
ffi (1.0.11)
ffi (1.0.11-java)
gherkin (2.9.3)
json (>= 1.4.6)
gherkin (2.9.3-java)
json (>= 1.4.6)
i18n (0.6.0)
json (1.7.0)
json (1.7.0-java)
metaclass (0.0.1)
mocha (0.10.5)
metaclass (~> 0.0.1)
Expand All @@ -70,6 +74,7 @@ GEM
yard (0.8.1)

PLATFORMS
java
ruby

DEPENDENCIES
Expand Down

0 comments on commit d48b760

Please sign in to comment.