rails_edge_test 1.1.1 → 1.2.0

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
  SHA256:
3
- metadata.gz: e416318b122f02d659015ff79679e83324df69d730c4afe94c8513e2c9116ce5
4
- data.tar.gz: b7ba321427032df2a7ff41de7da63dc850be2a555959c187661523879a6e057f
3
+ metadata.gz: 2ea0623b8fcd905e8089161c2aae44499b57bfe1189fe4827ca96690392a1329
4
+ data.tar.gz: e88c2f02e80681077ee86996dfa3e5db5c106626046f98935b7ce343d08e4f51
5
5
  SHA512:
6
- metadata.gz: c516bfc44a25f4f7ad5c0e367af9a4369a495d715b968783aa2d7b1468cf370eea000e475139221b1ed179e931192f99e2d31ea31c8c161cbb4e7b2b6260ef87
7
- data.tar.gz: f5750c2853c6a483dcfe53a7905e03510b116c6ee9c8cee7f3285062b84190df62ee43d35e93955b315b94318b6eee06eae64e9c243d8a6ee2f729d115a94d80
6
+ metadata.gz: 0af0e5f72d6e30cd19fba159f80c94dfbdeda77f82ed289a09c9a3ca0582e899af9cf3ce4f7117a83cfba9f42e0c66e6984e9fb9727fc3a42d9f6aaf0d763676
7
+ data.tar.gz: 81ebebb202d9925f4ec4206c34f837dd71e9dc44c958ea07fdec14688044f2804bf12e0d8b5b1ad8eff7773aac2e08e23014a4e2a4a4c869975734b7ceceee01
data/.envrc ADDED
@@ -0,0 +1,2 @@
1
+ use nix
2
+ watch_file nix/gemset.nix
data/.gitignore CHANGED
@@ -15,3 +15,6 @@
15
15
 
16
16
  # RubyMine
17
17
  /.idea
18
+
19
+ # nixified bundle
20
+ /nix/vendor
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # The Changelog
2
2
 
