factory_girl_bs_gen 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +15 -0
- data/.rspec +2 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +117 -0
- data/Rakefile +2 -0
- data/bin/factory_girl_bs_gen +5 -0
- data/factory_girl_bs_gen.gemspec +25 -0
- data/lib/factory_girl_bs_gen.rb +8 -0
- data/lib/factory_girl_bs_gen/cli.rb +18 -0
- data/lib/factory_girl_bs_gen/formatter.rb +8 -0
- data/lib/factory_girl_bs_gen/formatter/base.rb +25 -0
- data/lib/factory_girl_bs_gen/formatter/build_formatter.rb +11 -0
- data/lib/factory_girl_bs_gen/formatter/create_formatter.rb +11 -0
- data/lib/factory_girl_bs_gen/generator.rb +48 -0
- data/lib/factory_girl_bs_gen/reader.rb +9 -0
- data/lib/factory_girl_bs_gen/reader/base.rb +15 -0
- data/lib/factory_girl_bs_gen/reader/csv_reader.rb +13 -0
- data/lib/factory_girl_bs_gen/reader/json_reader.rb +8 -0
- data/lib/factory_girl_bs_gen/reader/yaml_reader.rb +8 -0
- data/lib/factory_girl_bs_gen/version.rb +3 -0
- data/spec/formatter_spec.rb +62 -0
- data/spec/generator_spec.rb +48 -0
- data/spec/reader_spec.rb +17 -0
- data/spec/sample_data/data.csv +4 -0
- data/spec/spec_helper.rb +89 -0
- data/wercker.yml +30 -0
- metadata +133 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: ab7db6bec4a09efa9ea84476fa8b16585333fc94
|
4
|
+
data.tar.gz: cb9873f048dd1d9fffcc8ce049b7d15658a62b0c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 03ca4555fab3b1004eace0ec5ec3f9fd6b1ffeb771dd154bebe71811fcb0ce597dc284ee3d62affe814f62e8d2163990f37dfed5567416a40fe511775ad941f5
|
7
|
+
data.tar.gz: 7564c59611bc65dea8fdb41ebd8a542938dde6b1a05448aae715744725e214b5e7dd109bb9940c4303c4908e39d6aa4a8be7f249251a36ddbea56572b3fa0075
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2015 fukuiretu
|
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.
|
data/README.md
ADDED
@@ -0,0 +1,117 @@
|
|
1
|
+
# FactoryGirlBsGen [![Code Climate](https://codeclimate.com/github/fukuiretu/factory_girl_bs_gen/badges/gpa.svg)](https://codeclimate.com/github/fukuiretu/factory_girl_bs_gen) [![wercker status](https://app.wercker.com/status/dface65b15dd77718d9422920db079a0/s "wercker status")](https://app.wercker.com/project/bykey/dface65b15dd77718d9422920db079a0)
|
2
|
+
TODO: Gem
|
3
|
+
|
4
|
+
|
5
|
+
## Overview
|
6
|
+
|
7
|
+
FactoryGirlBsGen = [factory_girl](https://github.com/thoughtbot/factory_girl) build syntax generater
|
8
|
+
|
9
|
+
The build syntax of [factory_girl](https://github.com/thoughtbot/factory_girl) from a file is CLI tool to generate.
|
10
|
+
Currently I only supports CSV.
|
11
|
+
|
12
|
+
|
13
|
+
|
14
|
+
## Installation
|
15
|
+
|
16
|
+
Add this line to your application's Gemfile:
|
17
|
+
|
18
|
+
```ruby
|
19
|
+
gem 'factory_girl_bs_gen'
|
20
|
+
```
|
21
|
+
|
22
|
+
And then execute:
|
23
|
+
|
24
|
+
$ bundle
|
25
|
+
|
26
|
+
Or install it yourself as:
|
27
|
+
|
28
|
+
$ gem install factory_girl_bs_gen
|
29
|
+
|
30
|
+
|
31
|
+
|
32
|
+
## Usage
|
33
|
+
|
34
|
+
```
|
35
|
+
$ factory_girl_bs_gen exec -t hoge -f data.csv -o factory_girl_bs_gen.out --format=build --omit_syntax=false
|
36
|
+
```
|
37
|
+
|
38
|
+
Input:
|
39
|
+
```csv:sample.csv
|
40
|
+
hoge,foo,bar
|
41
|
+
1,2,3
|
42
|
+
4,5,6
|
43
|
+
7,8,9
|
44
|
+
```
|
45
|
+
|
46
|
+
Output:
|
47
|
+
```
|
48
|
+
FactoryGirl.build(:hoge, hoge:1, foo:2, bar:3)
|
49
|
+
FactoryGirl.build(:hoge, hoge:4, foo:5, bar:6)
|
50
|
+
FactoryGirl.build(:hoge, hoge:7, foo:8, bar:9)
|
51
|
+
```
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
## CommandLine Option
|
56
|
+
<table>
|
57
|
+
<thead>
|
58
|
+
<td>Name</td>
|
59
|
+
<td>Alias</td>
|
60
|
+
<td>Type</td>
|
61
|
+
<td>Required</td>
|
62
|
+
<td>Setting</td>
|
63
|
+
<td>Remarks</td>
|
64
|
+
</thead>
|
65
|
+
<tbody>
|
66
|
+
<tr>
|
67
|
+
<td>--table</td>
|
68
|
+
<td>-t</td>
|
69
|
+
<td>string</td>
|
70
|
+
<td>true</td>
|
71
|
+
<td>table name</td>
|
72
|
+
<td>-</td>
|
73
|
+
</tr>
|
74
|
+
<tr>
|
75
|
+
<td>--file</td>
|
76
|
+
<td>-f</td>
|
77
|
+
<td>string</td>
|
78
|
+
<td>true</td>
|
79
|
+
<td>input csv file</td>
|
80
|
+
<td>-</td>
|
81
|
+
</tr>
|
82
|
+
<tr>
|
83
|
+
<td>--format</td>
|
84
|
+
<td>none</td>
|
85
|
+
<td>string</td>
|
86
|
+
<td>true</td>
|
87
|
+
<td>create | build</td>
|
88
|
+
<td>specifies the format of the output after</td>
|
89
|
+
</tr>
|
90
|
+
<tr>
|
91
|
+
<td>--output</td>
|
92
|
+
<td>-o</td>
|
93
|
+
<td>string</td>
|
94
|
+
<td>false</td>
|
95
|
+
<td>output file name</td>
|
96
|
+
<td>specify if you want to output the output results to a file. If not specified, the stdout.</td>
|
97
|
+
</tr>
|
98
|
+
<tr>
|
99
|
+
<td>--omit_syntax</td>
|
100
|
+
<td>none</td>
|
101
|
+
<td>boolean</td>
|
102
|
+
<td>false</td>
|
103
|
+
<td>true | false</td>
|
104
|
+
<td>enable an abbreviated notation. Ex: FactoryGirl.build -> build</td>
|
105
|
+
</tr>
|
106
|
+
</tbody>
|
107
|
+
</table>
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
## Contributing
|
112
|
+
|
113
|
+
1. Fork it ( https://github.com/[my-github-username]/factory_girl_bs_gen/fork )
|
114
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
115
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
116
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
117
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'factory_girl_bs_gen/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "factory_girl_bs_gen"
|
8
|
+
spec.version = FactoryGirlBsGen::VERSION
|
9
|
+
spec.authors = ["fukuiretu"]
|
10
|
+
spec.email = ["s0232101@gmail.com"]
|
11
|
+
spec.summary = "FactoryGirl build syntax generator"
|
12
|
+
spec.homepage = "https://github.com/fukuiretu/factory_girl_bs_gen"
|
13
|
+
spec.license = "MIT"
|
14
|
+
|
15
|
+
spec.files = `git ls-files -z`.split("\x0")
|
16
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
17
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
|
+
spec.require_paths = ["lib"]
|
19
|
+
|
20
|
+
spec.add_development_dependency "bundler", "~> 1.7"
|
21
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
22
|
+
spec.add_development_dependency "rspec"
|
23
|
+
|
24
|
+
spec.add_dependency 'thor'
|
25
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'thor'
|
2
|
+
|
3
|
+
module FactoryGirlBsGen
|
4
|
+
class CLI < Thor
|
5
|
+
|
6
|
+
desc "factory_girl_bs_gen -f /path/to/hoge.csv", "factory_girl bulid syntax generator"
|
7
|
+
option :table, type: :string, aliases: '-t', desc: "target table name", required: true
|
8
|
+
option :file, type: :string, aliases: '-f', desc: "target file is csv", required: true
|
9
|
+
option :format, type: :string, desc: "target table name", required: true
|
10
|
+
option :output, type: :string, aliases: '-o', desc: "output"
|
11
|
+
option :omit_syntax, type: :boolean, desc: "And omit the syntax"
|
12
|
+
def exec
|
13
|
+
Generator.new(
|
14
|
+
options
|
15
|
+
).gen
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module FactoryGirlBsGen
|
2
|
+
module Formatter
|
3
|
+
class Base
|
4
|
+
FACTORY_GIRL_SYNTAX = "FactoryGirl"
|
5
|
+
|
6
|
+
def format(table, column_names, row, omit_syntax)
|
7
|
+
key_values =
|
8
|
+
[].tap do |arr|
|
9
|
+
column_names.each_with_index do |v, i|
|
10
|
+
arr << "#{v}:#{row[i]}"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
''.tap do |str|
|
15
|
+
str << "#{FACTORY_GIRL_SYNTAX}." unless omit_syntax
|
16
|
+
str << sprintf(template, {table: table, values: key_values.join(", ")})
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def template
|
21
|
+
raise NotImplementedError
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
module FactoryGirlBsGen
|
2
|
+
class Generator
|
3
|
+
attr_reader :options
|
4
|
+
|
5
|
+
def initialize(options = {})
|
6
|
+
@options = options
|
7
|
+
|
8
|
+
file = options[:file]
|
9
|
+
extension = File.extname(file).split(".").last
|
10
|
+
@reader =
|
11
|
+
Object.const_get("FactoryGirlBsGen::Reader::#{extension.capitalize}Reader").new(file)
|
12
|
+
@formatter =
|
13
|
+
Object.const_get("FactoryGirlBsGen::Formatter::#{@options[:format].capitalize}Formatter").new
|
14
|
+
end
|
15
|
+
|
16
|
+
def gen
|
17
|
+
resources = read
|
18
|
+
write(resources[0], resources[1..-1])
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def read
|
24
|
+
@reader.read
|
25
|
+
end
|
26
|
+
|
27
|
+
def write(header, records)
|
28
|
+
out_records = []
|
29
|
+
records.each do |v|
|
30
|
+
out_records << @formatter.format(
|
31
|
+
@options[:table],
|
32
|
+
header,
|
33
|
+
v,
|
34
|
+
@options[:omit_syntax]
|
35
|
+
)
|
36
|
+
end
|
37
|
+
|
38
|
+
if @options[:output]
|
39
|
+
File.write(options[:output], out_records.join("\n"))
|
40
|
+
else
|
41
|
+
puts "outputs:\n"
|
42
|
+
out_records.each do |v|
|
43
|
+
puts "\t" << v
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'factory_girl_bs_gen'
|
3
|
+
|
4
|
+
describe FactoryGirlBsGen::Formatter::CreateFormatter do
|
5
|
+
let(:formatter) { FactoryGirlBsGen::Formatter::CreateFormatter.new }
|
6
|
+
let(:omit_syntax) { false }
|
7
|
+
|
8
|
+
context '#template' do
|
9
|
+
it 'templateが正しいこと' do
|
10
|
+
expect("create(:%{table}, %{values})").to eq formatter.template
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
context '#format' do
|
15
|
+
it 'formatが正しいこと' do
|
16
|
+
table = 'table_name'
|
17
|
+
column_names = ['hoge', 'foo', 'bar']
|
18
|
+
row = [1, 2, 3]
|
19
|
+
expect(formatter.format(table, column_names, row, omit_syntax)).to eq "FactoryGirl.create(:table_name, hoge:1, foo:2, bar:3)"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
context '#format' do
|
24
|
+
it 'formatが省略記法で正しいこと' do
|
25
|
+
table = 'table_name'
|
26
|
+
column_names = ['hoge', 'foo', 'bar']
|
27
|
+
row = [1, 2, 3]
|
28
|
+
omit_syntax = true
|
29
|
+
expect(formatter.format(table, column_names, row, omit_syntax)).to eq "create(:table_name, hoge:1, foo:2, bar:3)"
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
describe FactoryGirlBsGen::Formatter::BuildFormatter do
|
35
|
+
let(:formatter) { FactoryGirlBsGen::Formatter::BuildFormatter.new }
|
36
|
+
let(:omit_syntax) { false }
|
37
|
+
|
38
|
+
context '#template' do
|
39
|
+
it 'templateが正しいこと' do
|
40
|
+
expect("build(:%{table}, %{values})").to eq formatter.template
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
context '#format' do
|
45
|
+
it 'formatが正しいこと' do
|
46
|
+
table = 'table_name'
|
47
|
+
column_names = ['hoge', 'foo', 'bar']
|
48
|
+
row = [1, 2, 3]
|
49
|
+
expect(formatter.format(table, column_names, row, omit_syntax)).to eq "FactoryGirl.build(:table_name, hoge:1, foo:2, bar:3)"
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
context '#format' do
|
54
|
+
it 'formatが省略記法で正しいこと' do
|
55
|
+
table = 'table_name'
|
56
|
+
column_names = ['hoge', 'foo', 'bar']
|
57
|
+
row = [1, 2, 3]
|
58
|
+
omit_syntax = true
|
59
|
+
expect(formatter.format(table, column_names, row, omit_syntax)).to eq "build(:table_name, hoge:1, foo:2, bar:3)"
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'factory_girl_bs_gen'
|
3
|
+
require 'stringio'
|
4
|
+
|
5
|
+
describe FactoryGirlBsGen::Generator do
|
6
|
+
let(:generator) do
|
7
|
+
FactoryGirlBsGen::Generator.new(
|
8
|
+
{
|
9
|
+
table: "hoge",
|
10
|
+
file: "spec/sample_data/data.csv",
|
11
|
+
format: "build",
|
12
|
+
output: o
|
13
|
+
}
|
14
|
+
)
|
15
|
+
end
|
16
|
+
|
17
|
+
context '標準出力が期待通りか' do
|
18
|
+
let(:o) { nil }
|
19
|
+
let(:answer) do
|
20
|
+
''.tap do |v|
|
21
|
+
v << "outputs:\n"
|
22
|
+
v << "\tFactoryGirl.build(:hoge, hoge:1, foo:2, bar:3)\n"
|
23
|
+
v << "\tFactoryGirl.build(:hoge, hoge:4, foo:5, bar:6)\n"
|
24
|
+
v << "\tFactoryGirl.build(:hoge, hoge:7, foo:8, bar:9)\n"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
it '#gen' do
|
29
|
+
expect { generator.gen }.to output(answer).to_stdout
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
context 'ファイル出力が期待通りか' do
|
34
|
+
let(:o) { '/tmp/factory_girl_bs_gen_test' }
|
35
|
+
let(:answer) do
|
36
|
+
''.tap do |v|
|
37
|
+
v << "FactoryGirl.build(:hoge, hoge:1, foo:2, bar:3)\n"
|
38
|
+
v << "FactoryGirl.build(:hoge, hoge:4, foo:5, bar:6)\n"
|
39
|
+
v << "FactoryGirl.build(:hoge, hoge:7, foo:8, bar:9)"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
it '#gen' do
|
44
|
+
generator.gen
|
45
|
+
expect(File.read(o)).to eq answer
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
data/spec/reader_spec.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'factory_girl_bs_gen'
|
3
|
+
|
4
|
+
describe FactoryGirlBsGen::Reader::CsvReader do
|
5
|
+
let(:reader) { FactoryGirlBsGen::Reader::CsvReader.new("spec/sample_data/data.csv") }
|
6
|
+
|
7
|
+
context '#read' do
|
8
|
+
it 'readable csv file' do
|
9
|
+
expect([
|
10
|
+
['hoge', 'foo', 'bar'],
|
11
|
+
['1', '2', '3'],
|
12
|
+
['4', '5', '6'],
|
13
|
+
['7', '8', '9']
|
14
|
+
]).to eq reader.read
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
2
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
3
|
+
# The generated `.rspec` file contains `--require spec_helper` which will cause this
|
4
|
+
# file to always be loaded, without a need to explicitly require it in any files.
|
5
|
+
#
|
6
|
+
# Given that it is always loaded, you are encouraged to keep this file as
|
7
|
+
# light-weight as possible. Requiring heavyweight dependencies from this file
|
8
|
+
# will add to the boot time of your test suite on EVERY test run, even for an
|
9
|
+
# individual file that may not need all of that loaded. Instead, consider making
|
10
|
+
# a separate helper file that requires the additional dependencies and performs
|
11
|
+
# the additional setup, and require it from the spec files that actually need it.
|
12
|
+
#
|
13
|
+
# The `.rspec` file also contains a few flags that are not defaults but that
|
14
|
+
# users commonly want.
|
15
|
+
#
|
16
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
17
|
+
RSpec.configure do |config|
|
18
|
+
# rspec-expectations config goes here. You can use an alternate
|
19
|
+
# assertion/expectation library such as wrong or the stdlib/minitest
|
20
|
+
# assertions if you prefer.
|
21
|
+
config.expect_with :rspec do |expectations|
|
22
|
+
# This option will default to `true` in RSpec 4. It makes the `description`
|
23
|
+
# and `failure_message` of custom matchers include text for helper methods
|
24
|
+
# defined using `chain`, e.g.:
|
25
|
+
# be_bigger_than(2).and_smaller_than(4).description
|
26
|
+
# # => "be bigger than 2 and smaller than 4"
|
27
|
+
# ...rather than:
|
28
|
+
# # => "be bigger than 2"
|
29
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
30
|
+
end
|
31
|
+
|
32
|
+
# rspec-mocks config goes here. You can use an alternate test double
|
33
|
+
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
34
|
+
config.mock_with :rspec do |mocks|
|
35
|
+
# Prevents you from mocking or stubbing a method that does not exist on
|
36
|
+
# a real object. This is generally recommended, and will default to
|
37
|
+
# `true` in RSpec 4.
|
38
|
+
mocks.verify_partial_doubles = true
|
39
|
+
end
|
40
|
+
|
41
|
+
# The settings below are suggested to provide a good initial experience
|
42
|
+
# with RSpec, but feel free to customize to your heart's content.
|
43
|
+
=begin
|
44
|
+
# These two settings work together to allow you to limit a spec run
|
45
|
+
# to individual examples or groups you care about by tagging them with
|
46
|
+
# `:focus` metadata. When nothing is tagged with `:focus`, all examples
|
47
|
+
# get run.
|
48
|
+
config.filter_run :focus
|
49
|
+
config.run_all_when_everything_filtered = true
|
50
|
+
|
51
|
+
# Limits the available syntax to the non-monkey patched syntax that is recommended.
|
52
|
+
# For more details, see:
|
53
|
+
# - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
|
54
|
+
# - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
55
|
+
# - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
|
56
|
+
config.disable_monkey_patching!
|
57
|
+
|
58
|
+
# This setting enables warnings. It's recommended, but in some cases may
|
59
|
+
# be too noisy due to issues in dependencies.
|
60
|
+
config.warnings = true
|
61
|
+
|
62
|
+
# Many RSpec users commonly either run the entire suite or an individual
|
63
|
+
# file, and it's useful to allow more verbose output when running an
|
64
|
+
# individual spec file.
|
65
|
+
if config.files_to_run.one?
|
66
|
+
# Use the documentation formatter for detailed output,
|
67
|
+
# unless a formatter has already been configured
|
68
|
+
# (e.g. via a command-line flag).
|
69
|
+
config.default_formatter = 'doc'
|
70
|
+
end
|
71
|
+
|
72
|
+
# Print the 10 slowest examples and example groups at the
|
73
|
+
# end of the spec run, to help surface which specs are running
|
74
|
+
# particularly slow.
|
75
|
+
config.profile_examples = 10
|
76
|
+
|
77
|
+
# Run specs in random order to surface order dependencies. If you find an
|
78
|
+
# order dependency and want to debug it, you can fix the order by providing
|
79
|
+
# the seed, which is printed after each run.
|
80
|
+
# --seed 1234
|
81
|
+
config.order = :random
|
82
|
+
|
83
|
+
# Seed global randomization in this process using the `--seed` CLI option.
|
84
|
+
# Setting this allows you to use `--seed` to deterministically reproduce
|
85
|
+
# test failures related to randomization by passing the same `--seed` value
|
86
|
+
# as the one that triggered the failure.
|
87
|
+
Kernel.srand config.seed
|
88
|
+
=end
|
89
|
+
end
|
data/wercker.yml
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
box: wercker/rvm
|
2
|
+
# Build definition
|
3
|
+
build:
|
4
|
+
# The steps that will be executed on build
|
5
|
+
# See the Ruby section on the wercker devcenter:
|
6
|
+
# http://devcenter.wercker.com/articles/languages/ruby.html
|
7
|
+
steps:
|
8
|
+
# Uncomment this to force RVM to use a specific Ruby version
|
9
|
+
- rvm-use:
|
10
|
+
version: 2.1.5
|
11
|
+
|
12
|
+
- script:
|
13
|
+
name: update bundler
|
14
|
+
code: gem update bundler
|
15
|
+
|
16
|
+
# A step that executes `bundle install` command
|
17
|
+
- bundle-install
|
18
|
+
|
19
|
+
# A custom script step, name value is used in the UI
|
20
|
+
# and the code value contains the command that get executed
|
21
|
+
- script:
|
22
|
+
name: echo ruby information
|
23
|
+
code: |
|
24
|
+
echo "ruby version $(ruby --version) running"
|
25
|
+
echo "from location $(which ruby)"
|
26
|
+
echo -p "gem list: $(gem list)"
|
27
|
+
|
28
|
+
- script:
|
29
|
+
name: rspec
|
30
|
+
code: bundle exec rspec
|
metadata
ADDED
@@ -0,0 +1,133 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: factory_girl_bs_gen
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- fukuiretu
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-01-31 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.7'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.7'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: thor
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description:
|
70
|
+
email:
|
71
|
+
- s0232101@gmail.com
|
72
|
+
executables:
|
73
|
+
- factory_girl_bs_gen
|
74
|
+
extensions: []
|
75
|
+
extra_rdoc_files: []
|
76
|
+
files:
|
77
|
+
- ".gitignore"
|
78
|
+
- ".rspec"
|
79
|
+
- Gemfile
|
80
|
+
- LICENSE.txt
|
81
|
+
- README.md
|
82
|
+
- Rakefile
|
83
|
+
- bin/factory_girl_bs_gen
|
84
|
+
- factory_girl_bs_gen.gemspec
|
85
|
+
- lib/factory_girl_bs_gen.rb
|
86
|
+
- lib/factory_girl_bs_gen/cli.rb
|
87
|
+
- lib/factory_girl_bs_gen/formatter.rb
|
88
|
+
- lib/factory_girl_bs_gen/formatter/base.rb
|
89
|
+
- lib/factory_girl_bs_gen/formatter/build_formatter.rb
|
90
|
+
- lib/factory_girl_bs_gen/formatter/create_formatter.rb
|
91
|
+
- lib/factory_girl_bs_gen/generator.rb
|
92
|
+
- lib/factory_girl_bs_gen/reader.rb
|
93
|
+
- lib/factory_girl_bs_gen/reader/base.rb
|
94
|
+
- lib/factory_girl_bs_gen/reader/csv_reader.rb
|
95
|
+
- lib/factory_girl_bs_gen/reader/json_reader.rb
|
96
|
+
- lib/factory_girl_bs_gen/reader/yaml_reader.rb
|
97
|
+
- lib/factory_girl_bs_gen/version.rb
|
98
|
+
- spec/formatter_spec.rb
|
99
|
+
- spec/generator_spec.rb
|
100
|
+
- spec/reader_spec.rb
|
101
|
+
- spec/sample_data/data.csv
|
102
|
+
- spec/spec_helper.rb
|
103
|
+
- wercker.yml
|
104
|
+
homepage: https://github.com/fukuiretu/factory_girl_bs_gen
|
105
|
+
licenses:
|
106
|
+
- MIT
|
107
|
+
metadata: {}
|
108
|
+
post_install_message:
|
109
|
+
rdoc_options: []
|
110
|
+
require_paths:
|
111
|
+
- lib
|
112
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
114
|
+
- - ">="
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: '0'
|
117
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
118
|
+
requirements:
|
119
|
+
- - ">="
|
120
|
+
- !ruby/object:Gem::Version
|
121
|
+
version: '0'
|
122
|
+
requirements: []
|
123
|
+
rubyforge_project:
|
124
|
+
rubygems_version: 2.2.2
|
125
|
+
signing_key:
|
126
|
+
specification_version: 4
|
127
|
+
summary: FactoryGirl build syntax generator
|
128
|
+
test_files:
|
129
|
+
- spec/formatter_spec.rb
|
130
|
+
- spec/generator_spec.rb
|
131
|
+
- spec/reader_spec.rb
|
132
|
+
- spec/sample_data/data.csv
|
133
|
+
- spec/spec_helper.rb
|