aygabtu 0.2.0 → 0.3.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
  SHA1:
3
- metadata.gz: b6b0b899e98b001d66c42529c6070b7b5cd49129
4
- data.tar.gz: 28884477631fe89aa365216d2ad84355d0748c04
3
+ metadata.gz: 820b903bfa3013e8b888d87c17d5c378fae75ecd
4
+ data.tar.gz: d2d923d2c5eeb6bc6f053d80daa871c5b6e251ed
5
5
  SHA512:
6
- metadata.gz: 3d45b28adaf1d9ce713ca993aae6ef8405d0378f4e1ec9508c26d75a378f87619443c597c6238b0994735b3c04a16113fa02df0d30774f51d5da2b08e1529873
7
- data.tar.gz: cc8db6af0efc3e617c64155f1755c87f0c1d25ff6ab95aa0671415e7055f2da4cebb3b4c3b1505f5906d84c9845d1f5137010f134981a178ac94b62c9dc8bbb5
6
+ metadata.gz: 7a78573431064dfe833d44a863991f901cf61b9cae68b359343df51b05c571c0b39f00f23dc07a1c2bbb3ebf2d7d755dfa2d853aed21245b4d29c3a0c7733ed9
7
+ data.tar.gz: 7758b5b65c947f5c9b9f35f42469378294a925915ae1c9ed75a2d6c6b09f976ad706a13c577f2dd4f4a0bf4859335f9ca7621f083487f695f6b8f3c2522e26af
@@ -1,7 +1,7 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 1.9.3
4
3
  - 2.1.1
4
+ - 2.2.4
5
5
  env:
6
6
  - RAILS_VERSION="~> 4.1.0" RSPEC_VERSION="~> 2.0"
7
7
  - RAILS_VERSION="~> 4.1.0" RSPEC_VERSION="~> 3.0"
@@ -1,3 +1,17 @@
1
+ ## 0.3.0 (2016-03-01)
2
+
3
+ Breaking change:
4
+
5
+ - dropped support for ruby 1.9.3, added ruby 2.2 to CI matrix
6
+
7
+ Improvements
8
+
9
+ - documentation
10
+
11
+ New feature:
12
+
13
+ - aygabtu_select_route? extension point
14
+
1
15
  ## 0.2.0 (2015-04-28)
2
16
 
3
17
  Breaking change:
data/Gemfile CHANGED
@@ -6,3 +6,5 @@ gemspec
6
6
  gem 'rake'
7
7
  gem 'rails', ENV['RAILS_VERSION'] || '~> 0'
8
8
  gem 'rspec', ENV['RSPEC_VERSION'] || '~> 0'
9
+
10
+ gem 'test-unit' if RUBY_VERSION.start_with?('2.2')
data/README.md CHANGED
@@ -32,13 +32,14 @@ Or install it yourself as:
32
32
  Create `spec/features/aygabtu_features_spec.rb` with the following content:
33
33
 
34
34
  ```
35
- require 'spec_helper' # or whatever is necessary to initialize your Rails app and configure rspec and capybara
35
+ require 'rails_helper'
36
36
 
37
37
  require 'aygabtu/rspec'
38
38
 
39
39
  describe "Aygabtu generated features", type: :feature do
40
40
  include Aygabtu::RSpec.example_group_module
41
41
 
42
+ # callback method for asserting against a loaded page
42
43
  def aygabtu_assertions
43
44
  aygabtu_assert_status_success
44
45
  aygabtu_assert_not_redirected_away
@@ -48,7 +49,7 @@ describe "Aygabtu generated features", type: :feature do
48
49
 
49
50
  # must be at the very bottom
50
51
  remaining.static_routes.visit
51
- remaining.pend "pending because route needs segments passed"
52
+ remaining.pend "pending because route requires segments to be visited"
52
53
  end
53
54
  ```
54
55
 
@@ -227,13 +228,29 @@ You can also use `remaining` at the very bottom to pend all remaining routes, se
227
228
  * `dynamic_routes` matches routes which have a dynamic segment.
228
229
  * `static_routes` matches routes which have no dynamic segment.
229
230
 
230
- ## Caveats
231
+ ## Extension points
231
232
 
