all_sorts 1.0.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
  SHA1:
3
- metadata.gz: 3e8e78771d7c698a747fc9c85467c43332a9d116
4
- data.tar.gz: 96ba32ab8ddbd71d0eae9487c629dd9b58e586c9
3
+ metadata.gz: 3bbf496efe8c26bad0c458f9d917e0d121f57003
4
+ data.tar.gz: 9a796dfbd02841780f6e90918bd3296246359e19
5
5
  SHA512:
6
- metadata.gz: 24ee1d1020242db15d2dba0b95d6b9c41d1c266f5d66709bd12dbc04daeb6f652171e7df42d0b821140e6ce832cb6f15c70e81e9c7cdb62b7f4d41386a05d6ed
7
- data.tar.gz: f625eff266d758752ba2beaf980340f81d88915a14b1ff38bb4af808a599c33206dd2479867a5e964b2ce135904103dca95d31d9798d98b5d98474dd9ab8a8da
6
+ metadata.gz: 415cd8bc9cbb96a9ec26874a020623897482693fb6b515966166c3ffab1b4b94d0aedb9b9df5d24deabe2298ce2fd576427b2e8913a4e4b3d62b2998c60b2e02
7
+ data.tar.gz: 40a6c0f3294a10194e05a72a9ff43201a2f75b796778d9709a82357e88ab3ca2648d753c19878f210e74a22fd79ec034375c109de5f208f7f0099660b7937af0
data/README.md CHANGED
@@ -13,7 +13,7 @@ gem install all_sorts
13
13
  ## Usage
14
14
  All Sorts was originally developed to fill the need of being able to
15
15
  sort by one or multiple columns passed in the URL, however it works with
16
- ActiveRecord and basically takes in a hash. This gem adds a ".sort" method
16
+ ActiveRecord and basically takes in a hash. Included as a concern, this gem adds a ".sort" method
17
17
  to ActiveRecord which basically does some clever stuff by looking at the
18
18
  hash keys, creates a string by which to sort results, and calls ".order"
19
19
  with that string.
@@ -21,13 +21,30 @@ with that string.
21
21
  It also adds a ".sortable_fields" method for you to limit by which fields
22
22
  the records may be ordered.
23
23
 
24
+ ### Globally
25
+ Adds .sort, .sortable_fields methods to all of you models
26
+ Somewhere in your apps bootstrap/startup code:
27
+
28
+ ``` ruby
29
+ ActiveRecord::Base.include(AllSorts)
30
+ ```
31
+
32
+ ### Locally (in a model)
33
+ Adds .sort, .sortable_fields methods to only the User model
34
+
35
+ ``` ruby
36
+ class User < ActiveRecord::Base
37
+ include AllSorts
38
+ end
39
+ ```
40
+
24
41
  ## URL Examples
25
42
  * http://whatever.com/wherever/?sort_name=asc
26
43
  * http://whatever.com/wherever/?sort_1_name=asc
27
44
  * http://whatever.com/wherever/?sort_1_name=asc&sort_2_salary=desc
28
45
 
29
46
  ## Model
