Permalink
Browse files

Merge branch 'master' into restore_1_9_3_plus_rails_4_0_and_4_1_support

  • Loading branch information...
2 parents 81bcae3 + bf6f3e0 commit a16ad369bc667bc2656a30a488a8cd80390f348d @timoschilling timoschilling committed on GitHub Jan 11, 2017
View
@@ -10,7 +10,7 @@ install:
- bundle exec rake setup
- ./script/travis_cache upload
script:
- - bundle exec rake test_with_coveralls
+ - bundle exec rake test
rvm:
- 1.9.3
- 2.2.6
View
@@ -24,7 +24,6 @@ platform :ruby_19 do # Remove this block when we drop support for Ruby 1.9
gem 'mime-types', '< 3'
gem 'nokogiri', '< 1.7'
gem 'public_suffix', '< 1.5'
- gem 'term-ansicolor', '< 1.4'
end
@@ -66,7 +65,7 @@ group :test do
gem 'capybara'
gem 'simplecov', require: false # Test coverage generator. Go to /coverage/ after running tests
gem 'json', '~> 1.8', require: false # Required by simplecov, > 2 removes support for Ruby 1.9
- gem 'coveralls', require: false # Test coverage website. Go to https://coveralls.io
+ gem 'codecov', require: false # Test coverage website. Go to https://codecov.io
gem 'tins', '~> 1.6.0', require: false # Required by coveralls, > 1.6.0 removes support for Ruby 1.9
gem 'cucumber-rails', require: false
gem 'cucumber', '1.3.20'
View
@@ -5,7 +5,7 @@ Active Admin is a Ruby on Rails framework for creating elegant backends for webs
[![Version ](http://img.shields.io/gem/v/activeadmin.svg) ](https://rubygems.org/gems/activeadmin)
[![Travis CI ](http://img.shields.io/travis/activeadmin/activeadmin/master.svg) ](https://travis-ci.org/activeadmin/activeadmin)
[![Quality ](http://img.shields.io/codeclimate/github/activeadmin/activeadmin.svg) ](https://codeclimate.com/github/activeadmin/activeadmin)
-[![Coverage ](http://img.shields.io/coveralls/activeadmin/activeadmin.svg) ](https://coveralls.io/r/activeadmin/activeadmin)
+[![Coverage ](https://codecov.io/gh/activeadmin/activeadmin/branch/master/graph/badge.svg)](https://codecov.io/gh/activeadmin/activeadmin)
[![Inch CI ](http://inch-ci.org/github/activeadmin/activeadmin.svg?branch=master) ](http://inch-ci.org/github/activeadmin/activeadmin)
## State of the project
@@ -14,7 +14,7 @@ Feature: Development Reloading
ActiveAdmin.register Post do
if Rails::VERSION::MAJOR >= 4
permit_params :custom_category_id, :author_id, :title,
- :body, :position, :published_at, :starred
+ :body, :position, :published_date, :starred
end
end
"""
@@ -12,7 +12,7 @@ Feature: Edit Page
ActiveAdmin.register Post do
if Rails::VERSION::MAJOR >= 4
permit_params :custom_category_id, :author_id, :title,
- :body, :position, :published_at, :starred
+ :body, :position, :published_date, :starred
end
end
"""
@@ -34,15 +34,15 @@ Feature: Edit Page
Given a configuration of:
"""
ActiveAdmin.register Post do
- permit_params :category, :author, :title, :body, :published_at, :starred if Rails::VERSION::MAJOR >= 4
+ permit_params :category, :author, :title, :body, :published_date, :starred if Rails::VERSION::MAJOR >= 4
form do |f|
f.inputs "Your Post" do
f.input :title
f.input :body
end
f.inputs "Publishing" do
- f.input :published_at
+ f.input :published_date
end
f.actions
end
@@ -63,15 +63,15 @@ Feature: Edit Page
Given a configuration of:
"""
ActiveAdmin.register Post do
- permit_params :category, :author, :title, :body, :published_at, :starred if Rails::VERSION::MAJOR >= 4
+ permit_params :category, :author, :title, :body, :published_date, :starred if Rails::VERSION::MAJOR >= 4
form :html => {} do |f|
f.inputs "Your Post" do
f.input :title
f.input :body
end
f.inputs "Publishing" do
- f.input :published_at
+ f.input :published_date
end
f.actions
end
@@ -102,7 +102,7 @@ Feature: Edit Page
Given a configuration of:
"""
ActiveAdmin.register Post do
- permit_params :category, :author, :title, :body, :published_at, :starred if Rails::VERSION::MAJOR >= 4
+ permit_params :category, :author, :title, :body, :published_date, :starred if Rails::VERSION::MAJOR >= 4
form :partial => "form"
end
@@ -9,13 +9,13 @@ Feature: Index Filtering
When I am on the index page for posts
Then I should see "Displaying all 3 Posts"
And I should see the following filters:
- | Author | select |
- | Category | select |
- | Title | string |
- | Body | string |
- | Published at | date range |
- | Created at | date range |
- | Updated at | date range |
+ | Author | select |
+ | Category | select |
+ | Title | string |
+ | Body | string |
+ | Published date | date range |
+ | Created at | date range |
+ | Updated at | date range |
When I fill in "Title" with "Hello World 2"
And I press "Filter"
@@ -12,7 +12,7 @@ Feature: Format as CSV
When I am on the index page for posts
And I follow "CSV"
And I should download a CSV file for "posts" containing:
- | Id | Title | Body | Published at | Position | Starred | Created at | Updated at |
+ | Id | Title | Body | Published date | Position | Starred | Created at | Updated at |
| \d+ | Hello World | | | | | (.*) | (.*) |
Scenario: Default with alias
@@ -24,7 +24,7 @@ Feature: Format as CSV
When I am on the index page for my_articles
And I follow "CSV"
And I should download a CSV file for "my-articles" containing:
- | Id | Title | Body | Published at | Position | Starred | Created at | Updated at |
+ | Id | Title | Body | Published date | Position | Starred | Created at | Updated at |
Scenario: With CSV format customization
Given a configuration of:
@@ -218,13 +218,13 @@ Feature: Index as Table
ActiveAdmin.register Post do
index do
column :author_id do end
- column 'published_at' do end
+ column 'published_date' do end
column :category do end
end
end
"""
Then I should see a sortable table header with "Author"
- Then I should see a sortable table header with "published_at"
+ Then I should see a sortable table header with "published_date"
Then I should not see a sortable table header with "Category"
Scenario: Columns with block are not sortable by when sortable option equals to false
@@ -234,12 +234,12 @@ Feature: Index as Table
ActiveAdmin.register Post do
index do
column :author_id, sortable: false do end
- column 'published_at', sortable: false do end
+ column 'published_date', sortable: false do end
end
end
"""
Then I should not see a sortable table header with "Author"
- Then I should not see a sortable table header with "published_at"
+ Then I should not see a sortable table header with "published_date"
Scenario: Sorting
Given a post with the title "Hello World" and body "From the body" exists
@@ -250,12 +250,12 @@ Feature: Index as Table
"""
When I am on the index page for posts
Then I should see the "index_table_posts" table:
- | [ ] | Id | Title | Body | Published At | Position | Starred | Created At | Updated At | |
+ | [ ] | Id | Title | Body | Published Date | Position | Starred | Created At | Updated At | |
| [ ] | 2 | Bye bye world | Move your... | | | No | /.*/ | /.*/ | ViewEditDelete |
| [ ] | 1 | Hello World | From the body | | | No | /.*/ | /.*/ | ViewEditDelete |
When I follow "Id"
Then I should see the "index_table_posts" table:
- | [ ] | Id | Title | Body | Published At | Position | Starred | Created At | Updated At | |
+ | [ ] | Id | Title | Body | Published Date | Position | Starred | Created At | Updated At | |
| [ ] | 1 | Hello World | From the body | | | No | /.*/ | /.*/ | ViewEditDelete |
| [ ] | 2 | Bye bye world | Move your... | | | No | /.*/ | /.*/ | ViewEditDelete |
@@ -17,7 +17,7 @@ Feature: Index Scope To
# Set up some scopes
scope :all, default: true
scope :published do |posts|
- posts.where "published_at IS NOT NULL"
+ posts.where "published_date IS NOT NULL"
end
end
"""
@@ -85,7 +85,7 @@ Feature: Index Scoping
ActiveAdmin.register Post do
scope :all, :default => true
scope :published do |posts|
- posts.where("published_at IS NOT NULL")
+ posts.where("published_date IS NOT NULL")
end
end
"""
@@ -108,7 +108,7 @@ Feature: Index Scoping
ActiveAdmin.register Post do
scope :all, :default => true
scope :published do |posts|
- posts.where("published_at IS NOT NULL")
+ posts.where("published_date IS NOT NULL")
end
end
"""
@@ -215,7 +215,7 @@ Feature: Index Scoping
ActiveAdmin.register Post do
scope :all, :default => true
scope :published do |posts|
- posts.where("published_at IS NOT NULL")
+ posts.where("published_date IS NOT NULL")
end
index do
@@ -11,7 +11,7 @@ Feature: New Page
ActiveAdmin.register Post do
if Rails::VERSION::MAJOR >= 4
permit_params :custom_category_id, :author_id, :title,
- :body, :position, :published_at, :starred
+ :body, :position, :published_date, :starred
end
end
"""
@@ -34,15 +34,15 @@ Feature: New Page
Given a configuration of:
"""
ActiveAdmin.register Post do
- permit_params :custom_category_id, :author_id, :title, :body, :published_at, :starred if Rails::VERSION::MAJOR >= 4
+ permit_params :custom_category_id, :author_id, :title, :body, :published_date, :starred if Rails::VERSION::MAJOR >= 4
form do |f|
f.inputs "Your Post" do
f.input :title
f.input :body
end
f.inputs "Publishing" do
- f.input :published_at
+ f.input :published_date
end
f.actions
end
@@ -70,7 +70,7 @@ Feature: New Page
Given a configuration of:
"""
ActiveAdmin.register Post do
- permit_params :custom_category_id, :author_id, :title, :body, :published_at, :starred if Rails::VERSION::MAJOR >= 4
+ permit_params :custom_category_id, :author_id, :title, :body, :published_date, :starred if Rails::VERSION::MAJOR >= 4
form :partial => "form"
end
@@ -87,7 +87,7 @@ Feature: New Page
Given a configuration of:
"""
ActiveAdmin.register Post do
- permit_params :custom_category_id, :author_id, :title, :body, :published_at, :starred if Rails::VERSION::MAJOR >= 4
+ permit_params :custom_category_id, :author_id, :title, :body, :published_date, :starred if Rails::VERSION::MAJOR >= 4
form do |f|
f.inputs "Your Post" do
@@ -98,7 +98,7 @@ Feature: New Page
f.input :body
end
f.inputs "Publishing" do
- f.input :published_at
+ f.input :published_date
end
f.actions
end
@@ -11,7 +11,7 @@ Feature: Renamed Resource
ActiveAdmin.register Blog::Post, as: 'Post' do
if Rails::VERSION::MAJOR >= 4
permit_params :custom_category_id, :author_id, :title,
- :body, :position, :published_at, :starred
+ :body, :position, :published_date, :starred
end
end
"""
@@ -11,7 +11,7 @@ def create_user(name, type = 'User')
category = Category.where(name: category_name).first_or_create if category_name
title ||= "Hello World %i"
count.times do |i|
- Post.create! title: title % i, body: body, author: author, published_at: published, custom_category_id: category.try(:id), starred: starred
+ Post.create! title: title % i, body: body, author: author, published_date: published, custom_category_id: category.try(:id), starred: starred
end
end
@@ -15,12 +15,12 @@ def to_html
end
def gt_input_name
- "#{method}_gteq_date"
+ column && column.type == :date ? "#{method}_gteq" : "#{method}_gteq_datetime"
end
alias :input_name :gt_input_name
def lt_input_name
- "#{method}_lteq_date"
+ column && column.type == :date ? "#{method}_lteq" : "#{method}_lteq_datetime"
end
def input_html_options(input_name = gt_input_name)
View
@@ -10,11 +10,11 @@
config.add_predicate old, arel_predicate: current
end
- config.add_predicate 'gteq_date',
+ config.add_predicate 'gteq_datetime',
arel_predicate: 'gteq',
formatter: ->(v) { v.beginning_of_day }
- config.add_predicate 'lteq_date',
+ config.add_predicate 'lteq_datetime',
arel_predicate: 'lt',
formatter: ->(v) { v + 1.day }
end
View
@@ -15,3 +15,6 @@
add_filter 'features/'
add_filter 'bundle/' # for Travis
end
+
+require 'codecov'
+SimpleCov.formatter = SimpleCov::Formatter::Codecov
@@ -4,7 +4,7 @@
copy_file File.expand_path('../templates/manifest.js', __FILE__), 'app/assets/config/manifest.js', force: true
end
-generate :model, 'post title:string body:text published_at:datetime author_id:integer ' +
+generate :model, 'post title:string body:text published_date:date author_id:integer ' +
'position:integer custom_category_id:integer starred:boolean foo_id:integer'
create_file 'app/models/post.rb', <<-RUBY.strip_heredoc, force: true
class Post < ActiveRecord::Base
@@ -15,13 +15,13 @@ class Post < ActiveRecord::Base
accepts_nested_attributes_for :taggings
unless Rails::VERSION::MAJOR > 3 && !defined? ProtectedAttributes
- attr_accessible :id, :title, :body, :starred, :author, :position, :published_at, :author_id, :custom_category_id, :category
+ attr_accessible :id, :title, :body, :starred, :author, :position, :published_date, :author_id, :custom_category_id, :category
end
end
RUBY
copy_file File.expand_path('../templates/post_decorator.rb', __FILE__), 'app/models/post_decorator.rb'
-generate :model, 'blog/post title:string body:text published_at:datetime author_id:integer ' +
+generate :model, 'blog/post title:string body:text published_date:date author_id:integer ' +
'position:integer custom_category_id:integer starred:boolean foo_id:integer'
create_file 'app/models/blog/post.rb', <<-RUBY.strip_heredoc, force: true
class Blog::Post < ActiveRecord::Base
@@ -32,7 +32,7 @@ class Blog::Post < ActiveRecord::Base
accepts_nested_attributes_for :taggings
unless Rails::VERSION::MAJOR > 3 && !defined? ProtectedAttributes
- attr_accessible :title, :body, :starred, :author, :position, :published_at, :author_id, :custom_category_id, :category
+ attr_accessible :title, :body, :starred, :author, :position, :published_date, :author_id, :custom_category_id, :category
end
end
RUBY
Oops, something went wrong.

0 comments on commit a16ad36

Please sign in to comment.