Commit Graph

370 Commits (ecc9d098d5fe1f514e4dc3a12d9995af20c36444)

Author SHA1 Message Date
Marcin Kulik 03f9d1b1d3 Don't use command as title when command == shell 10 years ago
Marcin Kulik 9d6a01fa41 Differentiate avatar between unconfirmed users with the same tmp username 10 years ago
Marcin Kulik 45d1d6c18b Use retro gravatars for default avatars 10 years ago
Marcin Kulik c9ccc1b066 Add ability to set custom thumbnail frame time 10 years ago
Marcin Kulik 8d496bd418 Make snapshot generation aware of custom snapshot time on asciicast 10 years ago
Marcin Kulik 3207c4a65f Update OS detection for 0.9.9 client's User-Agent format 10 years ago
Marcin Kulik e9f4ed1f61 Accept api token as http basic auth password 10 years ago
Marcin Kulik 427c19638c Prompt for username after login 10 years ago
Marcin Kulik feb9703620 Remove old authentication code (browser-id, github, twitter) 10 years ago
Marcin Kulik 7397e14a57 Remove old user sign up code 10 years ago
Marcin Kulik 0cd4559f5a Log in by email without Persona 10 years ago
Marcin Kulik ca156564f5 Don't use "dummy" anywhere 10 years ago
Marcin Kulik c4a4961553 Introduce ExpiringToken, a base for future authentication 10 years ago
Marcin Kulik e06e72676e Drop "dummy" from users, replace it with temporary_username 10 years ago
Marcin Kulik a27c27861f Fix playback spec - use "expect" syntax 10 years ago
Marcin Kulik 22922a4135 Exclude specs that need terminal binary compiled when it's missing 10 years ago
Marcin Kulik 59f73aad88 Print 5 slowest examples 10 years ago
Marcin Kulik 96e30031b2 Actually use spec_helper, lol 10 years ago
Marcin Kulik 411540d690 Exclude unstable specs on travis 10 years ago
Marcin Kulik 956975db38 Fix User.for_email to never return dummy users without email 10 years ago
Marcin Kulik 0beacb326e Support gzip compressed data files (to be used by new version of cli) 10 years ago
Marcin Kulik 130948ae3f Upgrate to Rails 4.1.5 10 years ago
Marcin Kulik 560e11f24e Introduce admin 10 years ago
Marcin Kulik 1633c94b91 Ensure correct theme is used for displaying embedded asciicast 10 years ago
Marcin Kulik 36362a14b5 Fix JS playback test 10 years ago
Marcin Kulik 6bb5f39f8b Add theme changing for whole user profile and single asciicast 10 years ago
Marcin Kulik 14648f11b7 Add ability to override theme via url param 10 years ago
Marcin Kulik b6a23222d7 Integrate new React.js-based player 10 years ago
Marcin Kulik c7e9974f47 Update a separate instance of current user 10 years ago
Marcin Kulik ace357187c Well, 2 letter usernames are fine too 10 years ago
Marcin Kulik a6bb7bf5ba Allow capital letters in usernames 10 years ago
Marcin Kulik 698767ad82 Validate username format 10 years ago
Marcin Kulik c0d4f28b2f Check if updated_at of asciicasts and api tokens is touched when merging users 10 years ago
Marcin Kulik 411a14b570 Don't take a screenshot when running tests 11 years ago
Marcin Kulik 0cb57c0cdd Get rid of annoying "pending test" message 11 years ago
Marcin Kulik 82c6c034c5 Improve test coverage of UsersController 11 years ago
Marcin Kulik 4cd145cac7 Add feature test for profile updating 11 years ago
Marcin Kulik 56b99f11e3 Clean up test auth helpers 11 years ago
Marcin Kulik 72248d7b83 Add a (pending) test for X-Frame-Options removal 11 years ago
Marcin Kulik 06c19adaab Move emedded player related endpoints to API 11 years ago
Marcin Kulik 933c5d9801 Namespace the existing API as v0 11 years ago
Marcin Kulik fe5907e96f Don't use AR API outside of AR classes 11 years ago
Marcin Kulik f55ec05ae1 Use Warden for authentication 11 years ago
Marcin Kulik 28e0926fd6 Split User.for_api_token into separate lookup and create methods 11 years ago
Marcin Kulik 94817be1b3 Rename nickname to username 11 years ago
Marcin Kulik 81c8340bc1 Drop unused columns from asciicasts table 11 years ago
Marcin Kulik 24bad5e628 Use strong_parameters instead of protected_attributes 11 years ago
Marcin Kulik 9b32e2dc37 Prevent shadowing real user profiles by dummy ones 11 years ago
Marcin Kulik 5db7506823 Make "default legacy" asciicast user a dummy one 11 years ago
Marcin Kulik 1be5538e5c Merge dummy users into real ones when assigning api tokens 11 years ago
Marcin Kulik 2ceea32cc4 Create dummy users for new api tokens 11 years ago
Marcin Kulik 74d7bb0156 Make AsciicastCreator unaware of API subtleties 11 years ago
Marcin Kulik 0a47fd441f Remove unused recorded_at column 11 years ago
Marcin Kulik 9530c9d870 Ignore "recorded_at" from client 11 years ago
Marcin Kulik 633f514de8 Use Virtus for AsciicastParams 11 years ago
Marcin Kulik 13544d9d04 Rename user_token to api_token 11 years ago
Marcin Kulik 9c224ce894 Remove unused mailer 11 years ago
Marcin Kulik 0be6410acb Enable coveralls.io integration 11 years ago
Marcin Kulik 4908599204 Fix style violations 11 years ago
Marcin Kulik 105d11bfe7 Change naming convention for presenter objects 11 years ago
Marcin Kulik 463f18c207 Refactor user page to use a presenter object 11 years ago
Marcin Kulik 5dc857ed9e Rename AsciicastPresenter#user to #current_user 11 years ago
Marcin Kulik d06801487c Set defaults for AsciicastListPresenter in .build 11 years ago
Marcin Kulik 585167089d Rename container_width option to max_width 11 years ago
Marcin Kulik 57bcab04c9 Use proper PlaybackOptions object for passing options to JS player 11 years ago
Marcin Kulik 2191dfe32a Use .decorate instead of manually creating decorator instances 11 years ago
Marcin Kulik 86f6af3d78 Introduce AsciicastPresenter 11 years ago
Marcin Kulik d571be2bbd Introduce AsciicastListPresenter 11 years ago
Marcin Kulik f6ad790a09 Introduce HomePresenter 11 years ago
Marcin Kulik fe30c0282f It's "OS X", not "OSX".
(via @solnic)
11 years ago
Marcin Kulik c9437524fb Move test routes definition from routes.rb to a test file 11 years ago
Marcin Kulik ec2004713e Set test specific carrierwave storage dir prefix in spec_helper 11 years ago
Marcin Kulik bf8b49b108 Move test specific carrierwave configuration to spec_helper 11 years ago
Marcin Kulik 8afb6f157f Use factory_girl helpers instead of FactoryGirl.build/create 11 years ago
Marcin Kulik 613621023c Use new rspec syntax in all specs
diff --git a/spec/controllers/application_controller_spec.rb b/spec/controllers/application_controller_spec.rb
index a115b7d..09d150b 100644
--- a/spec/controllers/application_controller_spec.rb
+++ b/spec/controllers/application_controller_spec.rb
@@ -46,12 +46,12 @@ def retrieve
   describe "action raise unauthorized" do

     context "when xhr" do
