Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
nepalez committed Feb 6, 2017
0 parents commit e5827f0
Show file tree
Hide file tree
Showing 15 changed files with 199 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
engines:
bundler-audit:
enabled: true
duplication:
enabled: true
config:
languages:
- ruby
fixme:
enabled: true
rubocop:
enabled: true
ratings:
paths:
- "**.rb"
exclude_paths:
- spec/
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/.bundle/
/.yardoc
/Gemfile.lock
/_yardoc/
/coverage/
/doc/
/pkg/
/spec/reports/
/tmp/
3 changes: 3 additions & 0 deletions .rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
--require spec_helper
--format documentation
--color
30 changes: 30 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
AllCops:
DisplayCopNames: true
DisplayStyleGuide: true
StyleGuideCopsOnly: true
TargetRubyVersion: 2.3

Metrics/ParameterLists:
Max: 5

Style/Alias:
Enabled: false

Style/ClassAndModuleChildren:
EnforcedStyle: compact

Style/FileName:
Enabled: false

Style/FrozenStringLiteralComment:
Enabled: false

Style/ModuleFunction:
Enabled: false

Style/StringLiterals:
EnforcedStyle: double_quotes

Style/StringLiteralsInInterpolation:
EnforcedStyle: double_quotes
14 changes: 14 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
sudo: false
language: ruby
cache: bundler
script:
- bundle exec rspec
- bundle exec rubocop
rvm:
- 2.3.0
- ruby-head
before_install: gem install bundler
matrix:
allow_failures:
- rvm: ruby-head
9 changes: 9 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
source "https://rubygems.org"

# Specify your gem's dependencies in tram-form.gemspec
gemspec

group :test, :development do
gem "pry"
gem "pry-byebug"
end
21 changes: 21 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2017 Andrew Kozin (nepalez), Evil Martians

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
41 changes: 41 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Rspec::Sqlimit

Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/rspec/sqlimit`. To experiment with that code, run `bin/console` for an interactive prompt.

TODO: Delete this and the text above, and describe your gem

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'rspec-sqlimit'
```

And then execute:

$ bundle

Or install it yourself as:

$ gem install rspec-sqlimit

## Usage

TODO: Write usage instructions here

## Development

After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).

## Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/rspec-sqlimit.


## License

The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).

6 changes: 6 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
require "bundler/gem_tasks"
require "rspec/core/rake_task"

RSpec::Core::RakeTask.new(:spec)

task default: :spec
1 change: 1 addition & 0 deletions lib/rspec-sqlimit.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require_relative "rspec/sqlimit"
11 changes: 11 additions & 0 deletions lib/rspec/sqlimit.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
require "active_record"
require "rspec"

module RSpec::SQLimit
require_relative "sqlimit/counter"
end

RSpec::Matchers.define :exceed_query_limit do
match do |block|
end
end
Empty file added lib/rspec/sqlimit/counter.rb
Empty file.
21 changes: 21 additions & 0 deletions rspec-sqlimit.gemspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Gem::Specification.new do |gem|
gem.name = "rspec-sqlimit"
gem.version = "0.0.1"
gem.author = "Andrew Kozin (nepalez)"
gem.email = "andrew.kozin@gmail.com"
gem.homepage = "https://github.com/nepalez/rspec-sqlimit"
gem.summary = "RSpec matcher to control SQL queries made by block of code"
gem.license = "MIT"

gem.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
gem.test_files = gem.files.grep(/^spec/)
gem.extra_rdoc_files = Dir["README.md", "LICENSE", "CHANGELOG.md"]

gem.required_ruby_version = ">= 2.3"

gem.add_runtime_dependency "activerecord", "> 4.0", "< 6.0"
gem.add_runtime_dependency "rspec", "~> 3.0"

gem.add_development_dependency "rake"
gem.add_development_dependency "rubocop", "~> 0.44"
end
7 changes: 7 additions & 0 deletions spec/rspec/sqlimit_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
require "spec_helper"

describe RSpec::SQLimit do
it "does something useful" do
expect(false).to eq(true)
end
end
8 changes: 8 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
require "pry"
require "rspec-sqlimit"

RSpec.configure do |config|
config.order = :random
config.filter_run focus: true
config.run_all_when_everything_filtered = true
end

0 comments on commit e5827f0

Please sign in to comment.