Sha256: 3856db84f0bbb9d7d917b46350c3f6fc6f54ced2b9bc209f71a3213ee1b0bc92

Contents?: true

Size: 1.23 KB

Versions: 13

Compression:

Stored size: 1.23 KB

Contents

require File.dirname(__FILE__) + '/../spec_helper'

describe ReaderActivationsController do
  dataset :readers
  
  before do
    controller.stub!(:request).and_return(request)
    Page.current_site = sites(:test) if defined? Site
    request.env["HTTP_REFERER"] = 'http://test.host/referer!'
  end

  describe "with a correct activation" do
    before do
      @newreader = readers(:inactive)
      put :update, :id => @newreader.id, :activation_code => @newreader.perishable_token
      @reader = Reader.find_by_name('Inactive')
    end

    it "should activate the reader" do
      @reader.activated?.should be_true
      @reader.activated_at.should be_close((Time.now).utc, 1.minute)
    end

    it "should redirect to the dashboard" do
      response.should be_redirect
      response.should redirect_to(reader_dashboard_url)
    end
  end

  describe "with an incorrect activation" do
    before do
      @newreader = readers(:inactive)
      put :update, :id => @newreader.id, :activation_code => 'down perishcope'
    end
    
    it "should render the show page" do
      response.should be_success
      response.should render_template("show")
    end

    it "should not flash an error" do
      flash[:error].should be_nil
    end
  end

end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
radiant-reader-extension-3.0.27 spec/controllers/reader_activations_controller_spec.rb
radiant-reader-extension-3.0.26 spec/controllers/reader_activations_controller_spec.rb
radiant-reader-extension-3.0.25 spec/controllers/reader_activations_controller_spec.rb
radiant-reader-extension-3.0.24 spec/controllers/reader_activations_controller_spec.rb
radiant-reader-extension-3.0.23 spec/controllers/reader_activations_controller_spec.rb
radiant-reader-extension-3.0.20 spec/controllers/reader_activations_controller_spec.rb
radiant-reader-extension-3.0.19 spec/controllers/reader_activations_controller_spec.rb
radiant-reader-extension-3.0.18 spec/controllers/reader_activations_controller_spec.rb
radiant-reader-extension-3.0.17 spec/controllers/reader_activations_controller_spec.rb
radiant-reader-extension-3.0.16 spec/controllers/reader_activations_controller_spec.rb
radiant-reader-extension-3.0.15 spec/controllers/reader_activations_controller_spec.rb
radiant-reader-extension-3.0.14 spec/controllers/reader_activations_controller_spec.rb
radiant-reader-extension-3.0.13 spec/controllers/reader_activations_controller_spec.rb