-      before { request.stub(:xhr?).and_return(true) }
+      before { allow(request).to receive(:xhr?).and_return(true) }

       it "response with 401" do
         get :foo

-        response.status.should == 401
+        expect(response.status).to eq(401)
       end

     end
@@ -59,11 +59,11 @@ def retrieve
     context "when typical request" do

       it "redirects to login_path" do
-        @controller.should_receive(:store_location)
+        expect(@controller).to receive(:store_location)

         get :foo

-        flash[:notice].should == "Please sign in to proceed"
+        expect(flash[:notice]).to eq("Please sign in to proceed")
         should redirect_to(login_path)
       end

@@ -72,12 +72,12 @@ def retrieve

   context "when action raise forbidden" do
     context "when xhr" do
-      before { request.stub(:xhr?).and_return(true) }
+      before { allow(request).to receive(:xhr?).and_return(true) }

       it "response with 401" do
         get :bar

-        response.status.should == 403
+        expect(response.status).to eq(403)
       end
     end

@@ -86,7 +86,7 @@ def retrieve
       it "redirects to root_path" do
         get :bar

-        flash[:alert].should == "This action is forbidden"
+        expect(flash[:alert]).to eq("This action is forbidden")
         should redirect_to(root_path)
       end

@@ -97,8 +97,8 @@ def retrieve
     it 'stores current request path to be later retrieved' do
       get :store
       get :retrieve
