Commit 652df28e by Arjun Singh

Committing edx specs here til we get a place for them

parent 3602ec58
source 'https://rubygems.org'
gem 'rspec', '~> 2.7.0'
gem 'rspec-steps'
gem 'capybara'
gem 'launchy'
gem 'poltergeist'
gem 'capybara-webkit'
gem 'faker'
gem 'pry'
GEM
remote: https://rubygems.org/
specs:
addressable (2.3.2)
capybara (1.1.2)
mime-types (>= 1.16)
nokogiri (>= 1.3.3)
rack (>= 1.0.0)
rack-test (>= 0.5.4)
selenium-webdriver (~> 2.0)
xpath (~> 0.1.4)
capybara-webkit (0.12.1)
capybara (>= 1.0.0, < 1.2)
json
childprocess (0.3.5)
ffi (~> 1.0, >= 1.0.6)
coderay (1.0.7)
diff-lcs (1.1.3)
eventmachine (1.0.0)
faker (1.0.1)
i18n (~> 0.4)
faye-websocket (0.4.6)
eventmachine (>= 0.12.0)
ffi (1.1.5)
http_parser.rb (0.5.3)
i18n (0.6.0)
json (1.7.4)
launchy (2.1.1)
addressable (~> 2.3)
libwebsocket (0.1.5)
addressable
method_source (0.8)
mime-types (1.19)
multi_json (1.3.6)
nokogiri (1.5.5)
poltergeist (0.7.0)
capybara (~> 1.1)
childprocess (~> 0.3)
faye-websocket (~> 0.4, >= 0.4.4)
http_parser.rb (~> 0.5.3)
multi_json (~> 1.0)
pry (0.9.10)
coderay (~> 1.0.5)
method_source (~> 0.8)
slop (~> 3.3.1)
rack (1.4.1)
rack-test (0.6.1)
rack (>= 1.0)
rspec (2.7.0)
rspec-core (~> 2.7.0)
rspec-expectations (~> 2.7.0)
rspec-mocks (~> 2.7.0)
rspec-core (2.7.1)
rspec-expectations (2.7.0)
diff-lcs (~> 1.1.2)
rspec-mocks (2.7.0)
rspec-steps (0.0.8)
rspec (>= 2.6)
rubyzip (0.9.9)
selenium-webdriver (2.25.0)
childprocess (>= 0.2.5)
libwebsocket (~> 0.1.3)
multi_json (~> 1.0)
rubyzip
slop (3.3.2)
xpath (0.1.4)
nokogiri (~> 1.3)
PLATFORMS
ruby
DEPENDENCIES
capybara
capybara-webkit
faker
launchy
poltergeist
pry
rspec (~> 2.7.0)
rspec-steps
require './spec_helper'
describe "Discussion", :type => :request do
subject { page }
let(:thread_data){ {body: Faker::Lorem.paragraph(2), title: Faker::Lorem.sentence(5), topic: "General"} }
steps "Discussion Forum View" do
it "should let you log in" do
log_in
goto_course "BerkeleyX/CS188/fa12"
click_link "Discussion"
end
it "should have a list of threads" do
expect { page.has_selector ".discussion-body .sidebar" }
end
it "should have the new post form be hidden" do
page.find('.new-post-article').should_not be_visible
end
it "should show and hide the new post form" do
click_link 'New Post'
page.find('.new-post-article').should be_visible
click_link 'Cancel'
wait_until { !page.find('.new-post-article').visible? }
page.find('.new-post-article').should_not be_visible
end
it "should let you create a new post" do
click_link 'New Post'
new_post_container = page.find('.new-post-article')
old_first_thread_title = page.find('.post-list .list-item:first .title').text
new_post_container.should be_visible
fill_in_wmd_body(new_post_container, thread_data[:body])
new_post_container.find('.new-post-title').set(thread_data[:title])
click_button "Add post"
new_first_thread_list_item = page.find('.post-list .list-item:first')
new_first_thread_list_item.should have_content (thread_data[:title])
new_first_thread_list_item.should_not have_content old_first_thread_title
end
it "should show the thread's body when a thread is clicked" do
page.find('.post-list .list-item:first').click
page.find('.new-post-article').should_not be_visible
end
end
end
def log_in
visit "/"
click_link "Log In"
fill_in "email", with: "student@student.com"
fill_in "password", with: "student"
click_button "Access My Courses"
wait_until { page.find('.dashboard') }
end
def goto_course(course)
visit "/courses/#{course}/info"
end
def fill_in_wmd_body(container, body)
container.find("textarea.wmd-input").set(body)
end
require 'rubygems'
require 'bundler/setup'
require 'rspec'
require 'rspec-steps'
require 'capybara/rspec'
#require 'capybara/poltergeist'
require 'capybara-webkit'
require 'faker'
require './helpers'
require 'pry'
# Capybara configuration
#Capybara.default_driver = :poltergeist
Capybara.default_driver = :webkit
Capybara.javascript_driver = :webkit
Capybara.save_and_open_page_path = File.dirname(__FILE__) + '/../snapshots'
Capybara.app_host = 'http://localhost:8000'
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment