factory_group 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1e462366bdbd1227c623d68b9e8abf761c01912f
4
- data.tar.gz: 4601da9851bb63db4e6123487b0f310f15184a70
3
+ metadata.gz: 1bfcb45568576375988c682e459f52c626d73740
4
+ data.tar.gz: 56cdd4368d575dfed46ac5d87588c8946a784b71
5
5
  SHA512:
6
- metadata.gz: ba40e44705440369e611f051615091db6175a55a003a150bd9fc07adeea15112a6f7d502de664315cdc298cd261bf05c69340515e098de721c2b8f340142ed0c
7
- data.tar.gz: d8397a49ed4e5b065e06d09d23e398d6169b239c0cf00b0df26ef7f75863b6aaf2ef4474c8fd0bbc85619ad327fd35299ff47bcf46753c51bc65abc58eda4979
6
+ metadata.gz: e87bcecdb5d1dc0d1223c70223571dc99c25d8e1de7c677170d07c417397825bf45d785739d99e3ba15db67fb79142ae5e2221b944a064018f9a8b0f4cebc3a0
7
+ data.tar.gz: 51f402adead483fb2ff43fcc5f7aa29d473dd30c64573056ddd0093da523e15242e822811285e5dab395e01a8bf103ed03c1712248e811713090c50f2c884a19
@@ -0,0 +1,23 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ *.bundle
19
+ *.so
20
+ *.o
21
+ *.a
22
+ mkmf.log
23
+ .rspec
@@ -0,0 +1,3 @@
1
+ SimpleCov.start 'rails' do
2
+ # any custom configs like groups and filters can be here at a central place
3
+ end
@@ -0,0 +1,11 @@
1
+ rvm:
2
+ - 2.1.0
3
+ - 2.0.0-p481
4
+ - 1.9.3
5
+ before_install:
6
+ - gem update --system
7
+ install: "bundle install"
8
+ script: "CODECLIMATE_REPO_TOKEN=d3636dec3241cd9be3710d4de49e56b5cba3e56cb682dd0025600b67209520b0 bundle exec rspec spec/"
9
+ branches:
10
+ only:
11
+ - master
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in factory_group.gemspec
4
+ gemspec
5
+
6
+ gem "codeclimate-test-reporter", group: :test
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Yuvaraja Balamurugan
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,31 @@
1
+ # FactoryGroup
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/factory_group.svg)](http://badge.fury.io/rb/factory_group) [![Build Status](https://travis-ci.org/Codebrahma/factory_group.svg?branch=master)](https://travis-ci.org/Codebrahma/factory_group) [![Code Climate](https://codeclimate.com/github/Codebrahma/factory_group/badges/gpa.svg)](https://codeclimate.com/github/Codebrahma/factory_group) [![Dependency Status](https://gemnasium.com/Codebrahma/factory_group.svg)](https://gemnasium.com/Codebrahma/factory_group) [![Test Coverage](https://codeclimate.com/github/Codebrahma/factory_group/badges/coverage.svg)](https://codeclimate.com/github/Codebrahma/factory_group)
4
+
5
+ TODO: Write a gem description
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ gem 'factory_group'
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install factory_group
20
+
21
+ ## Usage
22
+
23
+ TODO: Write usage instructions here
24
+
25
+ ## Contributing
26
+
27
+ 1. Fork it ( https://github.com/[my-github-username]/factory_group/fork )
28
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
29
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
30
+ 4. Push to the branch (`git push origin my-new-feature`)
31
+ 5. Create a new Pull Request
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,30 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'factory_group/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "factory_group"
8
+ spec.version = FactoryGroup::VERSION
9
+ spec.authors = ["Yuvaraja Balamurugan"]
10
+ spec.email = ["yuv.slm@gmail.com"]
11
+ spec.summary = %q{Lets you create a group of factories}
12
+ spec.description = %q{Lets you create a group of factories which can be accessed from your specs}
13
+ spec.homepage = "http://codebrahma.com/factory_group/"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.required_ruby_version = '>= 1.9.3'
22
+
23
+ spec.add_runtime_dependency "factory_girl", ">= 4.4.0"
24
+
25
+ spec.add_development_dependency "rspec", ">= 2.13.0"
26
+ spec.add_development_dependency "bundler", ">= 1.6"
27
+ spec.add_development_dependency "rake", ">= 10.3.1"
28
+ spec.add_development_dependency "debugger", "~> 1.6.8"
29
+ spec.add_development_dependency "simplecov", "~> 0.9.0"
30
+ end
@@ -0,0 +1,21 @@
1
+ require "factory_group/version"
2
+ require "factory_group/group"
3
+
4
+ module FactoryGroup
5
+ @registry = {}
6
+
7
+ def self.registry
8
+ @registry
9
+ end
10
+
11
+ def self.define(name, &block)
12
+ group = Group.new
13
+ group.instance_eval(&block)
14
+ FactoryGroup.registry[name] = group
15
+ end
16
+
17
+ def self.create(name)
18
+ factory_group = registry[name]
19
+ factory_group.factories
20
+ end
21
+ end
@@ -0,0 +1,19 @@
1
+ require "factory_girl"
2
+ require "ostruct"
3
+
4
+ module FactoryGroup
5
+ class Group
6
+
7
+ def initialize
8
+ @factories = OpenStruct.new({})
9
+ end
10
+
11
+ attr_reader :factories
12
+
13
+ # Sets an instance variable with the name as the called method and
14
+ # assigns the args[0] passed to it.
15
+ def method_missing(name, *args, &block)
16
+ @factories.send("#{name.to_s}=", args[0])
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,3 @@
1
+ module FactoryGroup
2
+ VERSION = "0.0.3"
3
+ end
@@ -0,0 +1,5 @@
1
+ require "spec_helper"
2
+
3
+ describe FactoryGroup::Group do
4
+ pending "To write acceptance testing for FactoryGroup::Group"
5
+ end
@@ -0,0 +1,14 @@
1
+ require "spec_helper"
2
+
3
+ describe FactoryGroup::Group do
4
+ let(:group) { described_class.new }
5
+
6
+ before do
7
+ group.instance_eval do
8
+ user "name"
9
+ end
10
+ end
11
+ it "responds to the user method" do
12
+ expect(group.factories).to respond_to :user
13
+ end
14
+ end
@@ -0,0 +1,31 @@
1
+ require "spec_helper"
2
+
3
+ describe FactoryGroup do
4
+
5
+ let(:facory_group_definition) do
6
+ FactoryGroup.define(:user_group) do
7
+ user "A User"
8
+ end
9
+ end
10
+
11
+ context "#define" do
12
+ it "returns the result of evaluating the block passed to define method" do
13
+ expect(facory_group_definition).to be_an_instance_of FactoryGroup::Group
14
+ end
15
+
16
+ it "stores the created group in the registry" do
17
+ expect(described_class.registry).to have_key :user_group
18
+ end
19
+ end
20
+
21
+ context "#create" do
22
+ it "returns the created FactoryGroup::Group instance" do
23
+ expect(described_class.create(:user_group)).to be_an_instance_of OpenStruct
24
+ end
25
+
26
+ it "can be used to access the user variable" do
27
+ expect(described_class.create(:user_group).user).to eq "A User"
28
+ end
29
+ end
30
+
31
+ end
@@ -0,0 +1,16 @@
1
+ require "codeclimate-test-reporter"
2
+
3
+ CodeClimate::TestReporter.start
4
+
5
+ $LOAD_PATH << File.join(File.dirname(__FILE__), '..', 'lib')
6
+ $LOAD_PATH << File.join(File.dirname(__FILE__))
7
+
8
+ require 'rubygems'
9
+ require 'rspec'
10
+ require 'debugger'
11
+
12
+ require 'factory_group'
13
+
14
+ RSpec.configure do |config|
15
+
16
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: factory_group
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yuvaraja Balamurugan
@@ -101,7 +101,22 @@ email:
101
101
  executables: []
102
102
  extensions: []
103
103
  extra_rdoc_files: []
104
- files: []
104
+ files:
105
+ - .gitignore
106
+ - .simplecov
107
+ - .travis.yml
108
+ - Gemfile
109
+ - LICENSE.txt
110
+ - README.md
111
+ - Rakefile
112
+ - factory_group.gemspec
113
+ - lib/factory_group.rb
114
+ - lib/factory_group/group.rb
115
+ - lib/factory_group/version.rb
116
+ - spec/acceptance/group_spec.rb
117
+ - spec/factory_group/group_spec.rb
118
+ - spec/factory_group_spec.rb
119
+ - spec/spec_helper.rb
105
120
  homepage: http://codebrahma.com/factory_group/
106
121
  licenses:
107
122
  - MIT
@@ -114,7 +129,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
114
129
  requirements:
115
130
  - - '>='
116
131
  - !ruby/object:Gem::Version
117
- version: '0'
132
+ version: 1.9.3
118
133
  required_rubygems_version: !ruby/object:Gem::Requirement
119
134
  requirements:
120
135
  - - '>='
@@ -126,4 +141,8 @@ rubygems_version: 2.2.2
126
141
  signing_key:
127
142
  specification_version: 4
128
143
  summary: Lets you create a group of factories
129
- test_files: []
144
+ test_files:
145
+ - spec/acceptance/group_spec.rb
146
+ - spec/factory_group/group_spec.rb
147
+ - spec/factory_group_spec.rb
148
+ - spec/spec_helper.rb