Commit Graph

1070 Commits

Author SHA1 Message Date
Marcin Kulik
d06801487c Set defaults for AsciicastListPresenter in .build 2014-02-01 01:10:54 +01:00
Marcin Kulik
9589df952f Make the view count cookie names shorter 2014-01-29 16:10:18 +01:00
Marcin Kulik
97aa36e853 Use secure cookies when scheme is "https" 2014-01-29 16:00:50 +01:00
Marcin Kulik
a9e57ce5e4 Load unicorn worker killer only in production 2014-01-29 16:00:24 +01:00
Marcin Kulik
4f57d07c5a Enabled unicorn worker killer 2014-01-27 18:05:18 +01:00
Marcin Kulik
84c506f5f1 Use ruby 2.1 in development 2014-01-27 18:04:49 +01:00
Marcin Kulik
0f757d04ae Use dalli memcache client in production 2014-01-25 12:16:07 +01:00
Marcin Kulik
dcb7c68f72 Remove obsolete smtp config 2014-01-25 11:59:35 +01:00
Marcin Kulik
fee207e012 Add Gentoo installation instructions to docs 2014-01-21 10:49:48 +01:00
Marcin Kulik
219d8f1c3f Fix embedded player iframe resizing under https 2014-01-18 15:35:24 +01:00
Marcin Kulik
9e5a7c8d22 Add "autoplay" option to embedded player 2014-01-18 15:17:12 +01:00
Marcin Kulik
edca76233d It's rather "bare" than "raw" 2014-01-18 14:57:35 +01:00
Marcin Kulik
585167089d Rename container_width option to max_width 2014-01-18 14:53:15 +01:00
Marcin Kulik
2d93333cb5 Allow passing container width on example embed page 2014-01-18 14:35:05 +01:00
Marcin Kulik
0e85e9ac28 Pass the asciicast with the options object to player partial 2014-01-18 14:28:01 +01:00
Marcin Kulik
a9913a966d Rename "font_size" playback option to "size" 2014-01-18 14:19:23 +01:00
Marcin Kulik
57bcab04c9 Use proper PlaybackOptions object for passing options to JS player 2014-01-18 14:12:10 +01:00
Marcin Kulik
2191dfe32a Use .decorate instead of manually creating decorator instances 2014-01-18 12:24:40 +01:00
Marcin Kulik
86f6af3d78 Introduce AsciicastPresenter 2014-01-18 11:44:13 +01:00
Marcin Kulik
d571be2bbd Introduce AsciicastListPresenter 2014-01-17 17:21:22 +01:00
Marcin Kulik
f6ad790a09 Introduce HomePresenter 2014-01-17 14:52:37 +01:00
Marcin Kulik
23fab4dd06 Add newrelic gem 2014-01-17 12:15:44 +01:00
Marcin Kulik
ef8519b035 No need for making embedded player's container 100% width 2013-12-14 14:58:57 +01:00
Marcin Kulik
070b99ed51 Display "Powered by" below the embedded player 2013-12-14 14:54:01 +01:00
Marcin Kulik
57e976ff64 Use jpg background instead of a png on the homepage 2013-12-10 12:22:16 +01:00
Marcin Kulik
fe30c0282f It's "OS X", not "OSX".
(via @solnic)
2013-12-10 12:00:17 +01:00
Marcin Kulik
6ad82d0960 Replace zeus with spring 2013-12-10 00:31:21 +01:00
Marcin Kulik
f7d2b97a6c Use the "method" API of CFG object everywhere 2013-12-09 23:55:12 +01:00
Marcin Kulik
c9437524fb Move test routes definition from routes.rb to a test file 2013-12-09 23:16:41 +01:00
Marcin Kulik
ec2004713e Set test specific carrierwave storage dir prefix in spec_helper 2013-12-09 20:26:08 +01:00
Marcin Kulik
4e3c9a5d28 Add config setting for using local persona js file 2013-12-09 20:09:17 +01:00
Marcin Kulik
bf8b49b108 Move test specific carrierwave configuration to spec_helper 2013-12-09 19:16:09 +01:00
Marcin Kulik
7ab3d68071 Remove mounted JasmineRails engine 2013-12-09 19:05:47 +01:00
Marcin Kulik
205396c1d3 Use flat config files 2013-12-09 19:03:22 +01:00
Marcin Kulik
11bfe3b0f9 Remove unused path helper 2013-12-09 18:57:10 +01:00
Marcin Kulik
626009db6b Words 2013-12-09 17:42:11 +01:00
Marcin Kulik
f9e8909258 Upgrade to rspec 3.0.0.beta1 2013-12-09 17:38:35 +01:00
Marcin Kulik
cfef5364e8 Enable strict locale checking 2013-12-09 17:33:05 +01:00
Marcin Kulik
cbaf9d0123 Upgrade capybara and poltergeist 2013-12-09 17:32:42 +01:00
Marcin Kulik
f5c1bac0b1 Upgrade rspec to 2.99 2013-12-09 17:30:24 +01:00
Marcin Kulik
8afb6f157f Use factory_girl helpers instead of FactoryGirl.build/create 2013-12-09 17:19:14 +01:00
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
2013-12-09 17:16:38 +01:00
Marcin Kulik
5887d2e4f6 Words 2013-12-07 16:32:00 +01:00
Marcin Kulik
f17a7ffdd0 Spell gittip as Gittip, always 2013-12-03 22:20:36 +01:00
Marcin Kulik
3a62c31d18 Make the thumbnails 100 columns long to fit into widest single column layout 2013-12-03 21:51:49 +01:00
Marcin Kulik
6ee6274751 Add "Follow on Twitter" to footer 2013-12-03 21:37:11 +01:00
Marcin Kulik
c4719ffd24 Put link to "Contributing" page in a footer 2013-12-03 21:22:21 +01:00
Marcin Kulik
18e5f19e16 Update installation docs 2013-12-03 21:00:04 +01:00
Marcin Kulik
26451ba6b0 Upgrade Rails to latest version 2013-12-03 20:35:08 +01:00
Marcin Kulik
d8de171f66 Add "Contributing" page 2013-12-03 20:11:47 +01:00