Skip to content
This repository has been archived by the owner on May 29, 2022. It is now read-only.

Commit

Permalink
Width renamed as Size to be more generic
Browse files Browse the repository at this point in the history
  • Loading branch information
Nick Dunn committed Mar 4, 2016
1 parent 12b0dd0 commit 5749244
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 11 deletions.
3 changes: 0 additions & 3 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,3 @@ DEPENDENCIES
uglifier (>= 1.3.0)
unicorn
web-console (~> 2.0)

BUNDLED WITH
1.10.6
2 changes: 1 addition & 1 deletion app/controllers/tests_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def create
private

def test_params
params.require(:test).permit(:name, :platform, :browser, :width, :screenshot, :run_id)
params.require(:test).permit(:name, :platform, :browser, :size, :screenshot, :run_id)
end

def convert_image_command(input_file, output_file, canvas)
Expand Down
4 changes: 2 additions & 2 deletions app/models/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class Test < ActiveRecord::Base
dragonfly_accessor :screenshot
dragonfly_accessor :screenshot_baseline
dragonfly_accessor :screenshot_diff
validates :name, :browser, :platform, :width, :run, presence: true
validates :name, :browser, :platform, :size, :run, presence: true

def self.find_by_key
where(key: key)
Expand All @@ -31,7 +31,7 @@ def url
end

def create_key
self.key = "#{run.suite.project.name} #{run.suite.name} #{name} #{browser} #{platform} #{width}".parameterize
self.key = "#{run.suite.project.name} #{run.suite.name} #{name} #{browser} #{platform} #{size}".parameterize
self.save
end

Expand Down
4 changes: 2 additions & 2 deletions app/models/test_filters.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def platforms
end

def sizes
@tests.map{ |test| test.width }.uniq.sort
@tests.map{ |test| test.size }.uniq.sort
end

def filter_by_result
Expand All @@ -29,7 +29,7 @@ def tests
@tests = @tests.where(name: @params[:name]) unless @params[:name].blank?
@tests = @tests.where(browser: @params[:browser]) unless @params[:browser].blank?
@tests = @tests.where(platform: @params[:platform]) unless @params[:platform].blank?
@tests = @tests.where(width: @params[:size]) unless @params[:size].blank?
@tests = @tests.where(size: @params[:size]) unless @params[:size].blank?
if filter_by_result
@tests = @tests.where(pass: (@params[:result] == 'Passed' ? true : false))
end
Expand Down
5 changes: 5 additions & 0 deletions db/migrate/20160304180012_rename_width_to_size.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class RenameWidthToSize < ActiveRecord::Migration
def change
rename_column :tests, :width, :size
end
end
17 changes: 15 additions & 2 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,24 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 20160106085402) do
ActiveRecord::Schema.define(version: 20160304180012) do

# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"

create_table "friendly_id_slugs", force: :cascade do |t|
t.string "slug", null: false
t.integer "sluggable_id", null: false
t.string "sluggable_type", limit: 50
t.string "scope"
t.datetime "created_at"
end

add_index "friendly_id_slugs", ["slug", "sluggable_type", "scope"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type_and_scope", unique: true, using: :btree
add_index "friendly_id_slugs", ["slug", "sluggable_type"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type", using: :btree
add_index "friendly_id_slugs", ["sluggable_id"], name: "index_friendly_id_slugs_on_sluggable_id", using: :btree
add_index "friendly_id_slugs", ["sluggable_type"], name: "index_friendly_id_slugs_on_sluggable_type", using: :btree

create_table "projects", force: :cascade do |t|
t.string "name"
t.datetime "created_at", null: false
Expand Down Expand Up @@ -44,7 +57,7 @@
t.string "name"
t.string "browser"
t.string "platform"
t.string "width"
t.string "size"
t.integer "run_id"
t.boolean "baseline"
t.float "diff"
Expand Down
2 changes: 1 addition & 1 deletion features/step_definitions/runs_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
name: 'test test',
platform: 'osx',
browser: 'poltergiest',
width: '1024',
size: '1024',
screenshot: File.open('features/support/screenshots/run1.png')
}
)
Expand Down

0 comments on commit 5749244

Please sign in to comment.