fx 0.2.0 → 0.3.0

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: 6938f7995ea791b0cae6efb9198d707e1c844933
4
- data.tar.gz: 3f636e55ea8dc7c4d858ba4f178233eafe2af09a
3
+ metadata.gz: f457afce50ad5c9eb727743957e5a01ac5761d70
4
+ data.tar.gz: 3c622b0ab7c1a8535c5e81b6d1620d8f9df60c8d
5
5
  SHA512:
6
- metadata.gz: 024d66a1780024f26d6ba5b8e619d398e9d30a838a7427a13b054b63e7376baf8c530251ace8ab74c963772c191aeca7b2f65212024e6a9eb3a2e2dd0574701e
7
- data.tar.gz: b28ac249704b43766fd76e9110d1fee6c1098c3811d6736f3eb56a23a1fc043a5d40e159cb969edf103cc66e51b8861c5a1167650d44eded8e7bdba6f5a68922
6
+ metadata.gz: d09b1a344cb5ad6200c438a1e93c04fb42bd4d891fdd4a7fbbb21c7afa8c409354f7b4619cc8d70ff3505a799e4f3ee9c499e8e29497ceaea1e2ad6c811dca5c
7
+ data.tar.gz: 08c1e3061d0605aa2c3f60b528375e29c971e956fc7fd867518b6b218ecc385f15eece5398134ee4f784bcaf703e8c75a6f4a72098f5df01643c4f2afe95c3c3
@@ -16,6 +16,8 @@ notifications:
16
16
  email: false
17
17
  rvm:
18
18
  - 2.3.1
19
+ - 2.2.6
20
+ - 2.1.10
19
21
  gemfile:
20
22
  - gemfiles/rails40.gemfile
21
23
  - gemfiles/rails41.gemfile
@@ -23,5 +25,5 @@ gemfile:
23
25
  - gemfiles/rails50.gemfile
24
26
  matrix:
25
27
  exclude:
26
- - rvm: 2.1.8
28
+ - rvm: 2.1.10
27
29
  gemfile: gemfiles/rails50.gemfile
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../
3
3
  specs:
4
- fx (0.1.0)
4
+ fx (0.3.0)
5
5
  activerecord (>= 4.0.0)
6
6
  railties (>= 4.0.0)
7
7
 
@@ -29,7 +29,7 @@ GEM
29
29
  multi_json (~> 1.3)
30
30
  thread_safe (~> 0.1)
31
31
  tzinfo (~> 0.3.37)
32
- ammeter (1.1.3)
32
+ ammeter (1.1.4)
33
33
  activesupport (>= 3.0)
34
34
  railties (>= 3.0)
35
35
  rspec-rails (>= 2.2)
@@ -47,8 +47,8 @@ GEM
47
47
  method_source (0.8.2)
48
48
  minitest (4.7.5)
49
49
  multi_json (1.12.1)
50
- pg (0.18.4)
51
- pry (0.10.3)
50
+ pg (0.19.0)
51
+ pry (0.10.4)
52
52
  coderay (~> 1.1.0)
53
53
  method_source (~> 0.8.1)
54
54
  slop (~> 3.4)
@@ -60,7 +60,7 @@ GEM
60
60
  activesupport (= 4.0.13)
61
61
  rake (>= 0.8.7)
62
62
  thor (>= 0.18.1, < 2.0)
63
- rake (11.2.2)
63
+ rake (11.3.0)
64
64
  redcarpet (3.3.4)
65
65
  rspec (3.5.0)
66
66
  rspec-core (~> 3.5.0)
@@ -86,8 +86,8 @@ GEM
86
86
  slop (3.6.0)
87
87
  thor (0.19.1)
88
88
  thread_safe (0.3.5)
89
- tzinfo (0.3.49)
90
- yard (0.8.7.6)
89
+ tzinfo (0.3.52)
90
+ yard (0.9.5)
91
91
 
92
92
  PLATFORMS
93
93
  ruby
@@ -1,36 +1,36 @@
1
1
  PATH
2
2
  remote: ../
3
3
  specs:
4
- fx (0.1.0)
4
+ fx (0.3.0)
5
5
  activerecord (>= 4.0.0)
6
6
  railties (>= 4.0.0)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- actionpack (4.1.15)