-      assigns[:location].should == '/fake/store'
-      assigns[:location_again].should == 'NOWAI!'
+      expect(assigns[:location]).to eq('/fake/store')
+      expect(assigns[:location_again]).to eq('NOWAI!')
     end
   end

@@ -106,7 +106,7 @@ def retrieve
     context 'when there is no stored location' do
       it 'redirects to given location' do
         path = double
-        @controller.should_receive(:redirect_to).with(path)
+        expect(@controller).to receive(:redirect_to).with(path)
         @controller.send(:redirect_back_or_to, path)
       end
     end
@@ -115,8 +115,8 @@ def retrieve
       it 'redirects to stored location' do
         stored_path = double
         path = double
-        @controller.stub(:get_stored_location => stored_path)
-        @controller.should_receive(:redirect_to).with(stored_path)
+        allow(@controller).to receive(:get_stored_location).and_return(stored_path)
+        expect(@controller).to receive(:redirect_to).with(stored_path)
         @controller.send(:redirect_back_or_to, path)
       end
     end
diff --git a/spec/controllers/asciicasts_controller_spec.rb b/spec/controllers/asciicasts_controller_spec.rb
index 5741ec2..c37e69b 100644
--- a/spec/controllers/asciicasts_controller_spec.rb
+++ b/spec/controllers/asciicasts_controller_spec.rb
@@ -2,12 +2,12 @@

 shared_examples_for 'guest user trying to modify' do
   it { should redirect_to(login_path) }
-  specify { flash[:notice].should =~ /sign in to proceed/ }
+  specify { expect(flash[:notice]).to match(/sign in to proceed/) }
 end

 shared_examples_for 'non-owner user trying to modify' do
   it { should redirect_to(asciicast_path(asciicast)) }
-  specify { flash[:alert].should =~ /can't/ }
+  specify { expect(flash[:alert]).to match(/can't/) }
 end

 describe AsciicastsController do
@@ -45,7 +45,7 @@

     before do
       allow(controller).to receive(:view_counter) { view_counter }
-      Asciicast.should_receive(:find).and_return(asciicast)
+      expect(Asciicast).to receive(:find).and_return(asciicast)
       asciicast.title = 'some tit'
     end

@@ -66,7 +66,7 @@
           with(asciicast, cookies)
       end

-      specify { assigns(:asciicast).should == asciicast_decorator }
+      specify { expect(assigns(:asciicast)).to eq(asciicast_decorator) }
     end

     context 'for json request' do
@@ -98,7 +98,7 @@
     let(:make_request) { get :edit, :id => asciicast.id }

     before do
-      Asciicast.should_receive(:find).and_return(asciicast)
+      expect(Asciicast).to receive(:find).and_return(asciicast)
       asciicast.user = user
     end

@@ -133,7 +133,7 @@
     let(:make_request) { put :update, :id => asciicast.id, :asciicast => { } }

     before do
-      Asciicast.should_receive(:find).and_return(asciicast)
+      expect(Asciicast).to receive(:find).and_return(asciicast)
       asciicast.user = user
     end

@@ -144,17 +144,17 @@

       context 'when update succeeds' do
         before do
-          asciicast.should_receive(:update_attributes).and_return(true)
+          expect(asciicast).to receive(:update_attributes).and_return(true)
           make_request
         end

         it { should redirect_to(asciicast_path(asciicast)) }
-        specify { flash[:notice].should =~ /was updated/ }
+        specify { expect(flash[:notice]).to match(/was updated/) }
       end

       context 'when update fails' do
         before do
-          asciicast.should_receive(:update_attributes).and_return(false)
+          expect(asciicast).to receive(:update_attributes).and_return(false)
           make_request
         end

@@ -184,7 +184,7 @@
     let(:make_request) { delete :destroy, :id => asciicast.id }

     before do
-      Asciicast.should_receive(:find).and_return(asciicast)
+      expect(Asciicast).to receive(:find).and_return(asciicast)
       asciicast.user = user
     end

@@ -195,22 +195,22 @@

       context 'when destroy succeeds' do
         before do
-          asciicast.should_receive(:destroy).and_return(true)
+          expect(asciicast).to receive(:destroy).and_return(true)
           make_request
         end

         it { should redirect_to(profile_path(user)) }
-        specify { flash[:notice].should =~ /was deleted/ }
+        specify { expect(flash[:notice]).to match(/was deleted/) }
       end

       context 'when destroy fails' do
         before do
-          asciicast.should_receive(:destroy).and_return(false)
+          expect(asciicast).to receive(:destroy).and_return(false)
           make_request
         end

         it { should redirect_to(asciicast_path(asciicast)) }
-        specify { flash[:alert].should =~ /again/ }
+        specify { expect(flash[:alert]).to match(/again/) }
       end
     end

diff --git a/spec/controllers/home_controller_spec.rb b/spec/controllers/home_controller_spec.rb
index 6dcd6e7..e82d5ea 100644
--- a/spec/controllers/home_controller_spec.rb
+++ b/spec/controllers/home_controller_spec.rb
@@ -10,7 +10,7 @@

       it "returns http success" do
         get 'show'
-        response.should be_success
+        expect(response).to be_success
       end
     end

@@ -21,14 +21,14 @@

       it "returns http success" do
         get 'show'
-        response.should be_success
+        expect(response).to be_success
       end
     end

     describe 'when there are no casts at all' do
       it "returns http success" do
         get 'show'
-        response.should be_success
+        expect(response).to be_success
       end
     end
   end
diff --git a/spec/controllers/user_tokens_controller_spec.rb b/spec/controllers/user_tokens_controller_spec.rb
index 2a43c4a..6774f87 100644
--- a/spec/controllers/user_tokens_controller_spec.rb
+++ b/spec/controllers/user_tokens_controller_spec.rb
@@ -24,14 +24,14 @@
       let(:user) { nil }

       it { should redirect_to(login_path) }
-      specify { flash[:notice].should =~ /sign in to proceed/ }
+      specify { expect(flash[:notice]).to match(/sign in to proceed/) }
     end

     context "when # of claimed asciicasts is nil" do
       let(:claimed_num) { nil }

       it 'displays error page' do
-        response.should render_template(:error)
+        expect(response).to render_template(:error)
       end
     end

@@ -39,14 +39,14 @@
       let(:claimed_num) { 0 }

       it { should redirect_to(profile_path(user)) }
-      specify { flash[:notice].should =~ /Authenticated/ }
+      specify { expect(flash[:notice]).to match(/Authenticated/) }
     end

     context "when # of claimed asciicast is > 0" do
       let(:claimed_num) { 1 }

       it { should redirect_to(profile_path(user)) }
-      specify { flash[:notice].should =~ /Claimed #{claimed_num}/ }
+      specify { expect(flash[:notice]).to match(/Claimed #{claimed_num}/) }
     end
   end

diff --git a/spec/decorators/asciicast_decorator_spec.rb b/spec/decorators/asciicast_decorator_spec.rb
index 19e6af1..05264d7 100644
--- a/spec/decorators/asciicast_decorator_spec.rb
+++ b/spec/decorators/asciicast_decorator_spec.rb
@@ -230,7 +230,7 @@
     }

     before do
-      asciicast.stub(:id => 123)
+      allow(asciicast).to receive(:id).and_return(123)
     end

     it 'should be an async script tag including asciicast id' do
diff --git a/spec/features/playback_spec.rb b/spec/features/playback_spec.rb
index ce4f912..0bbfd6c 100644
--- a/spec/features/playback_spec.rb
+++ b/spec/features/playback_spec.rb
@@ -26,7 +26,7 @@ def inject_on_finished_callback
       visit asciicast_path(asciicast, speed: 5)
       find(".play-button").find(".arrow").click
       inject_on_finished_callback
-      page.should have_selector('body .finished')
+      expect(page).to have_selector('body .finished')
     end
   end

diff --git a/spec/models/comment_spec.rb b/spec/models/comment_spec.rb
index e6e128f..11f56e0 100644
--- a/spec/models/comment_spec.rb
+++ b/spec/models/comment_spec.rb
@@ -3,7 +3,7 @@
 describe Comment do

   it "factory should be valid" do
-    FactoryGirl.build(:comment).should be_valid
+    expect(FactoryGirl.build(:comment)).to be_valid
   end

 end
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index a6c845e..88ee9a8 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -96,8 +96,8 @@

       it 'returns created UserToken' do
         ut = user.add_user_token(token)
-        ut.should be_kind_of(UserToken)
-        ut.id.should_not be(nil)
+        expect(ut).to be_kind_of(UserToken)
+        expect(ut.id).not_to be(nil)
       end
     end

@@ -107,7 +107,7 @@

       it 'returns existing UserToken' do
         ut = user.add_user_token(token)
-        ut.should == existing_token
+        expect(ut).to eq(existing_token)
       end
     end
   end
diff --git a/spec/models/user_token_spec.rb b/spec/models/user_token_spec.rb
index f1e76e6..a106311 100644
--- a/spec/models/user_token_spec.rb
+++ b/spec/models/user_token_spec.rb
@@ -2,6 +2,6 @@

 describe UserToken do
   it "has valid factory" do
-    FactoryGirl.build(:user_token).should be_valid
+    expect(FactoryGirl.build(:user_token)).to be_valid
   end
 end
diff --git a/spec/routing/connect_spec.rb b/spec/routing/connect_spec.rb
index 351f928..91f713f 100644
--- a/spec/routing/connect_spec.rb
+++ b/spec/routing/connect_spec.rb
@@ -2,7 +2,7 @@

 describe 'connect routing' do
   it 'routes /connect/:user_token to user_tokens#create for user_token' do
-    { :get => '/connect/jolka-misio' }.should route_to(
+    expect({ :get => '/connect/jolka-misio' }).to route_to(
       :controller => 'user_tokens',
       :action     => 'create',
       :user_token => 'jolka-misio'
diff --git a/spec/support/controller_macros.rb b/spec/support/controller_macros.rb
index 6b26434..fa31720 100644
--- a/spec/support/controller_macros.rb
+++ b/spec/support/controller_macros.rb
@@ -1,7 +1,7 @@
 module Asciinema
   module ControllerMacros
     def login_as(user)
-      controller.stub(:current_user => user)
+      allow(controller).to receive(:current_user).and_return(user)
     end
   end
 end
11 years ago
Marcin Kulik d8de171f66 Add "Contributing" page 11 years ago
Marcin Kulik e2e117ce84 Refactor profile link helpers and decorators 11 years ago
Marcin Kulik b6126167a3 Prefer gravatar over old omniauth provided avatar 11 years ago
Marcin Kulik 66a2eae3b4 Use FG shortcut helpers in home controller spec 11 years ago
Marcin Kulik c785e1a1ff Fix asciicasts_controller spec 11 years ago
Marcin Kulik 2dbc811caf Fix the condition for displaying edit/delete links 11 years ago
Marcin Kulik 4b9c33f228 Add fake host pages with an embedded asciicast 11 years ago
Marcin Kulik 38cde2d172 Avoid AR chains outside of AR models 11 years ago
Marcin Kulik dd9488d56f Add fullname_and_nickname to UserDecorator 11 years ago
Marcin Kulik 3a2692f70f Add test for UserDecorator#avatar_url 11 years ago
Marcin Kulik af02d5e0b2 Dasherize how-it-works and getting-started doc paths 11 years ago
Marcin Kulik 100273f5bf Update browse page to new layout and add sorting 11 years ago
Marcin Kulik 08d17f28e3 Redesign asciicast page 11 years ago
Marcin Kulik f9717f1aa5 Update profile page to new layout 11 years ago
Marcin Kulik 3362da04dc Update information on "About" page 11 years ago
Marcin Kulik 76ddc94561 Update docs pages for new layout 11 years ago
Marcin Kulik c0473dc217 Redesign homepage (and layout in general) 11 years ago
Marcin Kulik 6009250a36 Display "asciicast:<id>" as a title for title-less asciicasts 11 years ago
Marcin Kulik 88e2e54477 Add privacy policy 11 years ago
Marcin Kulik 888f3b7c80 Don't take current user's email from current profile page's user 11 years ago
Marcin Kulik 431fd87002 Use auth token for permanent sessions 11 years ago
Marcin Kulik 3e1feff84e Auto-strip whitespace from email and nickname 11 years ago
Marcin Kulik 5bd8b05a93 Validate presence and uniqueness of both nickname and email 11 years ago
Marcin Kulik a194d361d0 Redirect to "getting started" page after sign up 11 years ago
Marcin Kulik 352fb6ede6 Improve wording 11 years ago