acts_as_footprintable 0.2.2 → 0.2.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: fc9280a30690056a250801e928173079736e8d31
4
- data.tar.gz: 5c7a079403b3a2bec4686dd885d51872d85b3ae0
3
+ metadata.gz: 8e8915ee9a150cadf7601e9f54d18ee0d373f6c9
4
+ data.tar.gz: bbbf50a358d50691ac80a361b0139e6b56405efd
5
5
  SHA512:
6
- metadata.gz: 14df9393a2ab8708884564d186907f8655b1edb414fad55e90528333aefdce293c12e3bdf3f333f9e4eba2877000daea192e48b59ab30d27cfa5c2f228965eef
7
- data.tar.gz: bad6e2bc48854594db1f4507431a80660a0164e972778b9b1f5cb3471a4f742e2333449502a07639ac7c697510198ef2ca9efe4dbd472f7acdeaa69d98d0b778
6
+ metadata.gz: 250b5cc290a53082fd2af8b2f692d9ec43025d420807ce16983f2a0f6288f0cf68309e7fcea4cec920b2d6eddbb01d445adf5637e94f280a0f834cc8396f03e8
7
+ data.tar.gz: e49ee10b5b6ba5fed9fff2e525f0f424b75e263094badf48ee8841af9cf1b05d7ebab2b78f732b9aba7d99bcd442b7d055fc29423ada85b9cf138fc37a503597
data/.travis.yml CHANGED
@@ -1,8 +1,12 @@
1
1
  language: ruby
2
2
  rvm:
3
+ - 2.3.1
4
+ - 2.2.5
5
+ - 2.1.10
3
6
  - 2.0.0
4
- - 1.9.3
5
7
  env:
8
+ - "RAILS_VERSION=4.2.0"
9
+ - "RAILS_VERSION=4.1.0"
6
10
  - "RAILS_VERSION=4.0.0"
7
11
  - "RAILS_VERSION=3.2.0"
8
12
  branches:
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.add_development_dependency "bundler", "~> 1.3"
22
22
  spec.add_development_dependency 'rake'
23
- spec.add_development_dependency 'rspec'
23
+ spec.add_development_dependency 'rspec', ">= 3.0.0"
24
24
  spec.add_development_dependency 'pg'
25
25
  spec.add_development_dependency 'timecop'
26
26
  spec.add_development_dependency 'database_cleaner', "~> 1.0.1"
@@ -30,7 +30,7 @@ module ActsAsFootprintable
30
30
 
31
31
  private
32
32
  def get_access_history_records(target, limit=nil)
33
- footprints.where(:id => recent_footprint_ids(target, limit))
33
+ footprints.where(:id => recent_footprint_ids(target, limit)).order("created_at DESC")
34
34
  end
35
35
 
36
36
  def table_name
@@ -1,4 +1,4 @@
1
1
  # coding: utf-8
2
2
  module ActsAsFootprintable
3
- VERSION = "0.2.2"
3
+ VERSION = "0.2.3"
4
4
  end
@@ -4,7 +4,7 @@ class ActsAsFootprintableMigration < ActiveRecord::Migration
4
4
  create_table :footprints do |t|
5
5
  t.references :footprintable, :polymorphic => true
6
6
  t.references :footprinter, :polymorphic => true
7
- t.timestamps
7
+ t.timestamps :null => false
8
8
  end
9
9
 
10
10
  if ActiveRecord::VERSION::MAJOR < 4
@@ -4,11 +4,11 @@ require 'spec_helper'
4
4
  describe ActsAsFootprintable::Footprintable do
5
5
 
6
6
  it "should not be a footprintable" do
7
- NotFootprintable.should_not be_footprintable
7
+ expect(NotFootprintable).not_to be_footprintable
8
8
  end
9
9
 
10
10
  it "should be a footprintable" do
11
- Footprintable.should be_footprintable
11
+ expect(Footprintable).to be_footprintable
12
12
  end
13
13
 
14
14
  describe 'leave footprints by footprinter' do
@@ -22,7 +22,7 @@ describe ActsAsFootprintable::Footprintable do
22
22
  end
23
23
 
24
24
  it "should be leave footprints" do
25
- @footprintable.leave_footprints(@user).should be_true
25
+ expect(@footprintable.leave_footprints(@user)).to be_truthy
26
26
  end
27
27
 
28
28
  it "足跡の数が増えていること" do
@@ -56,7 +56,7 @@ describe ActsAsFootprintable::Footprintable do
56
56
  context "1週間の場合" do
57
57
  it "35の足跡があること" do
58
58
  Timecop.travel(Time.parse("2013/9/30 10:00:00")) do
59
- @footprintable.footprint_count_between(1.week.ago..Time.now).should == 35
59
+ expect(@footprintable.footprint_count_between(1.week.ago..Time.now)).to eq 35
60
60
  end
61
61
  end
62
62
  end
@@ -64,7 +64,7 @@ describe ActsAsFootprintable::Footprintable do
64
64
  context "1ヶ月の場合" do
65
65
  it "150の足跡があること" do
66
66
  Timecop.travel(Time.parse("2013/9/30 10:00:00")) do
67
- @footprintable.footprint_count_between(1.month.ago..Time.now).should == 150
67
+ expect(@footprintable.footprint_count_between(1.month.ago..Time.now)).to eq 150
68
68
  end
