Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rocket_pants 5 #1

Merged
merged 4 commits into from
Jul 18, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
version: 2

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the version of circle or the version number for our project?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is what the circle documentation says to put -- I think it's the version of circle, because everyone on the internet has it set to 2 (circle 2)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are these circle config changes for?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh nvm this is for the fork, ok carry on

jobs:
run_tests:
shell: /bin/bash -e -o pipefail
environment:
- BUILD_PLATFORM: igg-circleci
- REPO_URL: https://github.com/indiegogo/rocket_pants
- BUILD_DESCRIPTION: JSON API love for Rails and ActionController
- BUNDLE_PATH: vendor/bundle

docker:
- image: gcr.io/indiegogo-staging/monorail-ci-base:v2-current
auth:
username: _json_key
password: $DEV_GCR_KEY_JSON

steps:
- checkout
- run:
name: "install sqlite3"
command: |
sudo apt-get update; sudo apt-get install libsqlite3-dev
- run:
name: "Bundle"
command: |
bundle install --path ${BUNDLE_PATH} --jobs 4 --retry 3
- run:
name: "Run rspec"
command: |
bundle exec rspec ./spec

workflows:
version: 2
rocket_pants:
jobs:
- run_tests:
context: org-global
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ doc/
.yardoc/
coverage/
pkg/
Gemfile.lock

.idea/
.DS_Store
**/.DS_Store
**/.DS_Store
.byebug_history
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.9.3
ruby-2.3.5
20 changes: 0 additions & 20 deletions .travis.yml

This file was deleted.

14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,20 @@

**Please Note**: This change log only covers v1.3 forwards - apologies for anything missing prior to that.

## Version 5.0.0

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're not going to just call it version 2? :-P

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why would we do such a thing???