3
+ ## Version 1.2.0: April 17, 2020
4
+ - nix developer setup (#28, thanks @arkham!)
5
+ - support scoped defined methods (with `def`) (#29, thanks @arkham!)
6
+
3
7
  ## Version 1.1.1: January 17, 2019
4
8
  - test fixes (#25)
5
9
  - more deterministic edge generation (#26)
data/README.md CHANGED
@@ -128,6 +128,13 @@ To install this gem onto your local machine, run `bundle exec rake install`.
128
128
 
129
129
  To release a new version, follow the instructions in [PUBLISHING.md](PUBLISHING.md).
130
130
 
131
+ ### Nix support
132
+
133
+ In order to get Nix working you need to have [direnv](https://github.com/direnv/direnv) installed. You will have to `direnv allow` to load the current `.envrc`. You can then run from the top level folder:
134
+
135
+ ```
136
+ ./nix/update-gemset.sh
137
+ ```
131
138
 
132
139
  ## Contributing
133
140
 
@@ -1,13 +1,15 @@
1
1
  module RailsEdgeTest::Dsl
2
- Action = Struct.new(:name, :controller_class) do
2
+ Action = Struct.new(:name, :controller) do
3
3
  def initialize(*args)
4
4
  super
5
5
  @edges = {}
6
6
  @let_handler = LetHandler.new
7
7
  end
8
8
 
9
+ delegate :controller_class, to: :controller
10
+
9
11
  def edge(description, &block)
10
- edge = Edge.new(description, name, controller_class)
12
+ edge = Edge.new(description, self)
11
13
  @edges[edge] = block
12
14
  end
13
15
 
@@ -26,5 +28,20 @@ module RailsEdgeTest::Dsl
26
28
  def __let_handler
27
29
  @let_handler
28
30
  end
31
+
32
+ # support calling methods defined in controller
33
+ def method_missing(method_name, *arguments, &block)
34
+ if controller.respond_to?(method_name)
35
+ controller.public_send(method_name, *arguments, &block)
36
+ else
37
+ super
38
+ end
39
+ end
40
+
41
+ # always define respond_to_missing? when defining method_missing:
42
+ # https://thoughtbot.com/blog/always-define-respond-to-missing-when-overriding
43
+ def respond_to_missing?(method_name, include_private = false)
44
+ controller.respond_to?(method_name) || super
45
+ end
29
46
  end
30
47
  end
@@ -7,7 +7,7 @@ module RailsEdgeTest::Dsl
7
7
  end
8
8
 
9
9
  def action(name, &block)
10
- new_action = Action.new(name, controller_class)
10
+ new_action = Action.new(name, self)
11
11
  new_action.instance_exec(&block)
12
12
  @actions << new_action
13
13
  end
@@ -3,19 +3,23 @@ require 'action_controller'
3
3
  require 'action_controller/test_case'
4
4
 
5
5
  module RailsEdgeTest::Dsl
6
- Edge = Struct.new(:description, :action, :controller_class) do
6
+ Edge = Struct.new(:description, :action) do
7
7
 
8
8
  def initialize(*args)
9
9
  super
10
10
  @let_cache = {}
11
11
  end
12
12
 
13
+ delegate :controller_class, to: :action
13
14
  delegate :session, to: :request
14
15
 
15
16
  def request
16
17
  @request ||= ActionController::TestRequest.create(controller_class)
17
18
  end
18
19
 
20
+ # In the context of the edge, we want `controller` to be the rails controller
21
+ # instead of our own RailsEdgeTest::Dsl::Controller. In this way the user can
22
+ # directly access the rails controller within their edge.
19
23
  def controller
20
24
  @controller ||= controller_class.new
21
25
  end
@@ -28,7 +32,7 @@ module RailsEdgeTest::Dsl
28
32
  request.assign_parameters(
29
33
  ::Rails.application.routes,
30
34
  controller_class.controller_path,
31
- action.to_s,
35
+ action.name.to_s,
32
36
  parameters.stringify_keys!,
33
37
  '',
34
38
  ''
@@ -38,7 +42,7 @@ module RailsEdgeTest::Dsl
38
42
  res.request = request
39
43
  end
40
44
 
41
- @response = controller.dispatch(action, request, response)
45
+ @response = controller.dispatch(action.name, request, response)
42
46
  end
43
47
 
44
48
  def produce_elm_file(module_name, ivar: nil)
@@ -69,6 +73,7 @@ module RailsEdgeTest::Dsl
69
73
  end
70
74
 
71
75
  private
76
+
72
77
  def produce_json(ivar: nil)
73
78
  unless response
74
79
  fail "Must perform a request (for example `perform_get`) before attempting to produce a json file."
@@ -100,5 +105,20 @@ module RailsEdgeTest::Dsl
100
105
  f.flush
101
106
  end
102
107
  end
108
+
109
+ # support calling methods defined in action
110
+ def method_missing(method_name, *arguments, &block)
111
+ if action.respond_to?(method_name)
112
+ action.public_send(method_name, *arguments, &block)
113
+ else
114
+ super
115
+ end
116
+ end
117
+
118
+ # always define respond_to_missing? when defining method_missing:
119
+ # https://thoughtbot.com/blog/always-define-respond-to-missing-when-overriding
120
+ def respond_to_missing?(method_name, include_private = false)
121
+ action.respond_to?(method_name) || super
122
+ end
103
123
  end
104
124
  end
@@ -50,6 +50,7 @@ module RailsEdgeTest
50
50
  end
51
51
 
52
52
  private
53
+
53
54
  def define_lets(edge, lets_handler)
54
55
  lets_handler.let_blocks.each do |title, block|
55
56
  edge.define_singleton_method(title) do
@@ -1,3 +1,3 @@
1
1
  module RailsEdgeTest
2
- VERSION = "1.1.1"
2
+ VERSION = "1.2.0"
3
3
  end
@@ -0,0 +1,3 @@
1
+ ---
2
+ BUNDLE_PATH: "vendor/bundle"
3
+ BUNDLE_CACHE_ALL: "true"
data/nix/Gemfile ADDED
@@ -0,0 +1,12 @@
1
+ # this is a copy of the dependencies listed in the gemspec,
2
+ # since bundix doesn't support reading the gemspec itself.
3
+ source 'https://rubygems.org'
4
+
5
+ gem 'actionpack', '~> 5.2'
6
+
7
+ group :development do
8
+ gem 'rails', '~> 5.2'
9
+ gem 'sqlite3', '~> 1.4.0'
10
+ gem 'rake', '~> 13.0'
11
+ gem 'rspec', '~> 3.9'
12
+ end
data/nix/Gemfile.lock ADDED
@@ -0,0 +1,138 @@
1
+ GEM
2
+ remote: https://rubygems.org/
3
+ specs:
4
+ actioncable (5.2.4.2)
5
+ actionpack (= 5.2.4.2)
6
+ nio4r (~> 2.0)
7
+ websocket-driver (>= 0.6.1)
8
+ actionmailer (5.2.4.2)
9
+ actionpack (= 5.2.4.2)
10
+ actionview (= 5.2.4.2)
11
+ activejob (= 5.2.4.2)
12
+ mail (~> 2.5, >= 2.5.4)
13
+ rails-dom-testing (~> 2.0)
14
+ actionpack (5.2.4.2)
15
+ actionview (= 5.2.4.2)
16
+ activesupport (= 5.2.4.2)
17
+ rack (~> 2.0, >= 2.0.8)
18
+ rack-test (>= 0.6.3)
19
+ rails-dom-testing (~> 2.0)
20
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
21
+ actionview (5.2.4.2)
22
+ activesupport (= 5.2.4.2)
23
+ builder (~> 3.1)
24
+ erubi (~> 1.4)
25
+ rails-dom-testing (~> 2.0)
26
+ rails-html-sanitizer (~> 1.0, >= 1.0.3)
27
+ activejob (5.2.4.2)
28
+ activesupport (= 5.2.4.2)
29
+ globalid (>= 0.3.6)
30
+ activemodel (5.2.4.2)
31
+ activesupport (= 5.2.4.2)
32
+ activerecord (5.2.4.2)
33
+ activemodel (= 5.2.4.2)
34
+ activesupport (= 5.2.4.2)
35
+ arel (>= 9.0)
36
+ activestorage (5.2.4.2)
37
+ actionpack (= 5.2.4.2)
38
+ activerecord (= 5.2.4.2)
39
+ marcel (~> 0.3.1)
40
+ activesupport (5.2.4.2)
41
+ concurrent-ruby (~> 1.0, >= 1.0.2)
42
+ i18n (>= 0.7, < 2)
43
+ minitest (~> 5.1)
44
+ tzinfo (~> 1.1)
45
+ arel (9.0.0)
46
+ builder (3.2.4)
47
+ concurrent-ruby (1.1.6)
48
+ crass (1.0.6)
49
+ diff-lcs (1.3)
50
+ erubi (1.9.0)
51
+ globalid (0.4.2)
52
+ activesupport (>= 4.2.0)
53
+ i18n (1.8.2)
54
+ concurrent-ruby (~> 1.0)
55
+ loofah (2.5.0)
56
+ crass (~> 1.0.2)
57
+ nokogiri (>= 1.5.9)
58
+ mail (2.7.1)
59
+ mini_mime (>= 0.1.1)
60
+ marcel (0.3.3)
61
+ mimemagic (~> 0.3.2)
62
+ method_source (1.0.0)
63
+ mimemagic (0.3.4)
64
+ mini_mime (1.0.2)
65
+ mini_portile2 (2.4.0)
66
+ minitest (5.14.0)
67
+ nio4r (2.5.2)
68
+ nokogiri (1.10.9)
69
+ mini_portile2 (~> 2.4.0)
70
+ rack (2.2.2)
71
+ rack-test (1.1.0)
72
+ rack (>= 1.0, < 3)
73
+ rails (5.2.4.2)
74
+ actioncable (= 5.2.4.2)
75
+ actionmailer (= 5.2.4.2)
76
+ actionpack (= 5.2.4.2)
77
+ actionview (= 5.2.4.2)
78
+ activejob (= 5.2.4.2)
79
+ activemodel (= 5.2.4.2)
80
+ activerecord (= 5.2.4.2)
81
+ activestorage (= 5.2.4.2)
82
+ activesupport (= 5.2.4.2)
83
+ bundler (>= 1.3.0)
84
+ railties (= 5.2.4.2)
85
+ sprockets-rails (>= 2.0.0)
86
+ rails-dom-testing (2.0.3)
87
+ activesupport (>= 4.2.0)
88
+ nokogiri (>= 1.6)
89
+ rails-html-sanitizer (1.3.0)
90
+ loofah (~> 2.3)
91
+ railties (5.2.4.2)
92
+ actionpack (= 5.2.4.2)
93
+ activesupport (= 5.2.4.2)
94
+ method_source
95
+ rake (>= 0.8.7)
96
+ thor (>= 0.19.0, < 2.0)
97
+ rake (13.0.1)
98
+ rspec (3.9.0)
99
+ rspec-core (~> 3.9.0)
100
+ rspec-expectations (~> 3.9.0)
101
+ rspec-mocks (~> 3.9.0)
102
+ rspec-core (3.9.1)
103
+ rspec-support (~> 3.9.1)
104
+ rspec-expectations (3.9.1)
105
+ diff-lcs (>= 1.2.0, < 2.0)
106
+ rspec-support (~> 3.9.0)
107
+ rspec-mocks (3.9.1)
108
+ diff-lcs (>= 1.2.0, < 2.0)
109
+ rspec-support (~> 3.9.0)
110
+ rspec-support (3.9.2)
111
+ sprockets (4.0.0)
112
+ concurrent-ruby (~> 1.0)
113
+ rack (> 1, < 3)
114
+ sprockets-rails (3.2.1)
115
+ actionpack (>= 4.0)
116
+ activesupport (>= 4.0)
117
+ sprockets (>= 3.0.0)
118
+ sqlite3 (1.4.2)
119
+ thor (1.0.1)
120
+ thread_safe (0.3.6)
121
+ tzinfo (1.2.7)
122
+ thread_safe (~> 0.1)
123
+ websocket-driver (0.7.1)
124
+ websocket-extensions (>= 0.1.0)
125
+ websocket-extensions (0.1.4)
126
+
127
+ PLATFORMS
128
+ ruby
129
+
130
+ DEPENDENCIES
131
+ actionpack (~> 5.2)
132
+ rails (~> 5.2)
133
+ rake (~> 13.0)
134
+ rspec (~> 3.9)
135
+ sqlite3 (~> 1.4.0)
136
+
137
+ BUNDLED WITH
138
+ 1.17.3
data/nix/gemset.nix ADDED
@@ -0,0 +1,500 @@
1
+ {
2
+ actioncable = {
3
+ dependencies = ["actionpack" "nio4r" "websocket-driver"];
4
+ groups = ["default" "development"];
5
+ platforms = [];
6
+ source = {
7
+ remotes = ["https://rubygems.org"];
8
+ sha256 = "0q4by8d41n972j8cdcddrwsh7qphcki50xvgm1syrawyck6w1f5v";
9
+ type = "gem";
10
+ };
11
+ version = "5.2.4.2";
12
+ };
13
+ actionmailer = {
14
+ dependencies = ["actionpack" "actionview" "activejob" "mail" "rails-dom-testing"];
15
+ groups = ["default" "development"];
16
+ platforms = [];
17
+ source = {
18
+ remotes = ["https://rubygems.org"];
19
+ sha256 = "0kg2nayy8wmxhfp52217h80yqr0mcg793xw3cjlfg9lkvdh0nb5z";
20
+ type = "gem";
21
+ };
22
+ version = "5.2.4.2";
23
+ };
24
+ actionpack = {
25
+ dependencies = ["actionview" "activesupport" "rack" "rack-test" "rails-dom-testing" "rails-html-sanitizer"];
26
+ groups = ["default" "development"];
27
+ platforms = [];
28
+ source = {
29
+ remotes = ["https://rubygems.org"];
30
+ sha256 = "1w1l9i6q9xns4yl41l582pyc5i1xi40yyyq802drm58gwylv3wax";
31
+ type = "gem";
32
+ };
33
+ version = "5.2.4.2";
34
+ };
35
+ actionview = {
36
+ dependencies = ["activesupport" "builder" "erubi" "rails-dom-testing" "rails-html-sanitizer"];
37
+ groups = ["default" "development"];
38
+ platforms = [];
39
+ source = {
40
+ remotes = ["https://rubygems.org"];
41
+ sha256 = "0fp3my6216lb9gp800s46y0404jwfl6xb3j9rvx4zf087497q8lp";
42
+ type = "gem";
43
+ };
44
+ version = "5.2.4.2";
45
+ };
46
+ activejob = {
47
+ dependencies = ["activesupport" "globalid"];
48
+ groups = ["default" "development"];
49
+ platforms = [];
50
+ source = {
51
+ remotes = ["https://rubygems.org"];
52
+ sha256 = "1qsvb89rwqrp779mvpn67qbzidg2q6d1fa8kwybvpc93nzb9zpvi";
53
+ type = "gem";
54
+ };
55
+ version = "5.2.4.2";
56
+ };
57
+ activemodel = {
58
+ dependencies = ["activesupport"];
59
+ groups = ["default" "development"];
60
+ platforms = [];
61
+ source = {
62
+ remotes = ["https://rubygems.org"];
63
+ sha256 = "0jcfdv00kmifj86d0z347nw55q1f8vwzr1aa9jrfnwz47ndi22di";
64
+ type = "gem";
65
+ };
66
+ version = "5.2.4.2";
67
+ };
68
+ activerecord = {
69
+ dependencies = ["activemodel" "activesupport" "arel"];
70
+ groups = ["default" "development"];
71
+ platforms = [];
72
+ source = {
73
+ remotes = ["https://rubygems.org"];
74
+ sha256 = "1yaqrh23c8krrjw6rvxv7pvnkpp46nk5aq9z2daby640si4xpmp5";
75
+ type = "gem";
76
+ };
77
+ version = "5.2.4.2";
78
+ };
79
+ activestorage = {
80
+ dependencies = ["actionpack" "activerecord" "marcel"];
81
+ groups = ["default" "development"];
82
+ platforms = [];
83
+ source = {
84
+ remotes = ["https://rubygems.org"];
85
+ sha256 = "1d51zp17c9k4brivm8y46rszcz07s5rb75gmkm0dpzg3rz3v38s9";
86
+ type = "gem";
87
+ };
88
+ version = "5.2.4.2";
89
+ };
90
+ activesupport = {
91
+ dependencies = ["concurrent-ruby" "i18n" "minitest" "tzinfo"];
92
+ groups = ["default" "development"];
93
+ platforms = [];
94
+ source = {
95
+ remotes = ["https://rubygems.org"];
96
+ sha256 = "0y1397g5xxinjyxjsdmp8c92yn0y3bd2hl4wbmmrpd08bggy6flc";
97
+ type = "gem";
98
+ };
99
+ version = "5.2.4.2";
100
+ };
101
+ arel = {
102
+ groups = ["default" "development"];
103
+ platforms = [];
104
+ source = {
105
+ remotes = ["https://rubygems.org"];
106
+ sha256 = "1jk7wlmkr61f6g36w9s2sn46nmdg6wn2jfssrhbhirv5x9n95nk0";
107
+ type = "gem";
108
+ };
109
+ version = "9.0.0";
110
+ };
111
+ builder = {
112
+ groups = ["default" "development"];
113
+ platforms = [];
114
+ source = {
115
+ remotes = ["https://rubygems.org"];
116
+ sha256 = "045wzckxpwcqzrjr353cxnyaxgf0qg22jh00dcx7z38cys5g1jlr";
117
+ type = "gem";
118
+ };
119
+ version = "3.2.4";
120
+ };
121
+ concurrent-ruby = {
122
+ groups = ["default" "development"];
123
+ platforms = [];
124
+ source = {
125
+ remotes = ["https://rubygems.org"];
126
+ sha256 = "094387x4yasb797mv07cs3g6f08y56virc2rjcpb1k79rzaj3nhl";
127
+ type = "gem";
128
+ };
129
+ version = "1.1.6";
130
+ };
131
+ crass = {
132
+ groups = ["default" "development"];
133
+ platforms = [];
134
+ source = {
135
+ remotes = ["https://rubygems.org"];
136
+ sha256 = "0pfl5c0pyqaparxaqxi6s4gfl21bdldwiawrc0aknyvflli60lfw";
137
+ type = "gem";
138
+ };
139
+ version = "1.0.6";
140
+ };
141
+ diff-lcs = {
142
+ groups = ["default" "development"];
143
+ platforms = [];
144
+ source = {
145
+ remotes = ["https://rubygems.org"];
146
+ sha256 = "18w22bjz424gzafv6nzv98h0aqkwz3d9xhm7cbr1wfbyas8zayza";
147
+ type = "gem";
148
+ };
149
+ version = "1.3";
150
+ };
151
+ erubi = {
152
+ groups = ["default" "development"];
153
+ platforms = [];
154
+ source = {
155
+ remotes = ["https://rubygems.org"];
156
+ sha256 = "1nwzxnqhr31fn7nbqmffcysvxjdfl3bhxi0bld5qqhcnfc1xd13x";
157
+ type = "gem";
158
+ };
159
+ version = "1.9.0";
160
+ };
161
+ globalid = {
162
+ dependencies = ["activesupport"];
163
+ groups = ["default" "development"];
164
+ platforms = [];
165
+ source = {
166
+ remotes = ["https://rubygems.org"];
167
+ sha256 = "1zkxndvck72bfw235bd9nl2ii0lvs5z88q14706cmn702ww2mxv1";
168
+ type = "gem";
169
+ };
170
+ version = "0.4.2";
171
+ };
172
+ i18n = {
173
+ dependencies = ["concurrent-ruby"];
174
+ groups = ["default" "development"];
175
+ platforms = [];
176
+ source = {
177
+ remotes = ["https://rubygems.org"];
178
+ sha256 = "0jwrd1l4mxz06iyx6053lr6hz2zy7ah2k3ranfzisvych5q19kwm";
179
+ type = "gem";
180
+ };
181
+ version = "1.8.2";
182
+ };
183
+ loofah = {
184
+ dependencies = ["crass" "nokogiri"];
185
+ groups = ["default" "development"];
186
+ platforms = [];
187
+ source = {
188
+ remotes = ["https://rubygems.org"];
189
+ sha256 = "0jk9fgn5ayzbqvzqm11gbkqvas77zdbpkvynlylyiwynclgrn040";
190
+ type = "gem";
191
+ };
192
+ version = "2.5.0";
193
+ };
194
+ mail = {
195
+ dependencies = ["mini_mime"];
196
+ groups = ["default" "development"];
197
+ platforms = [];
198
+ source = {
199
+ remotes = ["https://rubygems.org"];
200
+ sha256 = "00wwz6ys0502dpk8xprwcqfwyf3hmnx6lgxaiq6vj43mkx43sapc";
201
+ type = "gem";
202
+ };
203
+ version = "2.7.1";
204
+ };
205
+ marcel = {
206
+ dependencies = ["mimemagic"];
207
+ groups = ["default" "development"];
208
+ platforms = [];
209
+ source = {
210
+ remotes = ["https://rubygems.org"];
211
+ sha256 = "1nxbjmcyg8vlw6zwagf17l9y2mwkagmmkg95xybpn4bmf3rfnksx";
212
+ type = "gem";
213
+ };
214
+ version = "0.3.3";
215
+ };
216
+ method_source = {
217
+ groups = ["default" "development"];
218
+ platforms = [];
219
+ source = {
220
+ remotes = ["https://rubygems.org"];
221
+ sha256 = "1pnyh44qycnf9mzi1j6fywd5fkskv3x7nmsqrrws0rjn5dd4ayfp";
222
+ type = "gem";
223
+ };
224
+ version = "1.0.0";
225
+ };
226
+ mimemagic = {
227
+ groups = ["default" "development"];
228
+ platforms = [];
229
+ source = {
230
+ remotes = ["https://rubygems.org"];
231
+ sha256 = "0frrfvz52fh4v1sb2xr9pyxhrxm5f7jppqxagpmd7c5ific66l9p";
232
+ type = "gem";
233
+ };
234
+ version = "0.3.4";
235
+ };
236
+ mini_mime = {
237
+ groups = ["default" "development"];
238
+ platforms = [];
239
+ source = {
240
+ remotes = ["https://rubygems.org"];
241
+ sha256 = "1axm0rxyx3ss93wbmfkm78a6x03l8y4qy60rhkkiq0aza0vwq3ha";
242
+ type = "gem";
243
+ };
244
+ version = "1.0.2";
245
+ };
246
+ mini_portile2 = {
247
+ groups = ["default" "development"];
248
+ platforms = [];
249
+ source = {
250
+ remotes = ["https://rubygems.org"];
251
+ sha256 = "15zplpfw3knqifj9bpf604rb3wc1vhq6363pd6lvhayng8wql5vy";
252
+ type = "gem";
253
+ };
254
+ version = "2.4.0";
255
+ };
256
+ minitest = {
257
+ groups = ["default" "development"];
258
+ platforms = [];
259
+ source = {
260
+ remotes = ["https://rubygems.org"];
261
+ sha256 = "0g73x65hmjph8dg1h3rkzfg7ys3ffxm35hj35grw75fixmq53qyz";
262
+ type = "gem";
263
+ };
264
+ version = "5.14.0";
265
+ };
266
+ nio4r = {
267
+ groups = ["default" "development"];
268
+ platforms = [];
269
+ source = {
270
+ remotes = ["https://rubygems.org"];
271
+ sha256 = "0gnmvbryr521r135yz5bv8354m7xn6miiapfgpg1bnwsvxz8xj6c";
272
+ type = "gem";
273
+ };
274
+ version = "2.5.2";
275
+ };
276
+ nokogiri = {
277
+ dependencies = ["mini_portile2"];
278
+ groups = ["default" "development"];
279
+ platforms = [];
280
+ source = {
281
+ remotes = ["https://rubygems.org"];
282
+ sha256 = "12j76d0bp608932xkzmfi638c7aqah57l437q8494znzbj610qnm";
283
+ type = "gem";
284
+ };
285
+ version = "1.10.9";
286
+ };
287
+ rack = {
288
+ groups = ["default" "development"];
289
+ platforms = [];
290
+ source = {
291
+ remotes = ["https://rubygems.org"];
292
+ sha256 = "10mp9s48ssnw004aksq90gvhdvwczh8j6q82q2kqiqq92jd1zxbp";
293
+ type = "gem";
294
+ };
295
+ version = "2.2.2";
296
+ };
297
+ rack-test = {
298
+ dependencies = ["rack"];
299
+ groups = ["default" "development"];
300
+ platforms = [];
301
+ source = {
302
+ remotes = ["https://rubygems.org"];
303
+ sha256 = "0rh8h376mx71ci5yklnpqqn118z3bl67nnv5k801qaqn1zs62h8m";
304
+ type = "gem";
305
+ };
306
+ version = "1.1.0";
307
+ };
308
+ rails = {
309
+ dependencies = ["actioncable" "actionmailer" "actionpack" "actionview" "activejob" "activemodel" "activerecord" "activestorage" "activesupport" "railties" "sprockets-rails"];
310
+ groups = ["development"];
311
+ platforms = [];
312
+ source = {
313
+ remotes = ["https://rubygems.org"];
314
+ sha256 = "1x8k6n4yziwf386prhvr9d9plc9fwv0j8spw2bnmkwhf54v2ias4";
315
+ type = "gem";
316
+ };
317
+ version = "5.2.4.2";
318
+ };
319
+ rails-dom-testing = {
320
+ dependencies = ["activesupport" "nokogiri"];
321
+ groups = ["default" "development"];
322
+ platforms = [];
323
+ source = {
324
+ remotes = ["https://rubygems.org"];
325
+ sha256 = "1lfq2a7kp2x64dzzi5p4cjcbiv62vxh9lyqk2f0rqq3fkzrw8h5i";
326
+ type = "gem";
327
+ };
328
+ version = "2.0.3";
329
+ };
330
+ rails-html-sanitizer = {
331
+ dependencies = ["loofah"];
332
+ groups = ["default" "development"];
333
+ platforms = [];
334
+ source = {
335
+ remotes = ["https://rubygems.org"];
336
+ sha256 = "1icpqmxbppl4ynzmn6dx7wdil5hhq6fz707m9ya6d86c7ys8sd4f";
337
+ type = "gem";
338
+ };
339
+ version = "1.3.0";
340
+ };
341
+ railties = {
342
+ dependencies = ["actionpack" "activesupport" "method_source" "rake" "thor"];
343
+ groups = ["default" "development"];
344
+ platforms = [];
345
+ source = {
346
+ remotes = ["https://rubygems.org"];
347
+ sha256 = "1p2rnd1xdqlk19k3m5gd058yzvwjj25k5hwn4km683b5dhylpd16";
348
+ type = "gem";
349
+ };
350
+ version = "5.2.4.2";
351
+ };
352
+ rake = {
353
+ groups = ["development"];
354
+ platforms = [];
355
+ source = {
356
+ remotes = ["https://rubygems.org"];
357
+ sha256 = "0w6qza25bq1s825faaglkx1k6d59aiyjjk3yw3ip5sb463mhhai9";
358
+ type = "gem";
359
+ };
360
+ version = "13.0.1";
361
+ };
362
+ rspec = {
363
+ dependencies = ["rspec-core" "rspec-expectations" "rspec-mocks"];
364
+ groups = ["development"];
365
+ platforms = [];
366
+ source = {
367
+ remotes = ["https://rubygems.org"];
368
+ sha256 = "1hzsig4pi9ybr0xl5540m1swiyxa74c8h09225y5sdh2rjkkg84h";
369
+ type = "gem";
370
+ };
371
+ version = "3.9.0";
372
+ };
373
+ rspec-core = {
374
+ dependencies = ["rspec-support"];
375
+ groups = ["default" "development"];
376
+ platforms = [];
377
+ source = {
378
+ remotes = ["https://rubygems.org"];
379
+ sha256 = "1qzc1wdjb1qnbimjl8i1q1r1z5hdv2lmcw7ysz7jawj4d1cvpqvd";
380
+ type = "gem";
381
+ };
382
+ version = "3.9.1";
383
+ };
384
+ rspec-expectations = {
385
+ dependencies = ["diff-lcs" "rspec-support"];
386
+ groups = ["default" "development"];
387
+ platforms = [];
388
+ source = {
389
+ remotes = ["https://rubygems.org"];
390
+ sha256 = "0fjbwvq7qaz6h3sh1bs9q2qiy4zwcrc8f7xwv82dx2bc09dmqzhd";
391
+ type = "gem";
392
+ };
393
+ version = "3.9.1";
394
+ };
395
+ rspec-mocks = {
396
+ dependencies = ["diff-lcs" "rspec-support"];
397
+ groups = ["default" "development"];
398
+ platforms = [];
399
+ source = {
400
+ remotes = ["https://rubygems.org"];
401
+ sha256 = "19vmdqym1v2g1zbdnq37zwmyj87y9yc9ijwc8js55igvbb9hx0mr";
402
+ type = "gem";
403
+ };
404
+ version = "3.9.1";
405
+ };
406
+ rspec-support = {
407
+ groups = ["default" "development"];
408
+ platforms = [];
409
+ source = {
410
+ remotes = ["https://rubygems.org"];
411
+ sha256 = "1zwpyq1na23pvgacpxs2v9nwfbjbw6x3arca5j3l1xagigqmzhc3";
412
+ type = "gem";
413
+ };
414
+ version = "3.9.2";
415
+ };
416
+ sprockets = {
417
+ dependencies = ["concurrent-ruby" "rack"];
418
+ groups = ["default" "development"];
419
+ platforms = [];
420
+ source = {
421
+ remotes = ["https://rubygems.org"];
422
+ sha256 = "0jm37zpvvm1arxjwrd6am0wrdbfhrhc5y0l4p2i3p11z04bsvgap";
423
+ type = "gem";
424
+ };
425
+ version = "4.0.0";
426
+ };
427
+ sprockets-rails = {
428
+ dependencies = ["actionpack" "activesupport" "sprockets"];
429
+ groups = ["default" "development"];
430
+ platforms = [];
431
+ source = {
432
+ remotes = ["https://rubygems.org"];
433
+ sha256 = "0ab42pm8p5zxpv3sfraq45b9lj39cz9mrpdirm30vywzrwwkm5p1";
434
+ type = "gem";
435
+ };
436
+ version = "3.2.1";
437
+ };
438
+ sqlite3 = {
439
+ groups = ["development"];
440
+ platforms = [];
441
+ source = {
442
+ remotes = ["https://rubygems.org"];
443
+ sha256 = "0lja01cp9xd5m6vmx99zwn4r7s97r1w5cb76gqd8xhbm1wxyzf78";
444
+ type = "gem";
445
+ };
446
+ version = "1.4.2";
447
+ };
448
+ thor = {
449
+ groups = ["default" "development"];
450
+ platforms = [];
451
+ source = {
452
+ remotes = ["https://rubygems.org"];
453
+ sha256 = "1xbhkmyhlxwzshaqa7swy2bx6vd64mm0wrr8g3jywvxy7hg0cwkm";
454
+ type = "gem";
455
+ };
456
+ version = "1.0.1";
457
+ };
458
+ thread_safe = {
459
+ groups = ["default" "development"];
460
+ platforms = [];
461
+ source = {
462
+ remotes = ["https://rubygems.org"];
463
+ sha256 = "0nmhcgq6cgz44srylra07bmaw99f5271l0dpsvl5f75m44l0gmwy";
464
+ type = "gem";
465
+ };
466
+ version = "0.3.6";
467
+ };
468
+ tzinfo = {
469
+ dependencies = ["thread_safe"];
470
+ groups = ["default" "development"];
471
+ platforms = [];
472
+ source = {
473
+ remotes = ["https://rubygems.org"];
474
+ sha256 = "1i3jh086w1kbdj3k5l60lc3nwbanmzdf8yjj3mlrx9b2gjjxhi9r";
475
+ type = "gem";
476
+ };
477
+ version = "1.2.7";
478
+ };
479
+ websocket-driver = {
480
+ dependencies = ["websocket-extensions"];
481
+ groups = ["default" "development"];
482
+ platforms = [];
483
+ source = {
484
+ remotes = ["https://rubygems.org"];
485
+ sha256 = "1bxamwqldmy98hxs5pqby3andws14hl36ch78g0s81gaz9b91nj2";
486
+ type = "gem";
487
+ };
488
+ version = "0.7.1";
489
+ };
490
+ websocket-extensions = {
491
+ groups = ["default" "development"];
492
+ platforms = [];
493
+ source = {
494
+ remotes = ["https://rubygems.org"];
495
+ sha256 = "00i624ng1nvkz1yckj3f8yxxp6hi7xaqf40qh9q3hj2n1l9i8g6m";
496
+ type = "gem";
497
+ };
498
+ version = "0.1.4";
499
+ };
500
+ }
data/nix/sources.json ADDED
@@ -0,0 +1,26 @@
1
+ {
2
+ "niv": {
3
+ "branch": "master",
4
+ "description": "Easy dependency management for Nix projects",
5
+ "homepage": "https://github.com/nmattia/niv",
6
+ "owner": "nmattia",
7
+ "repo": "niv",
8
+ "rev": "5b5508f85567e82d97e7c1a5a0aa87e131ebab39",
9
+ "sha256": "0daa6gidnjbvxsmy5cl0w1h902qslc821hghppzi63q7qxg1pvr3",
10
+ "type": "tarball",
11
+ "url": "https://github.com/nmattia/niv/archive/5b5508f85567e82d97e7c1a5a0aa87e131ebab39.tar.gz",
12
+ "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
13
+ },
14
+ "nixpkgs": {
15
+ "branch": "nixos-19.09",
16
+ "description": "A read-only mirror of NixOS/nixpkgs tracking the released channels. Send issues and PRs to",
17
+ "homepage": "https://github.com/NixOS/nixpkgs",
18
+ "owner": "NixOS",
19
+ "repo": "nixpkgs-channels",
20
+ "rev": "6d445f8398d2d585d20d9acacf00fd9d15081b3b",
21
+ "sha256": "1ajd0zr31iny3g9hp0pc1y2pxcm3nakdv6260lnvyn0k4vygync2",
22
+ "type": "tarball",
23
+ "url": "https://github.com/NixOS/nixpkgs-channels/archive/6d445f8398d2d585d20d9acacf00fd9d15081b3b.tar.gz",
24
+ "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
25
+ }
26
+ }
data/nix/sources.nix ADDED
@@ -0,0 +1,134 @@
1
+ # This file has been generated by Niv.
2
+
3
+ let
4
+
5
+ #
6
+ # The fetchers. fetch_<type> fetches specs of type <type>.
7
+ #
8
+
9
+ fetch_file = pkgs: spec:
10
+ if spec.builtin or true then
11
+ builtins_fetchurl { inherit (spec) url sha256; }
12
+ else
13
+ pkgs.fetchurl { inherit (spec) url sha256; };
14
+
15
+ fetch_tarball = pkgs: spec:
16
+ if spec.builtin or true then
17
+ builtins_fetchTarball { inherit (spec) url sha256; }
18
+ else
19
+ pkgs.fetchzip { inherit (spec) url sha256; };
20
+
21
+ fetch_git = spec:
22
+ builtins.fetchGit { url = spec.repo; inherit (spec) rev ref; };
23
+
24
+ fetch_builtin-tarball = spec:
25
+ builtins.trace
26
+ ''
27
+ WARNING:
28
+ The niv type "builtin-tarball" will soon be deprecated. You should
29
+ instead use `builtin = true`.
30
+
31
+ $ niv modify <package> -a type=tarball -a builtin=true
32
+ ''
33
+ builtins_fetchTarball { inherit (spec) url sha256; };
34
+
35
+ fetch_builtin-url = spec:
36
+ builtins.trace
37
+ ''
38
+ WARNING:
39
+ The niv type "builtin-url" will soon be deprecated. You should
40
+ instead use `builtin = true`.
41
+
42
+ $ niv modify <package> -a type=file -a builtin=true
43
+ ''
44
+ (builtins_fetchurl { inherit (spec) url sha256; });
45
+
46
+ #
47
+ # Various helpers
48
+ #
49
+
50
+ # The set of packages used when specs are fetched using non-builtins.
51
+ mkPkgs = sources:
52
+ let
53
+ sourcesNixpkgs =
54
+ import (builtins_fetchTarball { inherit (sources.nixpkgs) url sha256; }) {};
55
+ hasNixpkgsPath = builtins.any (x: x.prefix == "nixpkgs") builtins.nixPath;
56
+ hasThisAsNixpkgsPath = <nixpkgs> == ./.;
57
+ in
58
+ if builtins.hasAttr "nixpkgs" sources
59
+ then sourcesNixpkgs
60
+ else if hasNixpkgsPath && ! hasThisAsNixpkgsPath then
61
+ import <nixpkgs> {}
62
+ else
63
+ abort
64
+ ''
65
+ Please specify either <nixpkgs> (through -I or NIX_PATH=nixpkgs=...) or
66
+ add a package called "nixpkgs" to your sources.json.
67
+ '';
68
+
69
+ # The actual fetching function.
70
+ fetch = pkgs: name: spec:
71
+
72
+ if ! builtins.hasAttr "type" spec then
73
+ abort "ERROR: niv spec ${name} does not have a 'type' attribute"
74
+ else if spec.type == "file" then fetch_file pkgs spec
75
+ else if spec.type == "tarball" then fetch_tarball pkgs spec
76
+ else if spec.type == "git" then fetch_git spec
77
+ else if spec.type == "builtin-tarball" then fetch_builtin-tarball spec
78
+ else if spec.type == "builtin-url" then fetch_builtin-url spec
79
+ else
80
+ abort "ERROR: niv spec ${name} has unknown type ${builtins.toJSON spec.type}";
81
+
82
+ # Ports of functions for older nix versions
83
+
84
+ # a Nix version of mapAttrs if the built-in doesn't exist
85
+ mapAttrs = builtins.mapAttrs or (
86
+ f: set: with builtins;
87
+ listToAttrs (map (attr: { name = attr; value = f attr set.${attr}; }) (attrNames set))
88
+ );
89
+
90
+ # fetchTarball version that is compatible between all the versions of Nix
91
+ builtins_fetchTarball = { url, sha256 }@attrs:
92
+ let
93
+ inherit (builtins) lessThan nixVersion fetchTarball;
94
+ in
95
+ if lessThan nixVersion "1.12" then
96
+ fetchTarball { inherit url; }
97
+ else
98
+ fetchTarball attrs;
99
+
100
+ # fetchurl version that is compatible between all the versions of Nix
101
+ builtins_fetchurl = { url, sha256 }@attrs:
102
+ let
103
+ inherit (builtins) lessThan nixVersion fetchurl;
104
+ in
105
+ if lessThan nixVersion "1.12" then
106
+ fetchurl { inherit url; }
107
+ else
108
+ fetchurl attrs;
109
+
110
+ # Create the final "sources" from the config
111
+ mkSources = config:
112
+ mapAttrs (
113
+ name: spec:
114
+ if builtins.hasAttr "outPath" spec
115
+ then abort
116
+ "The values in sources.json should not have an 'outPath' attribute"
117
+ else
118
+ spec // { outPath = fetch config.pkgs name spec; }
119
+ ) config.sources;
120
+
121
+ # The "config" used by the fetchers
122
+ mkConfig =
123
+ { sourcesFile ? ./sources.json
124
+ , sources ? builtins.fromJSON (builtins.readFile sourcesFile)
125
+ , pkgs ? mkPkgs sources
126
+ }: rec {
127
+ # The sources, i.e. the attribute set of spec name to spec
128
+ inherit sources;
129
+
130
+ # The "pkgs" (evaluated nixpkgs) to use for e.g. non-builtin fetchers
131
+ inherit pkgs;
132
+ };
133
+ in
134
+ mkSources (mkConfig {}) // { __functor = _: settings: mkSources (mkConfig settings); }
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env nix-shell
2
+ #!nix-shell -i bash -p zlib sqlite libiconv bundix
3
+
4
+ SCRIPT=`realpath $0`
5
+ CWD=`dirname $SCRIPT`
6
+
7
+ cd $CWD && bundix -m --ruby=ruby_2_5
@@ -6,7 +6,7 @@ require 'rails_edge_test/version'
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "rails_edge_test"
8
8
  spec.version = RailsEdgeTest::VERSION
9
- spec.authors = ["Joshua Leven"]
9
+ spec.authors = ["Joshua Leven", "Ju Liu"]
10
10
  spec.email = ["josh@noredink.com"]
11
11
 
12
12
  spec.summary = %q{Generate json for front-end testing using your rails backend.}
@@ -25,7 +25,6 @@ Gem::Specification.new do |spec|
25
25
 
26
26
  spec.add_development_dependency "rails", "~> 5.2"
27
27
  spec.add_development_dependency "sqlite3", "~> 1.4.0"
28
- spec.add_development_dependency "bundler", "~> 2.0"
29
- spec.add_development_dependency "rake", "~> 12.3"
30
- spec.add_development_dependency "rspec", "~> 3.8"
28
+ spec.add_development_dependency "rake", "~> 13.0"
29
+ spec.add_development_dependency "rspec", "~> 3.9"
31
30
  end
data/shell.nix ADDED
@@ -0,0 +1,16 @@
1
+ { ... }:
2
+ let
3
+ sources = import ./nix/sources.nix { };
4
+ nixpkgs = import sources.nixpkgs { };
5
+ gems = nixpkgs.bundlerEnv {
6
+ name = "rails_edge_test";
7
+ gemfile = nix/Gemfile;
8
+ lockfile = nix/Gemfile.lock;
9
+ ruby = nixpkgs.ruby_2_5;
10
+ gemdir = ./nix;
11
+ };
12
+ in with nixpkgs;
13
+ stdenv.mkDerivation {
14
+ name = "rails_edge_test";
15
+ buildInputs = [ gems gems.wrappedRuby ];
16
+ }
metadata CHANGED
@@ -1,14 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_edge_test
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshua Leven
8
+ - Ju Liu
8
9
  autorequire:
9
10
  bindir: exe
10
11
  cert_chain: []
11
- date: 2020-01-17 00:00:00.000000000 Z
12
+ date: 1970-01-01 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: actionpack
@@ -52,48 +53,34 @@ dependencies:
52
53
  - - "~>"
53
54
  - !ruby/object:Gem::Version
54
55
  version: 1.4.0
55
- - !ruby/object:Gem::Dependency
56
- name: bundler
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: '2.0'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: '2.0'
69
56
  - !ruby/object:Gem::Dependency
70
57
  name: rake
71
58
  requirement: !ruby/object:Gem::Requirement
72
59
  requirements:
73
60
  - - "~>"
74
61
  - !ruby/object:Gem::Version
75
- version: '12.3'
62
+ version: '13.0'
76
63
  type: :development
77
64
  prerelease: false
78
65
  version_requirements: !ruby/object:Gem::Requirement
79
66
  requirements:
80
67
  - - "~>"
81
68
  - !ruby/object:Gem::Version
82
- version: '12.3'
69
+ version: '13.0'
83
70
  - !ruby/object:Gem::Dependency
84
71
  name: rspec
85
72
  requirement: !ruby/object:Gem::Requirement
86
73
  requirements:
87
74
  - - "~>"
88
75
  - !ruby/object:Gem::Version
89
- version: '3.8'
76
+ version: '3.9'
90
77
  type: :development
91
78
  prerelease: false
92
79
  version_requirements: !ruby/object:Gem::Requirement
93
80
  requirements:
94
81
  - - "~>"
95
82
  - !ruby/object:Gem::Version
96
- version: '3.8'
83
+ version: '3.9'
97
84
  description: Keep your backend and front-end specs in sync! The rails_edge_test gem
98
85
  provides a dsl and rake task that uses your Rails app to generate json and appropriate
99
86
  wrapper files for use in your front-end testing.
@@ -104,6 +91,7 @@ executables:
104
91
  extensions: []
105
92
  extra_rdoc_files: []
106
93
  files:
94
+ - ".envrc"
107
95
  - ".gitignore"
108
96
  - ".rspec"
109
97
  - ".travis.yml"
@@ -129,7 +117,15 @@ files:
129
117
  - lib/rails_edge_test/printers/tree.rb
130
118
  - lib/rails_edge_test/runner.rb
131
119
  - lib/rails_edge_test/version.rb
120
+ - nix/.bundle/config
121
+ - nix/Gemfile
122
+ - nix/Gemfile.lock
123
+ - nix/gemset.nix
124
+ - nix/sources.json
125
+ - nix/sources.nix
126
+ - nix/update-gemset.sh
132
127
  - rails_edge_test.gemspec
128
+ - shell.nix
133
129
  homepage: https://github.com/NoRedInk/rails_edge_test
134
130
  licenses:
135
131
  - MIT
@@ -149,7 +145,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
149
145
  - !ruby/object:Gem::Version
150
146
  version: '0'
151
147
  requirements: []
152
- rubygems_version: 3.1.2
148
+ rubygems_version: 3.0.6
153
149
  signing_key:
154
150
  specification_version: 4
155
151
  summary: Generate json for front-end testing using your rails backend.