69
69
  end
70
70
  end
@@ -89,8 +89,10 @@ describe ActsAsFootprintable::Footprintable do
89
89
  month = Time.new(2013,9,1)
90
90
  Footprintable.access_ranking(month.beginning_of_month...1.week.since(month), 5)
91
91
  end
92
- it { should == {7 => 7, 6 => 6, 5 => 5, 4 => 4, 3 => 3 }}
93
- it { should have(5).items }
92
+ it { is_expected.to eq ({7 => 7, 6 => 6, 5 => 5, 4 => 4, 3 => 3 }) }
93
+ it '5件取得できること' do
94
+ expect(subject.count).to eq 5
95
+ end
94
96
  end
95
97
  end
96
98
  end
@@ -5,11 +5,11 @@ require 'acts_as_footprintable/footprinter'
5
5
  describe ActsAsFootprintable::Footprinter do
6
6
 
7
7
  it "should not be a footprinter" do
8
- NotUser.should_not be_footprinter
8
+ expect(NotUser).not_to be_footprinter
9
9
  end
10
10
 
11
11
  it "should be a footprinter" do
12
- User.should be_footprinter
12
+ expect(User).to be_footprinter
13
13
  end
14
14
 
15
15
  describe "ユーザーのアクセス履歴を" do
@@ -27,28 +27,29 @@ describe ActsAsFootprintable::Footprinter do
27
27
 
28
28
  context "対象のモデル毎に" do
29
29
  it "取得できること" do
30
- @user.access_histories_for(Footprintable).should have(5).items
31
- @user.access_histories_for(Footprintable).map{|footprint| footprint.footprintable.name}.should == (1..5).to_a.reverse.map{|index| "footprintable#{index}"}
30
+ expect(@user.access_histories_for(Footprintable).count).to eq 5
31
+ expect(@user.access_histories_for(Footprintable).map{|footprint| footprint.footprintable.name}).to eq (1..5).to_a.reverse.map{|index| "footprintable#{index}"}
32
32
  end
33
33
 
34
34
  it "件数を絞り込めること" do
35
- @user.access_histories_for(Footprintable, 3).should have(3).items
36
- @user.access_histories_for(Footprintable, 3).map{|footprint| footprint.footprintable.name}.should == (3..5).to_a.reverse.map{|index| "footprintable#{index}"}
35
+ expect(@user.access_histories_for(Footprintable, 3).count).to eq 3
36
+ expect(@user.access_histories_for(Footprintable, 3).map{|footprint| footprint.footprintable.name}).to eq (3..5).to_a.reverse.map{|index| "footprintable#{index}"}
37
37
  end
38
38
  end
39
39
 
40
40
  context "全てのモデルを通じて" do
41
41
  it "取得できること" do
42
- @user.access_histories.should have(10).items
43
- @user.access_histories.map{|footprint| footprint.footprintable.name}.should == (1..5).to_a.reverse.inject([]) do |results, index|
42
+ expect(@user.access_histories.count).to eq 10
43
+ footprintable_names = (1..5).to_a.reverse.inject([]) do |results, index|
44
44
  results.push "second_footprintable#{index}"
45
45
  results.push "footprintable#{index}"
46
46
  results
47
47
  end
48
+ expect(@user.access_histories.map{|footprint| footprint.footprintable.name}).to eq footprintable_names
48
49
  end
49
50
 
50
51
  it "件数を絞り込める事" do
51
- @user.access_histories(3).should have(3).items
52
+ expect(@user.access_histories(3).count).to eq 3
52
53
  end
53
54
  end
54
55
  end
@@ -3,7 +3,7 @@ ActiveRecord::Schema.define do
3
3
  create_table :footprints, :force => true do |t|
4
4
  t.references :footprintable, :polymorphic => true
5
5
  t.references :footprinter, :polymorphic => true
6
- t.timestamps
6
+ t.timestamps :null => false
7
7
  end
8
8
 
9
9
  add_index :footprints, [:footprintable_id, :footprintable_type]
data/spec/spec_helper.rb CHANGED
@@ -8,7 +8,6 @@ require 'timecop'
8
8
  Combustion.initialize! :active_record
9
9
 
10
10
  RSpec.configure do |config|
11
- config.treat_symbols_as_metadata_keys_with_true_values = true
12
11
  config.run_all_when_everything_filtered = true
13
12
  config.filter_run :focus
14
13
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acts_as_footprintable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Toyoaki Oko
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-19 00:00:00.000000000 Z
11
+ date: 2016-06-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '0'
47
+ version: 3.0.0
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: '0'
54
+ version: 3.0.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: pg
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -148,7 +148,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
148
148
  version: '0'
149
149
  requirements: []
150
150
  rubyforge_project:
151
- rubygems_version: 2.2.2
151
+ rubygems_version: 2.5.1
152
152
  signing_key:
153
153
  specification_version: 4
154
154
  summary: Rails gem to allowing records to leave footprints
@@ -164,4 +164,3 @@ test_files:
164
164
  - spec/internal/db/schema.rb
165
165
  - spec/internal/log/.gitignore
166
166
  - spec/spec_helper.rb
167
- has_rdoc: