pattern_generator 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 590d40cb953dc48bf726b092c90affa70dae57d6
4
- data.tar.gz: 5c0937a0e7fbb3b816d9bb3393b153d12b0c0f2d
3
+ metadata.gz: 2f31e64304aff265da3f913a37f2ba398f7acbc8
4
+ data.tar.gz: b4f3f2b2f47773de048fa446e0381b2d49988a7f
5
5
  SHA512:
6
- metadata.gz: f58698f7929877b1aca8a19523aeeeba8d5b6c5b174a8adaccf2b3359bcb3c3d9dda11119c921f37a3accd81e81e5dece240122d6cdcbd39c2b4cc693314c191
7
- data.tar.gz: 795e6487260871a165d6d61093a28840edf91b3d3b465633088b478ea616a314374a3fbbadaa97a589337efc8c3c5b9f8de50d30d5745bb4d1a0360d21310375
6
+ metadata.gz: 91e0e7d0d054503c2cba164b143b452d7d582e822cc7ff42572448fe67260983e5d9f998cf087a6fd1a74af08f976753ecac9de1ba24cd0482e14b5eb86de64b
7
+ data.tar.gz: 01465dfb7cfca05030240788a2fabb14eeb7c143da6d7743b873883a4697b9ac05c2cd0e91beaf59af325930ff8d3d6789e340cd86d97659a021ed448c5a8994
@@ -0,0 +1,24 @@
1
+ require 'active_support/inflector'
2
+
3
+ class PoroGenerator < Rails::Generators::NamedBase
4
+ source_root File.expand_path('../templates', __FILE__)
5
+ class_option :test_suite, type: :string, default: 'rspec', desc: 'Test framework to generate test. (rspec or minitest)'
6
+
7
+ def generate_template
8
+ template 'poro.rb', "app/models/#{file_name}.rb"
9
+ end
10
+
11
+ def generate_test
12
+ if options.test_suite == 'rspec'
13
+ template 'poro_spec.rb', "spec/models/#{file_name}_spec.rb"
14
+ elsif options.test_suite == 'minitest'
15
+ template 'poro_test.rb', "test/models/#{file_name}_test.rb"
16
+ end
17
+ end
18
+
19
+ private
20
+
21
+ def class_name
22
+ file_name.classify
23
+ end
24
+ end
@@ -0,0 +1,5 @@
1
+ class <%= class_name %>
2
+ def initialize
3
+
4
+ end
5
+ end
@@ -0,0 +1,9 @@
1
+ require 'rails_helper'
2
+
3
+ RSpec.describe <%= class_name %> do
4
+ describe 'something' do
5
+ it 'does something' do
6
+
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,7 @@
1
+ require 'test_helper'
2
+
3
+ class <%= class_name %>Test < MiniTest::Test
4
+ test "something interesting" do
5
+
6
+ end
7
+ end
@@ -1,3 +1,3 @@
1
1
  module PatternGenerator
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -1717,3 +1717,391 @@ PolicyGeneratorTest: test_rspec_file_is_generated
1717
1717
  PolicyGeneratorTest: test_correct_file_is_generated
1718
1718
  ---------------------------------------------------
1719
1719
   (0.2ms) rollback transaction