12
- actionview (= 4.1.15)
13
- activesupport (= 4.1.15)
11
+ actionpack (4.1.16)
12
+ actionview (= 4.1.16)
13
+ activesupport (= 4.1.16)
14
14
  rack (~> 1.5.2)
15
15
  rack-test (~> 0.6.2)
16
- actionview (4.1.15)
17
- activesupport (= 4.1.15)
16
+ actionview (4.1.16)
17
+ activesupport (= 4.1.16)
18
18
  builder (~> 3.1)
19
19
  erubis (~> 2.7.0)
20
- activemodel (4.1.15)
21
- activesupport (= 4.1.15)
20
+ activemodel (4.1.16)
21
+ activesupport (= 4.1.16)
22
22
  builder (~> 3.1)
23
- activerecord (4.1.15)
24
- activemodel (= 4.1.15)
25
- activesupport (= 4.1.15)
23
+ activerecord (4.1.16)
24
+ activemodel (= 4.1.16)
25
+ activesupport (= 4.1.16)
26
26
  arel (~> 5.0.0)
27
- activesupport (4.1.15)
27
+ activesupport (4.1.16)
28
28
  i18n (~> 0.6, >= 0.6.9)
29
29
  json (~> 1.7, >= 1.7.7)
30
30
  minitest (~> 5.1)
31
31
  thread_safe (~> 0.1)
32
32
  tzinfo (~> 1.1)
33
- ammeter (1.1.3)
33
+ ammeter (1.1.4)
34
34
  activesupport (>= 3.0)
35
35
  railties (>= 3.0)
36
36
  rspec-rails (>= 2.2)
@@ -48,20 +48,20 @@ GEM
48
48
  json (1.8.3)
49
49
  method_source (0.8.2)
50
50
  minitest (5.9.1)
51
- pg (0.18.4)
52
- pry (0.10.3)
51
+ pg (0.19.0)
52
+ pry (0.10.4)
53
53
  coderay (~> 1.1.0)
54
54
  method_source (~> 0.8.1)
55
55
  slop (~> 3.4)
56
56
  rack (1.5.5)
57
57
  rack-test (0.6.3)
58
58
  rack (>= 1.0)
59
- railties (4.1.15)
60
- actionpack (= 4.1.15)
61
- activesupport (= 4.1.15)
59
+ railties (4.1.16)
60
+ actionpack (= 4.1.16)
61
+ activesupport (= 4.1.16)
62
62
  rake (>= 0.8.7)
63
63
  thor (>= 0.18.1, < 2.0)
64
- rake (11.2.2)
64
+ rake (11.3.0)
65
65
  redcarpet (3.3.4)
66
66
  rspec (3.5.0)
67
67
  rspec-core (~> 3.5.0)
@@ -89,7 +89,7 @@ GEM
89
89
  thread_safe (0.3.5)
90
90
  tzinfo (1.2.2)
91
91
  thread_safe (~> 0.1)
92
- yard (0.8.7.6)
92
+ yard (0.9.5)
93
93
 
94
94
  PLATFORMS
95
95
  ruby
@@ -1,40 +1,40 @@
1
1
  PATH
2
2
  remote: ../
3
3
  specs:
4
- fx (0.1.0)
4
+ fx (0.3.0)
5
5
  activerecord (>= 4.0.0)
6
6
  railties (>= 4.0.0)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- actionpack (4.2.6)
12
- actionview (= 4.2.6)
13
- activesupport (= 4.2.6)
11
+ actionpack (4.2.7.1)
12
+ actionview (= 4.2.7.1)
13
+ activesupport (= 4.2.7.1)
14
14
  rack (~> 1.6)
15
15
  rack-test (~> 0.6.2)
16
16
  rails-dom-testing (~> 1.0, >= 1.0.5)
17
17
  rails-html-sanitizer (~> 1.0, >= 1.0.2)
18
- actionview (4.2.6)
19
- activesupport (= 4.2.6)
18
+ actionview (4.2.7.1)
19
+ activesupport (= 4.2.7.1)
20
20
  builder (~> 3.1)
21
21
  erubis (~> 2.7.0)
22
22
  rails-dom-testing (~> 1.0, >= 1.0.5)
23
23
  rails-html-sanitizer (~> 1.0, >= 1.0.2)
24
- activemodel (4.2.6)
25
- activesupport (= 4.2.6)
24
+ activemodel (4.2.7.1)
25
+ activesupport (= 4.2.7.1)
26
26
  builder (~> 3.1)
27
- activerecord (4.2.6)
28
- activemodel (= 4.2.6)
29
- activesupport (= 4.2.6)
27
+ activerecord (4.2.7.1)
28
+ activemodel (= 4.2.7.1)
29
+ activesupport (= 4.2.7.1)
30
30
  arel (~> 6.0)
31
- activesupport (4.2.6)
31
+ activesupport (4.2.7.1)
32
32
  i18n (~> 0.7)
33
33
  json (~> 1.7, >= 1.7.7)
34
34
  minitest (~> 5.1)
35
35
  thread_safe (~> 0.3, >= 0.3.4)
36
36
  tzinfo (~> 1.1)
37
- ammeter (1.1.3)
37
+ ammeter (1.1.4)
38
38
  activesupport (>= 3.0)
39
39
  railties (>= 3.0)
40
40
  rspec-rails (>= 2.2)
@@ -57,12 +57,12 @@ GEM
57
57
  minitest (5.9.1)
58
58
  nokogiri (1.6.8.1)
59
59
  mini_portile2 (~> 2.1.0)
60
- pg (0.18.4)
61
- pry (0.10.3)
60
+ pg (0.19.0)
61
+ pry (0.10.4)
62
62
  coderay (~> 1.1.0)
63
63
  method_source (~> 0.8.1)
64
64
  slop (~> 3.4)
65
- rack (1.6.4)
65
+ rack (1.6.5)
66
66
  rack-test (0.6.3)
67
67
  rack (>= 1.0)
68
68
  rails-deprecated_sanitizer (1.0.3)
@@ -73,12 +73,12 @@ GEM
73
73
  rails-deprecated_sanitizer (>= 1.0.1)
74
74
  rails-html-sanitizer (1.0.3)
75
75
  loofah (~> 2.0)
76
- railties (4.2.6)
77
- actionpack (= 4.2.6)
78
- activesupport (= 4.2.6)
76
+ railties (4.2.7.1)
77
+ actionpack (= 4.2.7.1)
78
+ activesupport (= 4.2.7.1)
79
79
  rake (>= 0.8.7)
80
80
  thor (>= 0.18.1, < 2.0)
81
- rake (11.2.2)
81
+ rake (11.3.0)
82
82
  redcarpet (3.3.4)
83
83
  rspec (3.5.0)
84
84
  rspec-core (~> 3.5.0)
@@ -106,7 +106,7 @@ GEM
106
106
  thread_safe (0.3.5)
107
107
  tzinfo (1.2.2)
108
108
  thread_safe (~> 0.1)
109
- yard (0.8.7.6)
109
+ yard (0.9.5)
110
110
 
111
111
  PLATFORMS
112
112
  ruby
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../
3
3
  specs:
4
- fx (0.1.0)
4
+ fx (0.3.0)
5
5
  activerecord (>= 4.0.0)
6
6
  railties (>= 4.0.0)
7
7
 
@@ -32,7 +32,7 @@ GEM
32
32
  i18n (~> 0.7)
33
33
  minitest (~> 5.1)
34
34
  tzinfo (~> 1.1)
35
- ammeter (1.1.3)
35
+ ammeter (1.1.4)
36
36
  activesupport (>= 3.0)
37
37
  railties (>= 3.0)
38
38
  rspec-rails (>= 2.2)
@@ -55,8 +55,8 @@ GEM
55
55
  minitest (5.9.1)
56
56
  nokogiri (1.6.8.1)
57
57
  mini_portile2 (~> 2.1.0)
58
- pg (0.18.4)
59
- pry (0.10.3)
58
+ pg (0.19.0)
59
+ pry (0.10.4)
60
60
  coderay (~> 1.1.0)
61
61
  method_source (~> 0.8.1)
62
62
  slop (~> 3.4)
@@ -74,7 +74,7 @@ GEM
74
74
  method_source
75
75
  rake (>= 0.8.7)
76
76
  thor (>= 0.18.1, < 2.0)
77
- rake (11.2.2)
77
+ rake (11.3.0)
78
78
  redcarpet (3.3.4)
79
79
  rspec (3.5.0)
80
80
  rspec-core (~> 3.5.0)
@@ -102,7 +102,7 @@ GEM
102
102
  thread_safe (0.3.5)
103
103
  tzinfo (1.2.2)
104
104
  thread_safe (~> 0.1)
105
- yard (0.8.7.6)
105
+ yard (0.9.5)
106
106
 
107
107
  PLATFORMS
108
108
  ruby
@@ -8,7 +8,7 @@ module Fx
8
8
  class Functions
9
9
  # The SQL query used by F(x) to retrieve the functions considered
10
10
  # dumpable into `db/schema.rb`.
11
- FUNCTIONS_WITH_DEFINITIONS_QUERY = <<~SQL
11
+ FUNCTIONS_WITH_DEFINITIONS_QUERY = <<-EOS.freeze
12
12
  SELECT
13
13
  pp.proname AS name,
14
14
  pg_get_functiondef(pp.oid) AS definition
@@ -19,7 +19,7 @@ module Fx
19
19
  ON pd.objid = pp.oid AND pd.deptype = 'e'
20
20
  WHERE pn.nspname = 'public' AND pd.objid IS NULL
21
21
  ORDER BY pp.oid;
22
- SQL
22
+ EOS
23
23
 
24
24
  # Wraps #all as a static facade.
25
25
  #
@@ -8,7 +8,7 @@ module Fx
8
8
  class Triggers
9
9
  # The SQL query used by F(x) to retrieve the triggers considered
10
10
  # dumpable into `db/schema.rb`.
11
- TRIGGERS_WITH_DEFINITIONS_QUERY = <<~SQL
11
+ TRIGGERS_WITH_DEFINITIONS_QUERY = <<-EOS.freeze
12
12
  SELECT
13
13
  pt.tgname AS name,
14
14
  pg_get_triggerdef(pt.oid) AS definition
@@ -20,7 +20,7 @@ module Fx
20
20
  WHERE pt.tgname
21
21
  NOT ILIKE '%constraint%' AND pt.tgname NOT ILIKE 'pg%'
22
22
  ORDER BY pc.oid;
23
- SQL
23
+ EOS
24
24
 
25
25
  # Wraps #all as a static facade.
26
26
  #
@@ -1,4 +1,4 @@
1
1
  module Fx
2
2
  # @api private
3
- VERSION = "0.2.0"
3
+ VERSION = "0.3.0"
4
4
  end
@@ -3,7 +3,7 @@ require "acceptance_helper"
3
3
  describe "User manages functions" do
4
4
  it "handles simple functions" do
5
5
  successfully "rails generate fx:function test"
6
- write_function_definition "test_v01", <<~EOS
6
+ write_function_definition "test_v01", <<-EOS
7
7
  CREATE OR REPLACE FUNCTION test()
8
8
  RETURNS text AS $$
9
9
  BEGIN
@@ -21,7 +21,7 @@ describe "User manages functions" do
21
21
  "db/functions/test_v01.sql",
22
22
  "db/functions/test_v02.sql",
23
23
  )
24
- write_function_definition "test_v02", <<~EOS
24
+ write_function_definition "test_v02", <<-EOS
25
25
  CREATE OR REPLACE FUNCTION test()
26
26
  RETURNS text AS $$
27
27
  BEGIN
@@ -4,7 +4,7 @@ describe "User manages triggers" do
4
4
  it "handles simple triggers" do
5
5
  successfully "rails generate model user name:string upper_name:string"
6
6
  successfully "rails generate fx:function uppercase_users_name"
7
- write_function_definition "uppercase_users_name_v01", <<~EOS
7
+ write_function_definition "uppercase_users_name_v01", <<-EOS
8
8
  CREATE OR REPLACE FUNCTION uppercase_users_name()
9
9
  RETURNS trigger AS $$
10
10
  BEGIN
@@ -14,7 +14,7 @@ describe "User manages triggers" do
14
14
  $$ LANGUAGE plpgsql;
15
15
  EOS
16
16
  successfully "rails generate fx:trigger uppercase_users_name table_name:users"
17
- write_trigger_definition "uppercase_users_name_v01", <<~EOS
17
+ write_trigger_definition "uppercase_users_name_v01", <<-EOS
18
18
  CREATE TRIGGER uppercase_users_name
19
19
  BEFORE INSERT ON users
20
20
  FOR EACH ROW
@@ -22,24 +22,24 @@ describe "User manages triggers" do
22
22
  EOS
23
23
  successfully "rake db:migrate"
24
24
 
25
- execute <<~SQL
25
+ execute <<-EOS
26
26
  INSERT INTO users
27
27
  (name, created_at, updated_at)
28
28
  VALUES
29
29
  ('Bob', NOW(), NOW());
30
- SQL
30
+ EOS
31
31
  result = execute("SELECT upper_name FROM users WHERE name = 'Bob';")
32
32
  expect(result).to eq("upper_name" => "BOB")
33
33
 
34
34
  successfully "rails generate fx:trigger uppercase_users_name table_name:users"
35
- write_trigger_definition "uppercase_users_name_v02", <<~EOS
35
+ write_trigger_definition "uppercase_users_name_v02", <<-EOS
36
36
  CREATE TRIGGER uppercase_users_name
37
37
  BEFORE UPDATE ON users
38
38
  FOR EACH ROW
39
39
  EXECUTE PROCEDURE uppercase_users_name();
40
40
  EOS
41
41
  successfully "rake db:migrate"
42
- execute <<~EOS
42
+ execute <<-EOS
43
43
  UPDATE users
44
44
  SET name = 'Alice'
45
45
  WHERE id = 1;
@@ -2,7 +2,7 @@ require "spec_helper"
2
2
 
3
3
  describe "Function migrations", :db do
4
4
  around do |example|
5
- sql_definition = <<~EOS
5
+ sql_definition = <<-EOS
6
6
  CREATE OR REPLACE FUNCTION test()
7
7
  RETURNS text AS $$
8
8
  BEGIN
@@ -40,7 +40,7 @@ describe "Function migrations", :db do
40
40
  it "can run migrations that updates functions" do
41
41
  connection.create_function(:test)
42
42
 
43
- sql_definition = <<~EOS
43
+ sql_definition = <<-EOS
44
44
  CREATE OR REPLACE FUNCTION test()
45
45
  RETURNS text AS $$
46
46
  BEGIN
@@ -2,7 +2,7 @@ require "spec_helper"
2
2
 
3
3
  describe "Reverting migrations", :db do
4
4
  around do |example|
5
- sql_definition = <<~EOS
5
+ sql_definition = <<-EOS
6
6
  CREATE OR REPLACE FUNCTION test()
7
7
  RETURNS text AS $$
8
8
  BEGIN
@@ -50,7 +50,7 @@ describe "Reverting migrations", :db do
50
50
  it "can run reversible migrations for updating functions" do
51
51
  connection.create_function(:test)
52
52
 
53
- sql_definition = <<~EOS
53
+ sql_definition = <<-EOS
54
54
  CREATE OR REPLACE FUNCTION test()
55
55
  RETURNS text AS $$
56
56
  BEGIN
@@ -2,14 +2,14 @@ require "spec_helper"
2
2
 
3
3
  describe "Trigger migrations", :db do
4
4
  around do |example|
5
- connection.execute <<~EOS
5
+ connection.execute <<-EOS
6
6
  CREATE TABLE users (
7
7
  id int PRIMARY KEY,
8
8
  name varchar(256),
9
9
  upper_name varchar(256)
10
10
  );
11
11
  EOS
12
- Fx.database.create_function <<~EOS
12
+ Fx.database.create_function <<-EOS
13
13
  CREATE OR REPLACE FUNCTION uppercase_users_name()
14
14
  RETURNS trigger AS $$
15
15
  BEGIN
@@ -18,7 +18,7 @@ describe "Trigger migrations", :db do
18
18
  END;
19
19
  $$ LANGUAGE plpgsql;
20
20
  EOS
21
- sql_definition = <<~EOS
21
+ sql_definition = <<-EOS
22
22
  CREATE TRIGGER uppercase_users_name
23
23
  BEFORE INSERT ON users
24
24
  FOR EACH ROW
@@ -2,14 +2,14 @@ require "spec_helper"
2
2
 
3
3
  describe "Reverting migrations", :db do
4
4
  around do |example|
5
- connection.execute <<~EOS
5
+ connection.execute <<-EOS
6
6
  CREATE TABLE users (
7
7
  id int PRIMARY KEY,
8
8
  name varchar(256),
9
9
  upper_name varchar(256)
10
10
  );
11
11
  EOS
12
- Fx.database.create_function <<~EOS
12
+ Fx.database.create_function <<-EOS
13
13
  CREATE OR REPLACE FUNCTION uppercase_users_name()
14
14
  RETURNS trigger AS $$
15
15
  BEGIN
@@ -18,7 +18,7 @@ describe "Reverting migrations", :db do
18
18
  END;
19
19
  $$ LANGUAGE plpgsql;
20
20
  EOS
21
- sql_definition = <<~EOS
21
+ sql_definition = <<-EOS
22
22
  CREATE TRIGGER uppercase_users_name
23
23
  BEFORE INSERT ON users
24
24
  FOR EACH ROW
@@ -67,7 +67,7 @@ describe "Reverting migrations", :db do
67
67
  it "can run reversible migrations for updating triggers" do
68
68
  connection.create_trigger(:uppercase_users_name)
69
69
 
70
- sql_definition = <<~EOS
70
+ sql_definition = <<-EOS
71
71
  CREATE TRIGGER uppercase_users_name
72
72
  BEFORE UPDATE ON users
73
73
  FOR EACH ROW
@@ -6,7 +6,7 @@ module Fx::Adapters
6
6
  it "successfully creates a function" do
7
7
  adapter = Postgres.new
