rspec-active_record_mocks 0.1.0 → 0.1.1

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: 1c835e322ee4846866ac0aaea6a04b020d2def5f
4
- data.tar.gz: 3520cefddbf2fb248a76714f9b5de788de9394eb
3
+ metadata.gz: 7e5a2730a3992293264db9be17edfb08b76cba9a
4
+ data.tar.gz: 7656e60403759819b6498be2028b33f3b63b2805
5
5
  SHA512:
6
- metadata.gz: 98d2e2d634e42f2ab73a0f91bc04798d527f8549f1b4f5e458ec28d184e1402079f5ffc8d2cef660749c554b002fd5aae475eba57fb0612021de8d2d2ed7775c
7
- data.tar.gz: 50085a2dbfbe5ffff4d928da02c10ad718ef751461e9c7cb21c20a9d34a714a41ceda09727d5e4457c8cf6e983097e03f88e0473c73f49fd2480e9b6b6125264
6
+ metadata.gz: 7670c61b24ba7469f166d67eb0d567b663721dc992981dc40af56d0220782ff307645bfeda57ad738f2877cc19e630be2a96ca0700c8544f8eddc1eefb888b76
7
+ data.tar.gz: c87225c352add07c03fed17d96eb6f8cc9177432934acb6ac9084ee58bc2c0b43ff8d6b7141646f353f45617673e256254a4b4f4dc4d9cc8dadb9ca6ff3bbe24
@@ -1,5 +1,6 @@
1
1
  require "active_support/core_ext/string/inflections"
2
2
  require "active_record"
3
+ require "rspec"
3
4
 
4
5
  module RSpec
5
6
  module ActiveRecordMocks
@@ -9,9 +10,7 @@ module RSpec
9
10
  end
10
11
  end
11
12
 
12
- # ------------------------------------------------------------------------
13
13
  # Allow people to mock ActiveRecord while giving them the flexibility.
14
- # ------------------------------------------------------------------------
15
14
 
16
15
  def mock_active_record_model(opts = {}, &block)
17
16
  tbl, ext = opts.delete(:name), opts.delete(:extensions)
@@ -22,9 +21,7 @@ module RSpec
22
21
  end
23
22
  end
24
23
 
25
- # ------------------------------------------------------------------------
26
24
  # Roll through each one of the created tables and destroy them.
27
- # ------------------------------------------------------------------------
28
25
 
29
26
  def clean_tables_for_active_record_mocking
30
27
  if mocked_active_record_options[:mocked_active_record_tables]
@@ -37,29 +34,23 @@ module RSpec
37
34
  end
38
35
  end
39
36
 
40
- # ------------------------------------------------------------------------
41
37
  # Aliases ActiveRecord::Base.connection.tables to active_record_tables to
42
38
  # a geniunely useful method that can be used by anybody doing db testing.
43
- # ------------------------------------------------------------------------
44
39
 
45
40
  def active_record_tables
46
41
  ActiveRecord::Base.connection.tables
47
42
  end
48
43
 
49
- # ------------------------------------------------------------------------
50
44
  # Allows us to access options for either the class or the test itself as
51
45
  # to allow users to either work on the class or work in the test allowing
52
46
  # us to cleanup without affecting the other.
53
- # ------------------------------------------------------------------------
54
47
 
55
48
  private
56
49
  def mocked_active_record_options
57
50
  (example.nil?) ? (@mocked_active_record_options ||= {}) : example.options
58
51
  end
59
52
 
60
- # ------------------------------------------------------------------------
61
53
  # Creates a temporary table inside of the database using ActiveRecord.
62
- # ------------------------------------------------------------------------
63
54
 
64
55
  private
65
56
  def create_active_record_table_for_mocking(tbl, ext, &block)
@@ -68,9 +59,7 @@ module RSpec
68
59
  tbl
69
60
  end
70
61
 
71
- # ------------------------------------------------------------------------
72
62
  # Sets up the table using an ActiveRecord migration.
73
- # ------------------------------------------------------------------------
74
63
 
75
64
  private
76
65
  def setup_active_record_mocking_table(tbl, ext, &block)
@@ -83,14 +72,12 @@ module RSpec
83
72
  end
84
73
  end
85
74
 
86
- # ------------------------------------------------------------------------
87
75
  # Sets up the extensions for PostgreSQL.
88
- # ------------------------------------------------------------------------
89
76
 
90
77
  private
91
78
  def setup_active_record_mocking_extensions(ext)
92
79
  ext = [ext].delete_if { |value| value.blank? }.flatten
93
- if ext.size > 0 && !ActiveRecord::Base.connection.respond_to?(:enable_extension)
80
+ if ext.size > 0 && ! ActiveRecord::Base.connection.respond_to?(:enable_extension)
94
81
  raise ExtensionsUnsupportedError
95
82
  else
96
83
  ext.each do |extension|
@@ -101,10 +88,6 @@ module RSpec
101
88
  end
102
89
  end
103
90
 
104
- # ----------------------------------------------------------------------------
105
- # Add ourself to the win list so they can use the methods.
106
- # ----------------------------------------------------------------------------
107
-
108
91
  RSpec.configure do |config|
109
92
  config.include RSpec::ActiveRecordMocks
110
93
  [:all, :each].each do |type|
@@ -1,5 +1,5 @@
1
1
  module RSpec
2
2
  module ActiveRecordMocks
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,43 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-active_record_mocks
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jordon Bedwell
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-08-03 00:00:00.000000000 Z
11
+ date: 2013-09-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: rspec-expect_error
14
+ name: rspec
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - ~>
18
18
  - !ruby/object:Gem::Version
19
- version: 0.0.3
19
+ version: '2.14'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ~>
25
25
  - !ruby/object:Gem::Version
26
- version: 0.0.3
26
+ version: '2.14'
27
27
  - !ruby/object:Gem::Dependency
28
- name: rspec
28
+ name: rspec-expect_error
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ~>
32
32
  - !ruby/object:Gem::Version
33
- version: '2.14'
33
+ version: 0.0.3
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ~>
39
39
  - !ruby/object:Gem::Version
40
- version: '2.14'
40
+ version: 0.0.3
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: activerecord
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -68,8 +68,8 @@ files:
68
68
  - License
69
69
  - Rakefile
70
70
  - Gemfile
71
- - lib/rspec/active_record_mocks/version.rb
72
71
  - lib/rspec/active_record_mocks.rb
72
+ - lib/rspec/active_record_mocks/version.rb
73
73
  homepage: https://github.com/envygeeks/rspec-active_record_mocks
74
74
  licenses:
75
75
  - Apache 2.0
@@ -90,7 +90,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
90
90
  version: '0'
91
91
  requirements: []
92
92
  rubyforge_project:
93
- rubygems_version: 2.0.3
93
+ rubygems_version: 2.0.6
94
94
  signing_key:
95
95
  specification_version: 4
96
96
  summary: Mock ActiveRecord tables to test.