* Bringing Rocket Pants out of life support, namely: updating Ruby version to 2.3.5
* Upgraded Gems (Hashie, Rspec)
* Removed Crack (Don't do crack)
* 'expose' method no longer validates invalid single objects (removed self.invalid?(object))
* Fixes to support latest version of Kaminari
* Use stable version of Indiegogo active_model_serializers
* Check in Gemfile.lock
* Update test dependencies and make sure all tests pass
* Remove TestHelper Rspec mixin
* Removed be_exposed Rspec matcher due to egregious testing patterns
* Removed Proxy Based testing in favor of testing default_serializer_options as unit test

## Version 1.13.1

* Bug fix to bugsnag, thanks to [DamirSvrtan](https://github.com/DamirSvrtan).
Expand Down
32 changes: 11 additions & 21 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,25 +1,15 @@
path "../"
source 'https://rubygems.org'

# Allow testing multiple versions with Travis.
rails_version = ENV['RAILS_VERSION']
if rails_version && rails_version.length > 0
puts "Testing Rails Version = #{rails_version}"
# Override the specific versions
gem 'railties', rails_version
gem 'actionpack', rails_version
gem 'activerecord', rails_version
group :development, :test do
gem 'pry'
gem 'pry-byebug'
# stable forked version of active_model_serializers in order to write an integration test
gem 'active_model_serializers', git: '[email protected]:indiegogo/active_model_serializers.git', branch: '0-8-stable'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uggghhh

# currently testing against 5.0.0
gem 'railties', '5.0.0'
gem 'actionpack', '5.0.0'
gem 'activerecord', '5.0.0'
end

if (moneta_version = ENV["MONETA_VERSION"])
gem 'moneta', moneta_version
end

gem 'rspec'

if (wp_version = ENV['WILL_PAGINATE_VERSION'])
gem 'will_paginate', wp_version
end

gem 'active_model_serializers', ENV['AMS_VERSION'] || '> 0.0'

gemspec
gemspec
171 changes: 171 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
GIT
remote: [email protected]:indiegogo/active_model_serializers.git
revision: 91352cf8f900f3be9ff07cd722ac00d826803b27
branch: 0-8-stable
specs:
active_model_serializers (0.8.1)
activemodel (>= 3.0)

PATH
remote: ..
specs:

PATH
remote: .
specs:
rocket_pants (5.0.0)
actionpack (>= 4.0, < 6.0)
api_smith
hashie (>= 1.0, < 4)
moneta
railties (>= 4.0, < 6.0)
will_paginate (~> 3.0)

GEM
remote: https://rubygems.org/
specs:
actionpack (5.0.0)
actionview (= 5.0.0)
activesupport (= 5.0.0)
rack (~> 2.0)
rack-test (~> 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (5.0.0)
activesupport (= 5.0.0)
builder (~> 3.1)
erubis (~> 2.7.0)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
activemodel (5.0.0)
activesupport (= 5.0.0)
activerecord (5.0.0)
activemodel (= 5.0.0)
activesupport (= 5.0.0)
arel (~> 7.0)
activesupport (5.0.0)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (~> 0.7)
minitest (~> 5.1)
tzinfo (~> 1.1)
addressable (2.5.2)
public_suffix (>= 2.0.2, < 4.0)
api_smith (1.3.0)
hashie (>= 1.0, < 3.0)
httparty
arel (7.1.4)
builder (3.2.3)
byebug (10.0.2)
coderay (1.1.2)
concurrent-ruby (1.0.5)
crack (0.4.3)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought you were removing crack, according to the comment in the CHANGELOG.md.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it looks like webmock uses crack unfortunately

safe_yaml (~> 1.0.0)
crass (1.0.4)
diff-lcs (1.3)
erubis (2.7.0)
hashdiff (0.3.7)
hashie (2.1.2)
httparty (0.16.2)
multi_xml (>= 0.5.2)
i18n (0.9.5)
concurrent-ruby (~> 1.0)
kaminari (1.1.1)
activesupport (>= 4.1.0)
kaminari-actionview (= 1.1.1)
kaminari-activerecord (= 1.1.1)
kaminari-core (= 1.1.1)
kaminari-actionview (1.1.1)
actionview
kaminari-core (= 1.1.1)
kaminari-activerecord (1.1.1)
activerecord
kaminari-core (= 1.1.1)
kaminari-core (1.1.1)
loofah (2.2.2)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
method_source (0.9.0)
mini_portile2 (2.3.0)
minitest (5.11.3)
moneta (1.0.0)
multi_xml (0.6.0)
nokogiri (1.8.4)
mini_portile2 (~> 2.3.0)
pry (0.11.3)
coderay (~> 1.1.0)
method_source (~> 0.9.0)
pry-byebug (3.6.0)
byebug (~> 10.0)
pry (~> 0.10)
public_suffix (3.0.2)
rack (2.0.5)
rack-test (0.6.3)
rack (>= 1.0)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
nokogiri (>= 1.6)
rails-html-sanitizer (1.0.4)
loofah (~> 2.2, >= 2.2.2)
railties (5.0.0)
actionpack (= 5.0.0)
activesupport (= 5.0.0)
method_source
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rake (12.3.1)
reversible_data (1.0.0)
activerecord
activesupport
rspec (3.7.0)
rspec-core (~> 3.7.0)
rspec-expectations (~> 3.7.0)
rspec-mocks (~> 3.7.0)
rspec-core (3.7.1)
rspec-support (~> 3.7.0)
rspec-expectations (3.7.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.7.0)
rspec-mocks (3.7.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.7.0)
rspec-rails (3.7.2)
actionpack (>= 3.0)
activesupport (>= 3.0)
railties (>= 3.0)
rspec-core (~> 3.7.0)
rspec-expectations (~> 3.7.0)
rspec-mocks (~> 3.7.0)
rspec-support (~> 3.7.0)
rspec-support (3.7.1)
safe_yaml (1.0.4)
sqlite3 (1.3.13)
thor (0.20.0)
thread_safe (0.3.6)
tzinfo (1.2.5)
thread_safe (~> 0.1)
webmock (3.4.2)
addressable (>= 2.3.6)
crack (>= 0.3.2)
hashdiff
will_paginate (3.1.6)

PLATFORMS
ruby

DEPENDENCIES
actionpack (= 5.0.0)
active_model_serializers!
activerecord (= 5.0.0)
kaminari
pry
pry-byebug
railties (= 5.0.0)
reversible_data (~> 1.0)
rocket_pants!
rspec (>= 2.4, < 4.0)
rspec-rails (>= 2.4, < 4.0)
sqlite3
webmock

BUNDLED WITH
1.16.1
28 changes: 18 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
# Rocket Pants! [![Build Status](https://secure.travis-ci.org/Sutto/rocket_pants.png?branch=master)](http://travis-ci.org/Sutto/rocket_pants)
# Rocket Pants!

**Please Note:** Work on RocketPants 2.0 is currently underway on the [2.0-rewrite](https://github.com/Sutto/rocket_pants/tree/2.0-rewrite) branch. Please check there before requesting features.
**Please Note:** RocketPants v5.0.0 is an release compatible with Rails 5.0.

## Rails 5.0 Release

Removed: TestHelper, Crack
Removed: Strange Proxy Test - replaced with unit test
Upgraded: Rspec, Ruby, Hashie
Removed: Default Version (sorry you gotta specify it now if you care)

See Changelog for more details.

## Introduction

Expand Down Expand Up @@ -635,13 +644,6 @@ post :index, :version => 1, :payload => { :foo => 'bar' ... }
```

Otherwise it will raise an exception.

To set the version to be used for all tests in a given set of specs you can use the `default_version` tag. It will set the version for all tests in that block and not require `:version` to be set individually:

```ruby
describe YourAwesomeController do
default_version 1
end
```

RocketPants includes a set of helpers to make testing controllers built on `RocketPants::Base` simpler.
Expand All @@ -660,10 +662,16 @@ Likewise, it adds the following helper methods:
To set up the integration, in your `spec/spec_helper.rb` add:

```ruby
config.include RocketPants::TestHelper, :type => :controller
config.include RocketPants::RSpecMatchers, :type => :controller
```


For Rocket Pants 5.0 we have removed TestHelper
Remove this line:
```
# config.include RocketPants::TestHelper, :type => :controller
```

Inside the `RSpec.configure do |config|` block.

## Contributors
Expand Down
9 changes: 6 additions & 3 deletions lib/rocket_pants.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,12 @@ def show_exception_message=(value)
end

def default_env
env = Rails.env.to_s if defined?(Rails.env)
env ||= ENV['RAILS_ENV'].presence || ENV['RACK_ENV'].presence || "development"
ActiveSupport::StringInquirer.new env
if defined?(Rails.env) && Rails&.env

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You shouldn't have to use &. since you just used Rails...

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah I can remove it, np

env = Rails.env.to_s
else
env ||= ENV['RAILS_ENV'].presence || ENV['RACK_ENV'].presence || "development"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't really need the ||= here. Perhaps if you want it to be clearer with the if-else, maybe do this instead:

env = if defined?(Rails.env) && Rails.env
        Rails.env.to_s
      else
        ENV["RAILS_ENV"].presence || ENV["RACK_ENV"].presence || "development"
      end

even though it seems to me that the original structure is fine and just add the addition Rails.env condition at the end of the original if.

end
ActiveSupport::StringInquirer.new(env)
end

def default_pass_through_errors
Expand Down
2 changes: 0 additions & 2 deletions lib/rocket_pants/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,9 @@ class Base < ActionController::Metal
end

MODULES = [
ActionController::HideActions,
ActionController::UrlFor,
ActionController::Redirecting,
ActionController::ConditionalGet,
ActionController::RackDelegation,
record_identifier_klass,
ActionController::HttpAuthentication::Basic::ControllerMethods,
ActionController::HttpAuthentication::Digest::ControllerMethods,
Expand Down
Loading