Check code style with cane and tailor

openid
Marcin Kulik 12 years ago
parent a3d12d4a84
commit 3f798ab7aa

@ -35,6 +35,8 @@ group :test, :development do
gem 'guard'
gem 'guard-jasmine'
gem 'libnotify'
gem 'cane'
gem 'tailor'
# gem 'jasmine-headless-webkit'
# gem 'guard-jasmine-headless-webkit'
end

@ -37,6 +37,8 @@ GEM
awesome_print (0.4.0)
builder (3.0.0)
bzip2-ruby (0.2.7)
cane (1.0.0)
tailor
capybara (1.1.2)
mime-types (>= 1.16)
nokogiri (>= 1.3.3)
@ -199,6 +201,9 @@ GEM
hike (~> 1.2)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
tailor (0.1.5)
term-ansicolor (>= 1.0.5)
term-ansicolor (1.0.7)
thor (0.14.6)
tilt (1.3.3)
treetop (1.4.10)
@ -218,6 +223,7 @@ DEPENDENCIES
airbrake
awesome_print
bzip2-ruby
cane
capybara
carrierwave
coffee-rails
@ -240,5 +246,6 @@ DEPENDENCIES
rspec-rails
ruby-debug19
sass-rails
tailor
tzinfo
uglifier (>= 1.0.3)

@ -4,7 +4,10 @@ class AsciicastsController < ApplicationController
respond_to :html, :json
def index
@asciicasts = Asciicast.order("created_at DESC").page(params[:page]).per(PER_PAGE)
@asciicasts = Asciicast.
order("created_at DESC").
page(params[:page]).
per(PER_PAGE)
end
def show

@ -2,8 +2,13 @@ class ExceptionsController < ApplicationController
def not_found
respond_to do |format|
format.any { render :text => 'Requested resource not found', :status => 404 }
format.html { render :status => 404 }
format.any do
render :text => 'Requested resource not found', :status => 404
end
format.html do
render :status => 404
end
end
end

@ -3,7 +3,9 @@ class UsersController < ApplicationController
def show
@user = User.find_by_nickname(params[:nickname])
@asciicasts =
@user.asciicasts.order("created_at DESC").page(params[:page]).per(PER_PAGE)
@asciicasts = @user.asciicasts.
order("created_at DESC").
page(params[:page]).
per(PER_PAGE)
end
end

@ -17,7 +17,7 @@ class Comment < ActiveRecord::Base
super({
:include => {
:user => {
:only => [ :id, :nickname, :avatar_url ]
:only => [:id, :nickname, :avatar_url]
}
},
:methods => [:created]

@ -41,7 +41,8 @@ class BasicUploader < CarrierWave::Uploader::Base
# end
# Override the filename of the uploaded files:
# Avoid using model.id or version_name here, see uploader/store.rb for details.
# Avoid using model.id or version_name here,
# see uploader/store.rb for details.
# def filename
# "something.jpg" if original_filename
# end

@ -1,4 +1,6 @@
#!/bin/bash
bundle exec rake db:create db:migrate
bundle exec rake
bundle exec rake && \
bundle exec cane --no-doc --abc-glob '{app,lib,spec}/**/*.rb' --style-glob '{app,lib,spec}/**/*.rb' && \
bundle exec tailor app && bundle exec tailor lib && bundle exec tailor spec

@ -18,7 +18,7 @@ describe Api::CommentsController do
def dispatch
post :create,
:asciicast_id => asciicast.id,
:comment => {"body" => "Foo"},
:comment => { "body" => "Foo" },
:format => :json
end

@ -30,7 +30,7 @@ describe FakeController do
describe "action raise unauthorized" do
context "when xhr" do
before{ request.stub(:xhr?).and_return(true) }
before { request.stub(:xhr?).and_return(true) }
it "response with 401" do
get :foo
@ -56,7 +56,7 @@ describe FakeController do
context "when action raise forbidden" do
context "when xhr" do
before{ request.stub(:xhr?).and_return(true) }
before { request.stub(:xhr?).and_return(true) }
it "response with 401" do
get :bar

@ -17,7 +17,9 @@ describe UserTokensController do
end
it 'calls Asciicast.assign_user' do
Asciicast.should_receive(:assign_user).with(user_token.token, user).and_return(1)
Asciicast.should_receive(:assign_user).
with(user_token.token, user).
and_return(1)
post :create, :user_token => user_token.token
end

@ -12,7 +12,11 @@ FactoryGirl.define do
terminal_lines 25
shell "/bin/bash"
uname "uname"
stdout { fixture_file_upload("spec/fixtures/stdout", "application/octet-stream") }
stdout_timing { fixture_file_upload("spec/fixtures/stdout", "application/octet-stream") }
stdout do
fixture_file_upload("spec/fixtures/stdout", "application/octet-stream")
end
stdout_timing do
fixture_file_upload("spec/fixtures/stdout", "application/octet-stream")
end
end
end

@ -3,6 +3,8 @@
FactoryGirl.define do
factory :user_token do
association :user
sequence(:token) { |n| "2b4b4e02-6613-11e1-9be5-#{Kernel.format('%012i', n)}" }
sequence(:token) do |n|
"2b4b4e02-6613-11e1-9be5-#{Kernel.format('%012i', n)}"
end
end
end

@ -6,7 +6,7 @@ require 'spec_helper'
# describe AsciicastsHelper do
# describe "string concat" do
# it "concats two strings with spaces" do
# helper.concat_strings("this","that").should == "this that"
# helper.concat_strings("this", "that").should == "this that"
# end
# end
# end

@ -8,7 +8,9 @@ describe Asciicast do
describe '.assign_user' do
let(:user) { Factory(:user) }
let(:token) { 'token' }
let!(:asciicast) { Factory(:asciicast, :user => nil, :user_token => token) }
let!(:asciicast) do
Factory(:asciicast, :user => nil, :user_token => token)
end
subject { Asciicast.assign_user(token, user) }
@ -46,7 +48,9 @@ describe Asciicast do
describe '#assign_user' do
let(:user) { Factory(:user) }
let(:asciicast) { Factory(:asciicast, :user => nil, :user_token => user_token) }
let(:asciicast) do
Factory(:asciicast, :user => nil, :user_token => user_token)
end
context 'when user exists with given token' do
let(:user_token) { Factory(:user_token, :user => user).token }

@ -34,7 +34,7 @@ describe User do
end
context "when avatar available" do
let(:avatar_url) { "http://foo.bar/avatar.jpg"}
let(:avatar_url) { "http://foo.bar/avatar.jpg" }
before do
OauthHelper.stub(:get_avatar_url).and_return(avatar_url)

@ -5,7 +5,7 @@ require 'rspec/autorun'
# Requires supporting ruby files with custom matchers and macros, etc,
# in spec/support/ and its subdirectories.
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
RSpec.configure do |config|
config.mock_with :rspec

Loading…
Cancel
Save