action_tracker 0.1.4 → 0.1.5

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: 638907fb87e39ca2a30f4b47e2943ddafd38c404
4
- data.tar.gz: 4ae63d3897e1f6af7c32de1f50723e4d95e9d228
3
+ metadata.gz: 8aba9bf43e4bc33735088adada70be4d37d3bb05
4
+ data.tar.gz: 27af7b65fb28357068a2994dac4cabcb9d39a54b
5
5
  SHA512:
6
- metadata.gz: d1ca2681d020e4c0188f1204335a8925de6fed957a45f3724a558f8e5a78c43eff7d6b71a1a6a153f37d008fb62185606a9f16175a28b06bcab0355f2dfb46de
7
- data.tar.gz: 4725862c5725de5bd8930c010e73cd47ba9ee6bc6c4b183d7fa61b3a7062228709cdc9c20a49fe8ee89a4bab9a1eff5e351669fbb9a79d915b175e3325e6804d
6
+ metadata.gz: 7067ac421d031d43c55e6d48e96568b7414b2f1bd9b52b717cc6b6dacaee0c3083d5b57949bad6b179a77cae11970d7233bd425f70e4257b6318b8c55bc90f9a
7
+ data.tar.gz: 90f53c2b25899bdbff4c1ff7361f95ec157638054b651edc55508bd02c12e92032e87c75724d6884023e10cbeaf2c9e1c89517e18378a4424ccde20c5a2da122
data/.travis.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.2.2
3
+ - 2.2.3
4
4
  before_install: gem install bundler -v 1.11.2
data/README.md CHANGED
@@ -1,6 +1,5 @@
1
1
  <a href="https://codeclimate.com/github/appprova/action_tracker"><img src="https://codeclimate.com/github/appprova/action_tracker/badges/gpa.svg" /></a>
2
2
  [![Build Status](https://travis-ci.org/appprova/action_tracker.svg?branch=develop)](https://travis-ci.org/appprova/action_tracker)
3
- [ ![Codeship Status for appprova/action_tracker](https://codeship.com/projects/a038f7b0-f2ce-0133-3399-42c612817579/status?branch=master)](https://codeship.com/projects/149594)
4
3
 
5
4
  # Action Tracker
6
5
 
@@ -1,17 +1,29 @@
1
1
  RSpec::Matchers.define :have_action_tracker do
2
2
  match do |actual|
3
- actual.respond_to? 'track_event'
3
+ actual.class.included_modules.include?(ActionTracker::Concerns::Tracker) &&
4
+ filter_exists?(controller, :before, :initialize_session) &&
5
+ filter_exists?(controller, :after, :conditional_track_event)
4
6
  end
5
7
 
6
8
  description do
7
- "responds to #track_event."
9
+ "have ActionTracker."
8
10
  end
9
11
 
10
12
  failure_message do |actual|
11
- "expected that #{actual} responded to #track_event, but it didn't."
13
+ "expected that #{actual} to include ActionTracker, but it didn't."
12
14
  end
13
15
 
14
16
  failure_message_when_negated do |actual|
15
- "expected that #{actual} would not respond to #track_event, but it did."
17
+ "expected that #{actual} not to include ActionTracker, but it did."
16
18
  end
19
+
20
+ private
21
+
22
+ def filter_exists?(controller, kind, filter)
23
+ controller.class
24
+ ._process_action_callbacks
25
+ .select {|f| f.kind == kind }
26
+ .map(&:filter).include? filter
27
+ end
28
+
17
29
  end
@@ -0,0 +1,18 @@
1
+ RSpec::Matchers.define :track do |expected|
2
+ match do |actual|
3
+ actual.send(:tracker_instance).respond_to?(expected)
4
+ end
5
+
6
+ description do
7
+ "track #{expected}."
8
+ end
9
+
10
+ failure_message do |actual|
11
+ "expected #{actual} to track #{expected} action, but it didn't."
12
+ end
13
+
14
+ failure_message_when_negated do |actual|
15
+ "expected #{actual} not to track #{expected} action, but it did."
16
+ end
17
+
18
+ end
@@ -1 +1,2 @@
1
1
  require 'action_tracker/matchers/have_action_tracker_matcher'
2
+ require 'action_tracker/matchers/track_matcher'
@@ -1,3 +1,3 @@
1
1
  module ActionTracker
2
- VERSION = '0.1.4'.freeze
2
+ VERSION = '0.1.5'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: action_tracker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - André Taiar
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2016-05-03 00:00:00.000000000 Z
12
+ date: 2016-05-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -167,6 +167,7 @@ files:
167
167
  - lib/action_tracker/helpers/render.rb
168
168
  - lib/action_tracker/matchers.rb
169
169
  - lib/action_tracker/matchers/have_action_tracker_matcher.rb
170
+ - lib/action_tracker/matchers/track_matcher.rb
170
171
  - lib/action_tracker/version.rb
171
172
  homepage: http://coders.appprova.com.br/
172
173
  licenses:
@@ -188,7 +189,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
188
189
  version: '0'
189
190
  requirements: []
190
191
  rubyforge_project:
191
- rubygems_version: 2.4.8
192
+ rubygems_version: 2.4.5
192
193
  signing_key:
193
194
  specification_version: 4
194
195
  summary: Easy way to track actions in your application.