8
8
  adapter.create_function(
9
- <<~EOS
9
+ <<-EOS
10
10
  CREATE OR REPLACE FUNCTION test()
11
11
  RETURNS text AS $$
12
12
  BEGIN
@@ -22,7 +22,7 @@ module Fx::Adapters
22
22
 
23
23
  describe "#create_trigger" do
24
24
  it "successfully creates a trigger" do
25
- connection.execute <<~EOS
25
+ connection.execute <<-EOS
26
26
  CREATE TABLE users (
27
27
  id int PRIMARY KEY,
28
28
  name varchar(256),
@@ -30,7 +30,7 @@ module Fx::Adapters
30
30
  );
31
31
  EOS
32
32
  adapter = Postgres.new
33
- adapter.create_function <<~EOS
33
+ adapter.create_function <<-EOS
34
34
  CREATE OR REPLACE FUNCTION uppercase_users_name()
35
35
  RETURNS trigger AS $$
36
36
  BEGIN
@@ -40,7 +40,7 @@ module Fx::Adapters
40
40
  $$ LANGUAGE plpgsql;
41
41
  EOS
42
42
  adapter.create_trigger(
43
- <<~EOS
43
+ <<-EOS
44
44
  CREATE TRIGGER uppercase_users_name
45
45
  BEFORE INSERT ON users
46
46
  FOR EACH ROW
@@ -56,7 +56,7 @@ module Fx::Adapters
56
56
  it "successfully drops a function" do
57
57
  adapter = Postgres.new
58
58
  adapter.create_function(
59
- <<~EOS
59
+ <<-EOS
60
60
  CREATE OR REPLACE FUNCTION test()
61
61
  RETURNS text AS $$
62
62
  BEGIN
@@ -76,7 +76,7 @@ module Fx::Adapters
76
76
  it "finds functions and builds Fx::Function objects" do
77
77
  adapter = Postgres.new
78
78
  adapter.create_function(
79
- <<~EOS
79
+ <<-EOS
80
80
  CREATE OR REPLACE FUNCTION test()
81
81
  RETURNS text AS $$
82
82
  BEGIN
@@ -86,27 +86,13 @@ module Fx::Adapters
86
86
  EOS
87
87
  )
88
88
 
89
- expect(adapter.functions).to eq([
90
- Fx::Function.new(
91
- "name" => "test",
92
- "definition" => <<~EOS
93
- CREATE OR REPLACE FUNCTION public.test()
94
- RETURNS text
95
- LANGUAGE plpgsql
96
- AS $function$
97
- BEGIN
98
- RETURN 'test';
99
- END;
100
- $function$
101
- EOS
102
- ),
103
- ])
89
+ expect(adapter.functions.map(&:name)).to eq ["test"]
104
90
  end
105
91
  end
106
92
 
107
93
  describe "#triggers" do
108
94
  it "finds triggers and builds Fx::Trigger objects" do
109
- connection.execute <<~EOS
95
+ connection.execute <<-EOS
110
96
  CREATE TABLE users (
111
97
  id int PRIMARY KEY,
112
98
  name varchar(256),
@@ -114,7 +100,7 @@ module Fx::Adapters
114
100
  );
115
101
  EOS
116
102
  adapter = Postgres.new
117
- adapter.create_function <<~EOS
103
+ adapter.create_function <<-EOS
118
104
  CREATE OR REPLACE FUNCTION uppercase_users_name()
119
105
  RETURNS trigger AS $$
120
106
  BEGIN
@@ -123,7 +109,7 @@ module Fx::Adapters
123
109
  END;
124
110
  $$ LANGUAGE plpgsql;
125
111
  EOS
126
- sql_definition = <<~EOS
112
+ sql_definition = <<-EOS
127
113
  CREATE TRIGGER uppercase_users_name
128
114
  BEFORE INSERT ON users
129
115
  FOR EACH ROW
@@ -131,19 +117,8 @@ module Fx::Adapters
131
117
  EOS
132
118
  adapter.create_trigger(sql_definition)
133
119
 
134
- expect(adapter.triggers).to eq(
135
- [
136
- Fx::Trigger.new(
137
- "name" => "uppercase_users_name",
138
- "definition" => format_trigger(sql_definition),
139
- ),
140
- ],
141
- )
120
+ expect(adapter.triggers.map(&:name)).to eq ["uppercase_users_name"]
142
121
  end
143
122
  end
144
-
145
- def format_trigger(trigger)
146
- trigger.gsub("\n", "").gsub(" ", " ")
147
- end
148
123
  end
149
124
  end
@@ -4,7 +4,7 @@ describe Fx::Definition do
4
4
  describe "#to_sql" do
5
5
  context "representing a function definition" do
6
6
  it "returns the content of a function definition" do
7
- sql_definition = <<~EOS
7
+ sql_definition = <<-EOS
8
8
  CREATE OR REPLACE FUNCTION test()
9
9
  RETURNS text AS $$
10
10
  BEGIN
@@ -32,7 +32,7 @@ describe Fx::Definition do
32
32
 
33
33
  context "representing a trigger definition" do
34
34
  it "returns the content of a trigger definition" do
35
- sql_definition = <<~EOS
35
+ sql_definition = <<-EOS
36
36
  CREATE TRIGGER check_update
37
37
  BEFORE UPDATE ON accounts
38
38
  FOR EACH ROW
@@ -2,7 +2,7 @@ require "spec_helper"
2
2
 
3
3
  describe Fx::SchemaDumper::Function, :db do
4
4
  it "dumps a create_function for a function in the database" do
5
- sql_definition = <<~EOS
5
+ sql_definition = <<-EOS
6
6
  CREATE OR REPLACE FUNCTION test()
7
7
  RETURNS text AS $$
8
8
  BEGIN
@@ -2,14 +2,14 @@ require "spec_helper"
2
2
 
3
3
  describe Fx::SchemaDumper::Trigger, :db do
4
4
  it "dumps a create_trigger for a trigger in the database" do
5
- connection.execute <<~EOS
5
+ connection.execute <<-EOS
6
6
  CREATE TABLE users (
7
7
  id int PRIMARY KEY,
8
8
  name varchar(256),
9
9
  upper_name varchar(256)
10
10
  );
11
11
  EOS
12
- Fx.database.create_function <<~EOS
12
+ Fx.database.create_function <<-EOS
13
13
  CREATE OR REPLACE FUNCTION uppercase_users_name()
14
14
  RETURNS trigger AS $$
15
15
  BEGIN
@@ -18,7 +18,7 @@ describe Fx::SchemaDumper::Trigger, :db do
18
18
  END;
19
19
  $$ LANGUAGE plpgsql;
20
20
  EOS
21
- sql_definition = <<~EOS
21
+ sql_definition = <<-EOS
22
22
  CREATE TRIGGER uppercase_users_name
23
23
  BEFORE INSERT ON users
24
24
  FOR EACH ROW
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fx
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Teo Ljungberg
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-17 00:00:00.000000000 Z
11
+ date: 2016-11-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: appraisal