Sha256: e601c7d52bf940bf470b0242303f4948558d5aed807c6deaa4f64432b9ef81d3

Contents?: true

Size: 1.79 KB

Versions: 11

Compression:

Stored size: 1.79 KB

Contents

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

describe "visiting /" do
  describe "when unauthenticated" do
    it "should display the about page" do
      get '/'
      last_response.should have_selector("h2:contains('Do you use twitter?')")
    end
  end
  describe "when unauthorized" do
    it "should raise an error" do
      lambda { unauthorized_quentin }.should raise_error
    end
  end
  describe "when authenticated" do
    it "should display a greeting" do
      login_quentin
      get '/'
      last_response.should have_selector("h2:contains('Hello There, you little twitterer!')")
    end
  end
end

describe "visiting /peace" do
  describe "when authenticated" do
    it "should clear the session and redirect to the home page" do
      login_quentin
      get '/peace'
      last_response.headers['Location'].should eql('/')

      get last_response.headers['Location']
      last_response.should have_selector("h2:contains('Do you use twitter?')")
    end
  end
end

describe "triggering a 404" do
  it "should display the failed page" do
    pending
    get '/lost'
    last_response.should have_selector("p:contains('Something went wonky.')")
  end
end

describe "visiting /authenticate" do
  it "should redirect to twitter for authentication" do
    get '/authenticate'
    last_response.headers['Location'].should eql('http://twitter.com/oauth/authorize?oauth_token=requestkey')
  end
end

describe "<%= name.camelize %>::User" do
  it "can create users from twitter ids that exist" do
    lambda { <%= name.camelize %>::User.create_twitter_user('atmos') }.should_not raise_error
  end
  it "can't create users from twitter ids that do not exist" do
    lambda { <%= name.camelize %>::User.create_twitter_user(/\w{18}/.gen) }.should raise_error(<%= name.camelize %>::User::UserCreationError)
  end
end

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
atmos-singem-0.0.5 lib/generators/twitter/templates/spec/templates_spec.rb.erb
singem-0.2.0 lib/generators/twitter/templates/spec/templates_spec.rb.erb
singem-0.1.2 lib/generators/twitter/templates/spec/templates_spec.rb.erb
singem-0.1.1 lib/generators/twitter/templates/spec/templates_spec.rb.erb
singem-0.1.0 lib/generators/twitter/templates/spec/templates_spec.rb.erb
singem-0.0.7 lib/generators/twitter/templates/spec/templates_spec.rb.erb
singem-0.0.6 lib/generators/twitter/templates/spec/templates_spec.rb.erb
singem-0.0.5 lib/generators/twitter/templates/spec/templates_spec.rb.erb
singem-0.0.3 lib/generators/twitter/templates/spec/templates_spec.rb.erb
singem-0.0.4 lib/generators/twitter/templates/spec/templates_spec.rb.erb
singem-0.0.2 lib/generators/twitter/templates/spec/templates_spec.rb.erb