30
- In the model you can limit which fields are filterable. This is optional. If this isn't in your model, all fields are filterable.
47
+ In the model you can limit which fields are sortable. This is optional. If this isn't in your model, all fields are sortable.
31
48
  ``` ruby
32
49
  class User < ActiveRecord::Base
33
50
  sortable_fields :name, :salary
data/Rakefile CHANGED
@@ -1,18 +1,2 @@
1
- #!/usr/bin/env rake
1
+ require "bundler/gem_tasks"
2
2
 
3
- require 'bundler'
4
- Bundler::GemHelper.install_tasks
5
-
6
- require 'rspec/core/rake_task'
7
- RSpec::Core::RakeTask.new(:spec)
8
-
9
- task :default => :spec
10
- task :test => :spec
11
-
12
- require 'yard'
13
- namespace :doc do
14
- YARD::Rake::YardocTask.new do |task|
15
- task.files = ['LICENSE.md', 'lib/**/*.rb']
16
- task.options = ['--markup', 'markdown']
17
- end
18
- end
@@ -1,26 +1,30 @@
1
- # -*- encoding: utf-8 -*-
2
- require File.expand_path('../lib/all_sorts/version', __FILE__)
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'all_sorts/version'
3
5
 
4
- Gem::Specification.new do |gem|
5
- gem.name = 'all_sorts'
6
- gem.version = AllSorts::VERSION
7
- gem.author = "Phil Spitler"
8
- gem.email = 'pspitler@gmail.com'
9
- gem.homepage = 'https://github.com/philspitler/allsorts'
10
- gem.summary = 'A DSL for sorting active record results based on hash keys with the term _sort_ in them.'
11
- gem.description = ''
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "all_sorts"
8
+ spec.version = AllSorts::VERSION
9
+ spec.authors = ["Phil Spitler"]
10
+ spec.email = ["pspitler@gmail.com"]
11
+ spec.summary = 'A DSL for sorting active record results based on a hash with keys with the term sort_ in them.'
12
+ spec.description = ""
13
+ spec.homepage = "http://sproutkey.com"
14
+ spec.license = "MIT"
12
15
 
13
- gem.files = `git ls-files`.split("\n")
14
- gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
15
- gem.executables = `git ls-files -- bin/*`.split("\n").map{|f| File.basename(f)}
16
- gem.require_paths = ['lib']
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
17
20
 
18
- gem.add_development_dependency 'maruku', '~> 0.6'
19
- gem.add_development_dependency 'rake', '~> 0.9'
20
- gem.add_development_dependency 'rspec', '~> 2.6'
21
- gem.add_development_dependency 'simplecov', '~> 0.4'
22
- gem.add_development_dependency 'yard', '~> 0.7'
23
- gem.add_development_dependency 'sqlite3'
21
+ spec.add_development_dependency "bundler", "~> 1.6"
22
+ spec.add_development_dependency "rake"
23
+ spec.add_development_dependency "rspec"
24
+ spec.add_development_dependency "bond"
25
+ spec.add_development_dependency "simplecov"
26
+ spec.add_development_dependency "sqlite3"
27
+ spec.add_development_dependency "factory_girl", "~> 4.0"
24
28
 
25
- gem.add_dependency 'activerecord', '>= 3.0.1'
29
+ spec.add_dependency "activerecord"
26
30
  end
@@ -1,32 +1,34 @@
1
1
  require 'active_record'
2
2
 
3
3
  module AllSorts
4
- attr_accessor :sortable_fields
5
- def sort(params)
4
+ extend ActiveSupport::Concern
6
5
 
7
- #remove non filter params
8
- params.delete_if { |key, value| key.to_s.index('sort_').nil? }
9
- keys = params.keys.sort
10
- #params.keys.sort_by {|s| s.to_s}.map {|key| [key, params[key]] }
6
+ module ClassMethods
7
+ def sortable_fields(*fields)
8
+ @sortable_fields = fields
9
+ end
10
+
11
+ def sort(params)
11
12
 
12
- sorters = []
13
+ #remove non filter params
14
+ params.delete_if { |key, value| key.to_s.index('sort_').nil? }
15
+ keys = params.keys.sort
16
+ #params.keys.sort_by {|s| s.to_s}.map {|key| [key, params[key]] }
13
17
 
14
- keys.each do |key, value|
15
- keysplit = key.to_s.split('_')
16
- unless @sortable_fields and not @sortable_fields.include?(keysplit.last.to_sym)
17
- if column_names.include?(keysplit.last)
18
- sorters << "#{keysplit.last} #{params[key]}"
18
+ sorters = []
19
+
20
+ keys.each do |key, value|
21
+ keysplit = key.to_s.split('_')
22
+ unless @sortable_fields and not @sortable_fields.include?(keysplit.last.to_sym)
23
+ if column_names.include?(keysplit.last)
24
+ sorters << "#{keysplit.last} #{params[key]}"
25
+ end
19
26
  end
20
27
  end
28
+
29
+ order(sorters)
21
30
  end
22
31
 
23
- order(sorters)
24
32
  end
25
33
 
26
-
27
- def sortable_fields(*fields)
28
- @sortable_fields = fields
29
- end
30
34
  end
31
-
32
- ActiveRecord::Base.extend AllSorts
@@ -1,3 +1,3 @@
1
1
  module AllSorts
2
- VERSION = "1.0.1"
2
+ VERSION = "2.0"
3
3
  end
@@ -1,47 +1,32 @@
1
- require 'helper'
2
- require 'finders/activerecord_test_connector'
3
- ActiverecordTestConnector.setup
1
+ require 'spec_helper'
2
+ require 'support/active_record'
4
3
 
5
4
  describe AllSorts do
6
- extend ActiverecordTestConnector::FixtureSetup
7
- fixtures :users
8
- fixtures :posts
9
-
10
5
  it "sorts by a single field" do
11
- posts = Post.sort({'sort_title' => 'desc'}).all
12
- post_ids = posts.map do |post|
13
- post.id
14
- end
15
- post_ids.should == [3, 2, 1]
6
+ expected_posts = Post.all.order('title desc')
7
+ posts = Post.all.sort({'sort_title' => 'desc'})
8
+ posts.should == expected_posts
16
9
 
17
- posts = Post.sort({'sort_title' => 'asc'}).all
18
- post_ids = posts.map do |post|
19
- post.id
20
- end
21
- post_ids.should == [1, 2, 3]
10
+ expected_posts = Post.all.order('title asc')
11
+ posts = Post.all.sort({'sort_title' => 'asc'})
12
+ posts.should == expected_posts
22
13
  end
23
14
 
24
15
  it "ignores fields not in sortable_fields if sortable_fields is set" do
25
- posts = Post.sort({'sort_body' => 'desc'}).all
26
- post_ids = posts.map do |post|
27
- post.id
28
- end
29
- post_ids.should == [1, 2, 3]
16
+ expected_posts = Post.all
17
+ posts = Post.all.sort({'sort_body' => 'desc'})
18
+ posts.should == expected_posts
30
19
  end
31
20
 
32
21
  it "sorts by multiple fields" do
22
+ expected_users = User.all.order('name asc, salary desc')
33
23
  users = User.sort({'sort_1_name' => 'asc', 'sort_2_salary' => 'desc'}).all
34
- user_ids = users.map do |user|
35
- user.id
36
- end
37
- user_ids.should == [1, 3, 2, 13, 12]
24
+ users.should == expected_users
38
25
  end
39
26
 
40
27
  it "ignores fields that don't make sense" do
28
+ expected_users = User.all.order('name asc')
41
29
  users = User.sort({'sort_1_name' => 'asc', 'sort_2_blah' => 'desc'}).all
42
- user_ids = users.map do |user|
43
- user.id
44
- end
45
- user_ids.should == [1, 2, 3, 13, 12]
30
+ users.should == expected_users
46
31
  end
47
32
  end
File without changes
@@ -0,0 +1,13 @@
1
+ FactoryGirl.define do
2
+ factory :user do
3
+ name { (0...16).map { ('a'..'z').to_a[rand(26)] }.join }
4
+ salary { rand(100000) }
5
+ bonus { rand(2) == 0 ? false : true }
6
+ end
7
+
8
+ factory :post do
9
+ sequence(:title) { |n| "Post #{n} title" }
10
+ sequence(:body) { |n| "Post #{n} body" }
11
+ end
12
+ end
13
+
@@ -0,0 +1,24 @@
1
+ # This file was generated by the `rspec --init` command. Conventionally, all
2
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
+ # Require this file using `require "spec_helper"` to ensure that it is only
4
+ # loaded once.
5
+ #
6
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
7
+ require 'simplecov'
8
+ SimpleCov.add_filter '.bundle'
9
+ SimpleCov.start
10
+ require 'all_sorts'
11
+ require 'factory_girl'
12
+
13
+ RSpec.configure do |config|
14
+ config.treat_symbols_as_metadata_keys_with_true_values = true
15
+ config.run_all_when_everything_filtered = true
16
+ config.include FactoryGirl::Syntax::Methods
17
+ #config.filter_run :focus
18
+
19
+ # Run specs in random order to surface order dependencies. If you find an
20
+ # order dependency and want to debug it, you can fix the order by providing
21
+ # the seed, which is printed after each run.
22
+ # --seed 1234
23
+ config.order = 'random'
24
+ end
@@ -0,0 +1,19 @@
1
+ require 'active_record'
2
+
3
+ ActiveRecord::Base.establish_connection adapter: "sqlite3", database: ":memory:"
4
+
5
+ load "spec/db/schema.rb"
6
+
7
+ FactoryGirl.find_definitions
8
+
9
+ class User < ActiveRecord::Base
10
+ include AllSorts
11
+ end
12
+
13
+ class Post < ActiveRecord::Base
14
+ include AllSorts
15
+ sortable_fields :title, :published_at
16
+ end
17
+
18
+ FactoryGirl.create_list(:user, 12)
19
+ FactoryGirl.create_list(:post, 3)
metadata CHANGED
@@ -1,85 +1,85 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: all_sorts
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: '2.0'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Phil Spitler
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-24 00:00:00.000000000 Z
11
+ date: 2014-05-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: maruku
14
+ name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.6'
19
+ version: '1.6'
20
20
  type: :development
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.6'
26
+ version: '1.6'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '0.9'
33
+ version: '0'
34
34
  type: :development
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: '0.9'
40
+ version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '2.6'
47
+ version: '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: '2.6'
54
+ version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: simplecov
56
+ name: bond
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: '0.4'
61
+ version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
- version: '0.4'
68
+ version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
- name: yard
70
+ name: simplecov
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - "~>"
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: '0.7'
75
+ version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - "~>"
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
- version: '0.7'
82
+ version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: sqlite3
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -94,22 +94,37 @@ dependencies:
94
94
  - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: factory_girl
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '4.0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '4.0'
97
111
  - !ruby/object:Gem::Dependency
98
112
  name: activerecord
99
113
  requirement: !ruby/object:Gem::Requirement
100
114
  requirements:
101
115
  - - ">="
102
116
  - !ruby/object:Gem::Version
103
- version: 3.0.1
117
+ version: '0'
104
118
  type: :runtime
105
119
  prerelease: false
106
120
  version_requirements: !ruby/object:Gem::Requirement
107
121
  requirements:
108
122
  - - ">="
109
123
  - !ruby/object:Gem::Version
110
- version: 3.0.1
124
+ version: '0'
111
125
  description: ''
112
- email: pspitler@gmail.com
126
+ email:
127
+ - pspitler@gmail.com
113
128
  executables: []
114
129
  extensions: []
115
130
  extra_rdoc_files: []
@@ -118,7 +133,6 @@ files:
118
133
  - ".gemtest"
119
134
  - ".gitignore"
120
135
  - ".rspec"
121
- - ".yardopts"
122
136
  - Gemfile
123
137
  - LICENSE.md
124
138
  - README.md
@@ -127,15 +141,13 @@ files:
127
141
  - lib/all_sorts.rb
128
142
  - lib/all_sorts/version.rb
129
143
  - spec/all_sorts_spec.rb
130
- - spec/finders/activerecord_test_connector.rb
131
- - spec/fixtures/post.rb
132
- - spec/fixtures/posts.yml
133
- - spec/fixtures/schema.rb
134
- - spec/fixtures/user.rb
135
- - spec/fixtures/users.yml
136
- - spec/helper.rb
137
- homepage: https://github.com/philspitler/allsorts
138
- licenses: []
144
+ - spec/db/schema.rb
145
+ - spec/factories.rb
146
+ - spec/spec_helper.rb
147
+ - spec/support/active_record.rb
148
+ homepage: http://sproutkey.com
149
+ licenses:
150
+ - MIT
139
151
  metadata: {}
140
152
  post_install_message:
141
153
  rdoc_options: []
@@ -156,15 +168,11 @@ rubyforge_project:
156
168
  rubygems_version: 2.2.2
157
169
  signing_key:
158
170
  specification_version: 4
159
- summary: A DSL for sorting active record results based on hash keys with the term
160
- _sort_ in them.
171
+ summary: A DSL for sorting active record results based on a hash with keys with the
172
+ term sort_ in them.
161
173
  test_files:
162
174
  - spec/all_sorts_spec.rb
163
- - spec/finders/activerecord_test_connector.rb
164
- - spec/fixtures/post.rb
165
- - spec/fixtures/posts.yml
166
- - spec/fixtures/schema.rb
167
- - spec/fixtures/user.rb
168
- - spec/fixtures/users.yml
169
- - spec/helper.rb
170
- has_rdoc:
175
+ - spec/db/schema.rb
176
+ - spec/factories.rb
177
+ - spec/spec_helper.rb
178
+ - spec/support/active_record.rb
data/.yardopts DELETED
@@ -1,3 +0,0 @@
1
- --markup markdown
2
- -
3
- LICENSE.md
@@ -1,104 +0,0 @@
1
- require 'active_record'
2
- require 'active_record/version'
3
- require 'active_record/fixtures'
4
- require 'active_support/multibyte' # needed for Ruby 1.9.1
5
-
6
- $query_count = $query_sql = nil
7
-
8
- module ActiverecordTestConnector
9
- extend self
10
-
11
- attr_accessor :able_to_connect
12
- attr_accessor :connected
13
-
14
- FIXTURES_PATH = File.expand_path('../../fixtures', __FILE__)
15
-
16
- # Set our defaults
17
- self.connected = false
18
- self.able_to_connect = true
19
-
20
- def setup
21
- unless self.connected || !self.able_to_connect
22
- setup_connection
23
- load_schema
24
- add_load_path FIXTURES_PATH
25
- self.connected = true
26
- end
27
- rescue Exception => e # errors from ActiveRecord setup
28
- $stderr.puts "\nSkipping ActiveRecord tests: #{e}\n\n"
29
- self.able_to_connect = false
30
- end
31
-
32
- private
33
-
34
- def add_load_path(path)
35
- dep = defined?(ActiveSupport::Dependencies) ? ActiveSupport::Dependencies : ::Dependencies
36
- dep.autoload_paths.unshift path
37
- end
38
-
39
- def setup_connection
40
- ActiveRecord::Base.establish_connection(
41
- :adapter => "sqlite3",
42
- :database => ":memory:"
43
- )
44
- prepare ActiveRecord::Base.connection
45
- end
46
-
47
- def load_schema
48
- ActiveRecord::Base.silence do
49
- ActiveRecord::Migration.verbose = false
50
- load File.join(FIXTURES_PATH, 'schema.rb')
51
- end
52
- end
53
-
54
- def prepare(conn)
55
- class << conn
56
- IGNORED_SQL = /^(?:PRAGMA|SELECT (?:currval|CAST|@@IDENTITY|@@ROWCOUNT)|SHOW FIELDS)\b/
57
-
58
- def execute_with_counting(sql, name = nil, &block)
59
- if $query_count and IGNORED_SQL !~ sql
60
- $query_count += 1
61
- $query_sql << sql
62
- end
63
- execute_without_counting(sql, name, &block)
64
- end
65
-
66
- alias_method_chain :execute, :counting
67
- end
68
- end
69
-
70
- module FixtureSetup
71
- def fixtures(*tables)
72
- table_names = tables.map { |t| t.to_s }
73
-
74
- fixtures = Fixtures.create_fixtures ActiverecordTestConnector::FIXTURES_PATH, table_names
75
- @@loaded_fixtures = {}
76
- @@fixture_cache = {}
77
-
78
- unless fixtures.nil?
79
- if fixtures.instance_of?(Fixtures)
80
- @@loaded_fixtures[fixtures.table_name] = fixtures
81
- else
82
- fixtures.each { |f| @@loaded_fixtures[f.table_name] = f }
83
- end
84
- end
85
-
86
- table_names.each do |table_name|
87
- define_method(table_name) do |*fixtures|
88
- @@fixture_cache[table_name] ||= {}
89
-
90
- instances = fixtures.map do |fixture|
91
- if @@loaded_fixtures[table_name][fixture.to_s]
92
- @@fixture_cache[table_name][fixture] ||= @@loaded_fixtures[table_name][fixture.to_s].find
93
- else
94
- raise StandardError, "No fixture with name '#{fixture}' found for table '#{table_name}'"
95
- end
96
- end
97
-
98
- instances.size == 1 ? instances.first : instances
99
- end
100
- end
101
- end
102
- end
103
- end
104
-
@@ -1,3 +0,0 @@
1
- class Post < ActiveRecord::Base
2
- sortable_fields :title, :published_at
3
- end
@@ -1,16 +0,0 @@
1
- post1:
2
- id: 1
3
- title: "Post 1 title"
4
- body: "Post 1 body"
5
-
6
- post2:
7
- id: 2
8
- title: "Post 2 title"
9
- body: "Post 2 body"
10
-
11
- post3:
12
- id: 3
13
- title: "Post 3 title"
14
- body: "Post 3 body"
15
-
16
-
@@ -1,2 +0,0 @@
1
- class User < ActiveRecord::Base
2
- end
@@ -1,30 +0,0 @@
1
- adam:
2
- id: 1
3
- name: Adam
4
- salary: 80000
5
- bonus: true
6
-
7
- dave1:
8
- id: 2
9
- name: Dave
10
- salary: 9000
11
- bonus: true
12
-
13
- dave2:
14
- id: 3
15
- name: Dave
16
- salary: 70000
17
- bonus: true
18
-
19
- admin:
20
- id: 12
21
- name: admin
22
- salary: 10000
23
- bonus: false
24
-
25
- goofy:
26
- id: 13
27
- name: Goofy
28
- salary: 11000
29
- bonus: false
30
-
@@ -1,6 +0,0 @@
1
- $:.unshift File.expand_path('..', __FILE__)
2
- $:.unshift File.expand_path('../../lib', __FILE__)
3
- require 'simplecov'
4
- SimpleCov.start
5
- require 'all_sorts'
6
- require 'rspec'