Skip to content
Browse files

add support for FactoryGirl traits

  • Loading branch information...
1 parent 9bba9f3 commit 466ef962294e3725be639ce7f22e200a570c34e1 @wireframe committed Sep 3, 2013
Showing with 15 additions and 8 deletions.
  1. +1 −0 .ruby-gemset
  2. +1 −0 .ruby-version
  3. +0 −1 .rvmrc
  4. +7 −1 README.md
  5. +1 −1 lib/factory_girl/rspec/version.rb
  6. +5 −5 lib/factory_girl/rspec/with.rb
View
1 .ruby-gemset
@@ -0,0 +1 @@
+factory_girl_rspec
View
1 .ruby-version
@@ -0,0 +1 @@
+ruby-2.0.0-p247
View
1 .rvmrc
@@ -1 +0,0 @@
-rvm use ruby-1.9.3@factory_girl_rspec --create
View
8 README.md
@@ -29,6 +29,12 @@ describe User do
it { user.should be_inactive }
it { user.should_not be_happy }
end
+
+ context 'when user is inactive' do
+ # instantiate FactoryGirl :user fixture with custom traits
+ with :user, :when_inactive
+ it { user.should be_inactive }
+ end
end
```
@@ -44,7 +50,7 @@ gem 'factory_girl_rspec'
```
## Contributing
-
+
* Fork the project
* Fix the issue
* Add unit tests
View
2 lib/factory_girl/rspec/version.rb
@@ -1,5 +1,5 @@
module FactoryGirl
module Rspec
- VERSION = "0.0.2"
+ VERSION = "1.0.0.beta"
end
end
View
10 lib/factory_girl/rspec/with.rb
@@ -3,12 +3,12 @@
module FactoryGirl
module Rspec
module With
- def with(name, options = {})
- let(name) { ::FactoryGirl.create(name, options) }
+ def with(name, *args)
+ let(name) { ::FactoryGirl.create(name, *args) }
end
-
- def with!(name, options = {})
- let!(name) { ::FactoryGirl.create(name, options) }
+
+ def with!(name, *args)
+ let!(name) { ::FactoryGirl.create(name, *args) }
end
end
end

0 comments on commit 466ef96

Please sign in to comment.
Something went wrong with that request. Please try again.