1720
+ ActiveRecord::SchemaMigration Load (0.5ms) SELECT "schema_migrations".* FROM "schema_migrations"
1721
+  (1.5ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL) 
1722
+  (0.2ms) select sqlite_version(*)
1723
+  (1.3ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
1724
+  (0.1ms) SELECT version FROM "schema_migrations"
1725
+  (0.9ms) INSERT INTO "schema_migrations" (version) VALUES ('0')
1726
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
1727
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
1728
+  (1.9ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL) 
1729
+  (0.1ms) select sqlite_version(*)
1730
+  (1.0ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
1731
+  (0.1ms) SELECT version FROM "schema_migrations"
1732
+  (0.9ms) INSERT INTO "schema_migrations" (version) VALUES ('0')
1733
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
1734
+  (0.1ms) begin transaction
1735
+ ---------------------------------------------------
1736
+ PolicyGeneratorTest: test_correct_file_is_generated
1737
+ ---------------------------------------------------
1738
+  (0.1ms) rollback transaction
1739
+  (0.1ms) begin transaction
1740
+ -------------------------------------------------
1741
+ PolicyGeneratorTest: test_rspec_file_is_generated
1742
+ -------------------------------------------------
1743
+  (0.2ms) rollback transaction
1744
+  (0.1ms) begin transaction
1745
+ ------------------------------------------------------------------------------
1746
+ PolicyGeneratorTest: test_if_minitest_is_specified,_minitest_file_is_generated
1747
+ ------------------------------------------------------------------------------
1748
+  (0.1ms) rollback transaction
1749
+  (0.1ms) begin transaction
1750
+ -------------------------------------------------
1751
+ PoroGeneratorTest: test_correct_file_is_generated
1752
+ -------------------------------------------------
1753
+  (0.1ms) rollback transaction
1754
+  (0.1ms) begin transaction
1755
+ ----------------------------------------------------
1756
+ ServiceGeneratorTest: test_correct_file_is_generated
1757
+ ----------------------------------------------------
1758
+  (0.1ms) rollback transaction
1759
+  (0.1ms) begin transaction
1760
+ ---------------------------------------------------------
1761
+ ServiceGeneratorTest: test_correct_spec_file_is_generated
1762
+ ---------------------------------------------------------
1763
+  (0.1ms) rollback transaction
1764
+  (0.1ms) begin transaction
1765
+ --------------------------------------------------------------------------------
1766
+ ServiceGeneratorTest: test_generates_minitest_file_if_test-framework_is_minitest
1767
+ --------------------------------------------------------------------------------
1768
+  (0.1ms) rollback transaction
1769
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
1770
+  (3.0ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL) 
1771
+  (0.1ms) select sqlite_version(*)
1772
+  (1.1ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
1773
+  (0.1ms) SELECT version FROM "schema_migrations"
1774
+  (0.9ms) INSERT INTO "schema_migrations" (version) VALUES ('0')
1775
+ ActiveRecord::SchemaMigration Load (0.2ms) SELECT "schema_migrations".* FROM "schema_migrations"
1776
+  (0.1ms) begin transaction
1777
+ -------------------------------------------------
1778
+ PolicyGeneratorTest: test_rspec_file_is_generated
1779
+ -------------------------------------------------
1780
+  (0.1ms) rollback transaction
1781
+  (0.1ms) begin transaction
1782
+ ------------------------------------------------------------------------------
1783
+ PolicyGeneratorTest: test_if_minitest_is_specified,_minitest_file_is_generated
1784
+ ------------------------------------------------------------------------------
1785
+  (0.2ms) rollback transaction
1786
+  (0.1ms) begin transaction
1787
+ ---------------------------------------------------
1788
+ PolicyGeneratorTest: test_correct_file_is_generated
1789
+ ---------------------------------------------------
1790
+  (0.1ms) rollback transaction
1791
+  (0.1ms) begin transaction
1792
+ -------------------------------------------------
1793
+ PoroGeneratorTest: test_correct_file_is_generated
1794
+ -------------------------------------------------
1795
+  (0.1ms) rollback transaction
1796
+  (0.1ms) begin transaction
1797
+ ----------------------------------------------------
1798
+ ServiceGeneratorTest: test_correct_file_is_generated
1799
+ ----------------------------------------------------
1800
+  (0.2ms) rollback transaction
1801
+  (0.2ms) begin transaction
1802
+ --------------------------------------------------------------------------------
1803
+ ServiceGeneratorTest: test_generates_minitest_file_if_test-framework_is_minitest
1804
+ --------------------------------------------------------------------------------
1805
+  (0.2ms) rollback transaction
1806
+  (0.1ms) begin transaction
1807
+ ---------------------------------------------------------
1808
+ ServiceGeneratorTest: test_correct_spec_file_is_generated
1809
+ ---------------------------------------------------------
1810
+  (0.1ms) rollback transaction
1811
+ ActiveRecord::SchemaMigration Load (0.2ms) SELECT "schema_migrations".* FROM "schema_migrations"
1812
+  (2.7ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL) 
1813
+  (0.1ms) select sqlite_version(*)
1814
+  (1.1ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
1815
+  (0.1ms) SELECT version FROM "schema_migrations"
1816
+  (0.9ms) INSERT INTO "schema_migrations" (version) VALUES ('0')
1817
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
1818
+  (0.1ms) begin transaction
1819
+ -------------------------------------------------
1820
+ PoroGeneratorTest: test_correct_file_is_generated
1821
+ -------------------------------------------------
1822
+  (0.1ms) rollback transaction
1823
+  (0.1ms) begin transaction
1824
+ -----------------------------------------------
1825
+ PoroGeneratorTest: test_rspec_test_is_generated
1826
+ -----------------------------------------------
1827
+  (0.1ms) rollback transaction
1828
+  (0.1ms) begin transaction
1829
+ ----------------------------------------------------
1830
+ ServiceGeneratorTest: test_correct_file_is_generated
1831
+ ----------------------------------------------------
1832
+  (0.1ms) rollback transaction
1833
+  (0.1ms) begin transaction
1834
+ ---------------------------------------------------------
1835
+ ServiceGeneratorTest: test_correct_spec_file_is_generated
1836
+ ---------------------------------------------------------
1837
+  (0.3ms) rollback transaction
1838
+  (0.1ms) begin transaction
1839
+ --------------------------------------------------------------------------------
1840
+ ServiceGeneratorTest: test_generates_minitest_file_if_test-framework_is_minitest
1841
+ --------------------------------------------------------------------------------
1842
+  (0.1ms) rollback transaction
1843
+  (0.1ms) begin transaction
1844
+ ------------------------------------------------------------------------------
1845
+ PolicyGeneratorTest: test_if_minitest_is_specified,_minitest_file_is_generated
1846
+ ------------------------------------------------------------------------------
1847
+  (0.1ms) rollback transaction
1848
+  (0.1ms) begin transaction
1849
+ ---------------------------------------------------
1850
+ PolicyGeneratorTest: test_correct_file_is_generated
1851
+ ---------------------------------------------------
1852
+  (0.1ms) rollback transaction
1853
+  (0.1ms) begin transaction
1854
+ -------------------------------------------------
1855
+ PolicyGeneratorTest: test_rspec_file_is_generated
1856
+ -------------------------------------------------
1857
+  (0.2ms) rollback transaction
1858
+ ActiveRecord::SchemaMigration Load (0.2ms) SELECT "schema_migrations".* FROM "schema_migrations"
1859
+  (2.9ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL) 
1860
+  (0.1ms) select sqlite_version(*)
1861
+  (1.1ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
1862
+  (0.1ms) SELECT version FROM "schema_migrations"
1863
+  (1.0ms) INSERT INTO "schema_migrations" (version) VALUES ('0')
1864
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
1865
+  (0.1ms) begin transaction
1866
+ ---------------------------------------------------
1867
+ PolicyGeneratorTest: test_correct_file_is_generated
1868
+ ---------------------------------------------------
1869
+  (0.1ms) rollback transaction
1870
+  (0.1ms) begin transaction
1871
+ -------------------------------------------------
1872
+ PolicyGeneratorTest: test_rspec_file_is_generated
1873
+ -------------------------------------------------
1874
+  (0.2ms) rollback transaction
1875
+  (0.1ms) begin transaction
1876
+ ------------------------------------------------------------------------------
1877
+ PolicyGeneratorTest: test_if_minitest_is_specified,_minitest_file_is_generated
1878
+ ------------------------------------------------------------------------------
1879
+  (0.1ms) rollback transaction
1880
+  (0.1ms) begin transaction
1881
+ -------------------------------------------------
1882
+ PoroGeneratorTest: test_correct_file_is_generated
1883
+ -------------------------------------------------
1884
+  (0.1ms) rollback transaction
1885
+  (0.1ms) begin transaction
1886
+ -----------------------------------------------
1887
+ PoroGeneratorTest: test_rspec_test_is_generated
1888
+ -----------------------------------------------
1889
+  (0.1ms) rollback transaction
1890
+  (0.1ms) begin transaction
1891
+ ----------------------------------------------------
1892
+ ServiceGeneratorTest: test_correct_file_is_generated
1893
+ ----------------------------------------------------
1894
+  (0.1ms) rollback transaction
1895
+  (0.1ms) begin transaction
1896
+ ---------------------------------------------------------
1897
+ ServiceGeneratorTest: test_correct_spec_file_is_generated
1898
+ ---------------------------------------------------------
1899
+  (0.1ms) rollback transaction
1900
+  (0.1ms) begin transaction
1901
+ --------------------------------------------------------------------------------
1902
+ ServiceGeneratorTest: test_generates_minitest_file_if_test-framework_is_minitest
1903
+ --------------------------------------------------------------------------------
1904
+  (0.1ms) rollback transaction
1905
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
1906
+  (2.8ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL) 
1907
+  (0.1ms) select sqlite_version(*)
1908
+  (1.1ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
1909
+  (0.1ms) SELECT version FROM "schema_migrations"
1910
+  (0.9ms) INSERT INTO "schema_migrations" (version) VALUES ('0')
1911
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
1912
+  (0.1ms) begin transaction
1913
+ ----------------------------------------------------
1914
+ ServiceGeneratorTest: test_correct_file_is_generated
1915
+ ----------------------------------------------------
1916
+  (0.1ms) rollback transaction
1917
+  (0.1ms) begin transaction
1918
+ ---------------------------------------------------------
1919
+ ServiceGeneratorTest: test_correct_spec_file_is_generated
1920
+ ---------------------------------------------------------
1921
+  (0.1ms) rollback transaction
1922
+  (0.1ms) begin transaction
1923
+ --------------------------------------------------------------------------------
1924
+ ServiceGeneratorTest: test_generates_minitest_file_if_test-framework_is_minitest
1925
+ --------------------------------------------------------------------------------
1926
+  (0.1ms) rollback transaction
1927
+  (0.1ms) begin transaction
1928
+ ---------------------------------------------------
1929
+ PolicyGeneratorTest: test_correct_file_is_generated
1930
+ ---------------------------------------------------
1931
+  (0.1ms) rollback transaction
1932
+  (0.1ms) begin transaction
1933
+ -------------------------------------------------
1934
+ PolicyGeneratorTest: test_rspec_file_is_generated
1935
+ -------------------------------------------------
1936
+  (0.1ms) rollback transaction
1937
+  (0.1ms) begin transaction
1938
+ ------------------------------------------------------------------------------
1939
+ PolicyGeneratorTest: test_if_minitest_is_specified,_minitest_file_is_generated
1940
+ ------------------------------------------------------------------------------
1941
+  (0.2ms) rollback transaction
1942
+  (0.2ms) begin transaction
1943
+ -------------------------------------------------
1944
+ PoroGeneratorTest: test_correct_file_is_generated
1945
+ -------------------------------------------------
1946
+  (0.1ms) rollback transaction
1947
+  (0.1ms) begin transaction
1948
+ -----------------------------------------------
1949
+ PoroGeneratorTest: test_rspec_test_is_generated
1950
+ -----------------------------------------------
1951
+  (0.1ms) rollback transaction
1952
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
1953
+  (3.0ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL) 
1954
+  (0.1ms) select sqlite_version(*)
1955
+  (1.0ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
1956
+  (0.1ms) SELECT version FROM "schema_migrations"
1957
+  (1.0ms) INSERT INTO "schema_migrations" (version) VALUES ('0')
1958
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
1959
+  (0.1ms) begin transaction
1960
+ -------------------------------------------------
1961
+ PoroGeneratorTest: test_correct_file_is_generated
1962
+ -------------------------------------------------
1963
+  (0.1ms) rollback transaction
1964
+  (0.1ms) begin transaction
1965
+ ------------------------------------------------------------------------------
1966
+ PoroGeneratorTest: test_minitest_file_is_generated_when_test-suite_is_minitest
1967
+ ------------------------------------------------------------------------------
1968
+  (0.2ms) rollback transaction
1969
+  (0.1ms) begin transaction
1970
+ -----------------------------------------------
1971
+ PoroGeneratorTest: test_rspec_file_is_generated
1972
+ -----------------------------------------------
1973
+  (0.1ms) rollback transaction
1974
+  (0.1ms) begin transaction
1975
+ -------------------------------------------------
1976
+ PolicyGeneratorTest: test_rspec_file_is_generated
1977
+ -------------------------------------------------
1978
+  (0.1ms) rollback transaction
1979
+  (0.1ms) begin transaction
1980
+ ------------------------------------------------------------------------------
1981
+ PolicyGeneratorTest: test_if_minitest_is_specified,_minitest_file_is_generated
1982
+ ------------------------------------------------------------------------------
1983
+  (0.1ms) rollback transaction
1984
+  (0.1ms) begin transaction
1985
+ ---------------------------------------------------
1986
+ PolicyGeneratorTest: test_correct_file_is_generated
1987
+ ---------------------------------------------------
1988
+  (0.1ms) rollback transaction
1989
+  (0.1ms) begin transaction
1990
+ ---------------------------------------------------------
1991
+ ServiceGeneratorTest: test_correct_spec_file_is_generated
1992
+ ---------------------------------------------------------
1993
+  (0.1ms) rollback transaction
1994
+  (0.1ms) begin transaction
1995
+ ----------------------------------------------------
1996
+ ServiceGeneratorTest: test_correct_file_is_generated
1997
+ ----------------------------------------------------
1998
+  (0.1ms) rollback transaction
1999
+  (0.1ms) begin transaction
2000
+ --------------------------------------------------------------------------------
2001
+ ServiceGeneratorTest: test_generates_minitest_file_if_test-framework_is_minitest
2002
+ --------------------------------------------------------------------------------
2003
+  (0.1ms) rollback transaction
2004
+ ActiveRecord::SchemaMigration Load (0.2ms) SELECT "schema_migrations".* FROM "schema_migrations"
2005
+  (3.5ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL) 
2006
+  (0.1ms) select sqlite_version(*)
2007
+  (1.4ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
2008
+  (0.1ms) SELECT version FROM "schema_migrations"
2009
+  (1.0ms) INSERT INTO "schema_migrations" (version) VALUES ('0')
2010
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
2011
+  (0.1ms) begin transaction
2012
+ ---------------------------------------------------
2013
+ PolicyGeneratorTest: test_correct_file_is_generated
2014
+ ---------------------------------------------------
2015
+  (0.1ms) rollback transaction
2016
+  (0.1ms) begin transaction
2017
+ ------------------------------------------------------------------------------
2018
+ PolicyGeneratorTest: test_if_minitest_is_specified,_minitest_file_is_generated
2019
+ ------------------------------------------------------------------------------
2020
+  (0.2ms) rollback transaction
2021
+  (0.1ms) begin transaction
2022
+ -------------------------------------------------
2023
+ PolicyGeneratorTest: test_rspec_file_is_generated
2024
+ -------------------------------------------------
2025
+  (0.1ms) rollback transaction
2026
+  (0.1ms) begin transaction
2027
+ --------------------------------------------------------------------------------
2028
+ ServiceGeneratorTest: test_generates_minitest_file_if_test-framework_is_minitest
2029
+ --------------------------------------------------------------------------------
2030
+  (0.1ms) rollback transaction
2031
+  (0.2ms) begin transaction
2032
+ ---------------------------------------------------------
2033
+ ServiceGeneratorTest: test_correct_spec_file_is_generated
2034
+ ---------------------------------------------------------
2035
+  (0.2ms) rollback transaction
2036
+  (0.4ms) begin transaction
2037
+ ----------------------------------------------------
2038
+ ServiceGeneratorTest: test_correct_file_is_generated
2039
+ ----------------------------------------------------
2040
+  (0.2ms) rollback transaction
2041
+  (0.1ms) begin transaction
2042
+ -------------------------------------------------
2043
+ PoroGeneratorTest: test_correct_file_is_generated
2044
+ -------------------------------------------------
2045
+  (0.2ms) rollback transaction
2046
+  (0.1ms) begin transaction
2047
+ -----------------------------------------------
2048
+ PoroGeneratorTest: test_rspec_file_is_generated
2049
+ -----------------------------------------------
2050
+  (0.1ms) rollback transaction
2051
+  (0.1ms) begin transaction
2052
+ ------------------------------------------------------------------------------
2053
+ PoroGeneratorTest: test_minitest_file_is_generated_when_test-suite_is_minitest
2054
+ ------------------------------------------------------------------------------
2055
+  (0.1ms) rollback transaction
2056
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
2057
+  (4.2ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL) 
2058
+  (0.1ms) select sqlite_version(*)
2059
+  (1.2ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
2060
+  (0.1ms) SELECT version FROM "schema_migrations"
2061
+  (1.1ms) INSERT INTO "schema_migrations" (version) VALUES ('0')
2062
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
2063
+  (0.1ms) begin transaction
2064
+ -------------------------------------------------
2065
+ PolicyGeneratorTest: test_rspec_file_is_generated
2066
+ -------------------------------------------------
2067
+  (0.1ms) rollback transaction
2068
+  (0.2ms) begin transaction
2069
+ ------------------------------------------------------------------------------
2070
+ PolicyGeneratorTest: test_if_minitest_is_specified,_minitest_file_is_generated
2071
+ ------------------------------------------------------------------------------
2072
+  (0.2ms) rollback transaction
2073
+  (0.2ms) begin transaction
2074
+ ---------------------------------------------------
2075
+ PolicyGeneratorTest: test_correct_file_is_generated
2076
+ ---------------------------------------------------
2077
+  (0.1ms) rollback transaction
2078
+  (0.2ms) begin transaction
2079
+ -----------------------------------------------
2080
+ PoroGeneratorTest: test_rspec_file_is_generated
2081
+ -----------------------------------------------
2082
+  (0.1ms) rollback transaction
2083
+  (0.1ms) begin transaction
2084
+ ------------------------------------------------------------------------------
2085
+ PoroGeneratorTest: test_minitest_file_is_generated_when_test-suite_is_minitest
2086
+ ------------------------------------------------------------------------------
2087
+  (0.1ms) rollback transaction
2088
+  (0.1ms) begin transaction
2089
+ -------------------------------------------------
2090
+ PoroGeneratorTest: test_correct_file_is_generated
2091
+ -------------------------------------------------
2092
+  (0.1ms) rollback transaction
2093
+  (0.1ms) begin transaction
2094
+ ----------------------------------------------------
2095
+ ServiceGeneratorTest: test_correct_file_is_generated
2096
+ ----------------------------------------------------
2097
+  (0.1ms) rollback transaction
2098
+  (0.1ms) begin transaction
2099
+ --------------------------------------------------------------------------------
2100
+ ServiceGeneratorTest: test_generates_minitest_file_if_test-framework_is_minitest
2101
+ --------------------------------------------------------------------------------
2102
+  (0.1ms) rollback transaction
2103
+  (0.1ms) begin transaction
2104
+ ---------------------------------------------------------
2105
+ ServiceGeneratorTest: test_correct_spec_file_is_generated
2106
+ ---------------------------------------------------------
2107
+  (0.1ms) rollback transaction
@@ -0,0 +1,40 @@
1
+ require 'test_helper'
2
+ require 'generators/poro/poro_generator'
3
+
4
+ class PoroGeneratorTest < Rails::Generators::TestCase
5
+ tests PoroGenerator
6
+
7
+ destination File.join(Rails.root)
8
+ teardown :cleanup
9
+
10
+ def cleanup
11
+ FileUtils.rm_rf(File.join(Rails.root, 'app/models'))
12
+ FileUtils.rm_rf(File.join(Rails.root, 'spec/models'))
13
+ FileUtils.rm_rf(File.join(Rails.root, 'test/models'))
14
+ end
15
+
16
+ test 'correct file is generated' do
17
+ run_generator %w(grade)
18
+
19
+ assert_file 'app/models/grade.rb' do |content|
20
+ assert_match /class Grade/, content
21
+ assert_no_match /ActiveRecord::Base/, content
22
+ end
23
+ end
24
+
25
+ test 'rspec file is generated' do
26
+ run_generator %w(grade)
27
+
28
+ assert_file 'spec/models/grade_spec.rb' do |content|
29
+ assert_match /RSpec.describe Grade do/, content
30
+ end
31
+ end
32
+
33
+ test 'minitest file is generated when test-suite is minitest' do
34
+ run_generator %w(grade --test-suite=minitest)
35
+
36
+ assert_file 'test/models/grade_test.rb' do |content|
37
+ assert_match /class GradeTest < MiniTest::Test/, content
38
+ end
39
+ end
40
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pattern_generator
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
  - Sung Won Cho
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-10 00:00:00.000000000 Z
11
+ date: 2015-06-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -80,6 +80,10 @@ files:
80
80
  - lib/generators/policy/templates/policy.rb
81
81
  - lib/generators/policy/templates/policy_spec.rb
82
82
  - lib/generators/policy/templates/policy_test.rb
83
+ - lib/generators/poro/poro_generator.rb
84
+ - lib/generators/poro/templates/poro.rb
85
+ - lib/generators/poro/templates/poro_spec.rb
86
+ - lib/generators/poro/templates/poro_test.rb
83
87
  - lib/generators/service/service_generator.rb
84
88
  - lib/generators/service/templates/service.rb
85
89
  - lib/generators/service/templates/service_spec.rb
@@ -126,6 +130,7 @@ files:
126
130
  - test/dummy/public/500.html
127
131
  - test/dummy/public/favicon.ico
128
132
  - test/generators/policy_generator_test.rb
133
+ - test/generators/poro_generator_test.rb
129
134
  - test/generators/service_generator_test.rb
130
135
  - test/test_helper.rb
131
136
  homepage: https://github.com/sungwoncho/pattern_generator
@@ -192,5 +197,6 @@ test_files:
192
197
  - test/dummy/Rakefile
193
198
  - test/dummy/README.rdoc
194
199
  - test/generators/policy_generator_test.rb
200
+ - test/generators/poro_generator_test.rb
195
201
  - test/generators/service_generator_test.rb
196
202
  - test/test_helper.rb