232
- * With the standard assertions configured, Aygabtu will happily accept a rails error page as long as the HTTP status is 200. Somebody should find out how these can be reliably told apart from regular result pages, so the default assertions can be improved. Until then, you should try to add an assertion that checks for a common element on pages, like a footer element.
233
+ Several class and instance methods (read: example group and example methods)
234
+ can be overwritten to tweak behaviour as needed.
235
+
236
+ ### `#aygabtu_assertions`
237
+
238
+ This is already demonstrated in the initial example. It is necessary
239
+ to override this method with assertions specific to your project. Besides using
240
+ available assertions as shown, add an assertion against an element common to all
241
+ pages (fex. inside the site footer) and a negative assertion against text
242
+ found in your 404 page.
243
+
244
+ ### `.aygabtu_select_route?`
245
+
246
+ Allows to filter out unwanted routes at a low level. This method is passed a route object
247
+ from the journey gem and returns true for every route to be considered by aygabtu.
248
+
249
+ This method helps keeping deep project specific knowledge and the knowledge about Rails interna needed
250
+ to implement filtering out of aygabtu by giving users control.
233
251
 
234
252
  ## Missing features
235
253
 
236
- * tests, preferrably against different versions of Rails, RSpec and capybara
237
254
  * support for example metadata (you can have it with a conventional `context` any time)
238
255
 
239
256
  ## Contributing
@@ -3,6 +3,9 @@ require_relative 'scope_actor'
3
3
 
4
4
  module Aygabtu
5
5
  class Handle
6
+ def initialize
7
+ @verbose = false
8
+ end
6
9
 
7
10
  def routes
8
11
  @routes ||= rails_application_routes.set.map do |journey_route|
@@ -25,7 +28,7 @@ module Aygabtu
25
28
  end
26
29
 
27
30
  def verbose?
28
- !!@verbose
31
+ @verbose
29
32
  end
30
33
 
31
34
  private
@@ -15,14 +15,14 @@ module Aygabtu
15
15
  end
16
16
 
17
17
  def self.gem_root
18
- return @gem_root if @gem_root
18
+ @gem_root ||= begin
19
+ path = Pathname(__FILE__)
20
+ while new_path = path.parent and new_path.to_s.include?('lib/aygabtu')
21
+ path = new_path
22
+ end
19
23
 
20
- path = Pathname(__FILE__)
21
- while new_path = path.parent and new_path.to_s.include?('lib/aygabtu')
22
- path = new_path
24
+ path.to_s
23
25
  end
24
-
25
- @gem_root= path.to_s
26
26
  end
27
27
  end
28
28
  end
@@ -43,9 +43,13 @@ module Aygabtu
43
43
 
44
44
  def aygabtu_matching_routes(scope = aygabtu_scope)
45
45
  scope = scope.scope if scope.respond_to?(:scope) # a scope chain can be pased as well
46
- aygabtu_handle.routes.select do |route|
47
- scope.matches_route?(route)
48
- end
46
+ aygabtu_handle.routes.select { |route|
47
+ scope.matches_route?(route) && aygabtu_select_route?(route.journey_route)
48
+ }
49
+ end
50
+
51
+ def aygabtu_select_route?(journey_route)
52
+ true
49
53
  end
50
54
 
51
55
  ScopeActor.actions.each do |action|
@@ -1,3 +1,3 @@
1
1
  module Aygabtu
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.0"
3
3
  end
@@ -7,7 +7,7 @@ module IdentifiesRoutes
7
7
  satisfy { |rw| rw.journey_route.defaults[:route_identifier] == identifier }
8
8
  end
9
9
 
10
- def route_identified_by(identifier, all_routes = all_routes)
10
+ def route_identified_by(identifier, all_routes = all_routes())
11
11
  identified_routes = all_routes.select do |rw|
12
12
  rw.journey_route.defaults[:route_identifier] == identifier
13
13
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aygabtu
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
  - Thomas Stratmann
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-28 00:00:00.000000000 Z
11
+ date: 2016-03-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec-rails
@@ -103,7 +103,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
103
103
  version: '0'
104
104
  requirements: []
105
105
  rubyforge_project:
106
- rubygems_version: 2.2.2
106
+ rubygems_version: 2.4.5.1
107
107
  signing_key:
108
108
  specification_version: 4
109
109
  summary: Feature test generator for GET requests
@@ -120,4 +120,3 @@ test_files:
120
120
  - spec/support/matcher_shims.rb
121
121
  - spec/support_spec/identifies_routes_spec.rb
122
122
  - spec/visiting_routes_spec.rb
123
- has_rdoc: