mirror of
https://github.com/fspc/BikeShed-1.git
synced 2026-09-16 08:31:36 -04:00
git init
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
step "show me the page" do
|
||||
save_and_open_page
|
||||
end
|
||||
|
||||
step "I click the link :link_text" do |link_text|
|
||||
page.click_link link_text
|
||||
end
|
||||
|
||||
step "I click the button :button_text" do |button_text|
|
||||
page.click_button button_text
|
||||
end
|
||||
|
||||
step "I fill out the form with :model :field_name :field_value" do |model, field_name, field_value|
|
||||
page.fill_in "#{model}_#{field_name}", :with => field_value
|
||||
end
|
||||
@@ -0,0 +1,40 @@
|
||||
FactoryGirl.factories.each do |factory|
|
||||
factory.compile
|
||||
factory.human_names.each do |human_name|
|
||||
step "the following #{human_name} exists:" do |table|
|
||||
table.hashes.each do |human_hash|
|
||||
attributes = convert_human_hash_to_attribute_hash(human_hash, factory.associations)
|
||||
FactoryGirl.create(factory.name, attributes)
|
||||
end
|
||||
end
|
||||
|
||||
step "the following #{human_name.pluralize} exist:" do |table|
|
||||
table.hashes.each do |human_hash|
|
||||
attributes = convert_human_hash_to_attribute_hash(human_hash, factory.associations)
|
||||
FactoryGirl.create(factory.name, attributes)
|
||||
end
|
||||
end
|
||||
|
||||
step "a(n) #{human_name} exists" do
|
||||
FactoryGirl.create(factory.name)
|
||||
end
|
||||
|
||||
step ":count #{human_name.pluralize} exist" do |count|
|
||||
FactoryGirl.create_list(factory.name, count.to_i)
|
||||
end
|
||||
|
||||
if factory.build_class.respond_to?(:columns)
|
||||
factory.build_class.columns.each do |column|
|
||||
name = column.respond_to?(:name) ? column.name : column.to_s
|
||||
human_column_name = name.downcase.gsub('_', ' ')
|
||||
step "a(n) #{human_name} exists with a(n) #{human_column_name} of :value" do |value|
|
||||
FactoryGirl.create(factory.name, name => value)
|
||||
end
|
||||
|
||||
step ":count #{human_name.pluralize} exist with a(n) #{human_column_name} of :value" do |count, value|
|
||||
FactoryGirl.create_list(factory.name, count.to_i, name => value)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,7 @@
|
||||
step "I login with email :email and password :password" do |email, password|
|
||||
visit new_user_session_path
|
||||
fill_in 'Email', :with => email
|
||||
fill_in 'Password', :with => password
|
||||
click_button 'Sign in'
|
||||
page.should have_content("Signed in successfully.")
|
||||
end
|
||||
@@ -0,0 +1,3 @@
|
||||
step "I go to the next page" do
|
||||
page.find('.pagination li.next a').click
|
||||
end
|
||||
@@ -0,0 +1,72 @@
|
||||
step "I go to create a new team" do
|
||||
visit new_team_path
|
||||
end
|
||||
|
||||
step 'I go to the team list' do
|
||||
visit teams_path
|
||||
end
|
||||
|
||||
step "I should see the create a team form" do
|
||||
page.should have_field 'Name'
|
||||
page.should have_field 'Max members', :with => '16'
|
||||
end
|
||||
|
||||
step "I submit the new team form" do
|
||||
page.find('form#new_team').find('input[type=submit]').click
|
||||
end
|
||||
|
||||
step "I fill out the team form with team name :team_name" do |team_name|
|
||||
page.fill_in 'Name', :with => team_name
|
||||
end
|
||||
|
||||
step "I check the box to make my team private" do
|
||||
page.check "Private team?"
|
||||
end
|
||||
|
||||
step 'I should see an error message about the team name' do
|
||||
within 'form#new_team' do
|
||||
page.should have_content "can't be blank"
|
||||
end
|
||||
end
|
||||
|
||||
step 'I should see :team_name in the team list' do |team_name|
|
||||
within '.teams' do
|
||||
page.should have_content(team_name)
|
||||
end
|
||||
end
|
||||
|
||||
step 'I should see :count teams in the team list' do |count|
|
||||
within '.teams' do
|
||||
page.all('h3.team').count.should == count.to_i
|
||||
end
|
||||
end
|
||||
|
||||
step 'the team list should be:' do |table|
|
||||
within '.teams' do
|
||||
actual = page.all('h3.team').collect { |h3| [h3.text] }
|
||||
table.raw.should == actual
|
||||
end
|
||||
end
|
||||
|
||||
step 'I should have the option of joining the team' do
|
||||
page.should have_button 'Join team'
|
||||
end
|
||||
|
||||
step 'I should not have the option of joining the team' do
|
||||
page.should have_no_button 'Join team'
|
||||
end
|
||||
|
||||
step ':user_email should be in the team member list' do |user_email|
|
||||
user = User.find_by_email(user_email)
|
||||
assert user, "Could not find user by email: #{user_email}"
|
||||
within '.members' do
|
||||
page.should have_content user.to_s
|
||||
end
|
||||
end
|
||||
|
||||
step ':user_email captains the team :team_name' do |user_email, team_name|
|
||||
user = User.find_by_email(user_email)
|
||||
assert user, "Could not find user by email: #{user_email}"
|
||||
FactoryGirl.create(:team, :name => team_name, :captain => user)
|
||||
end
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
step "a user :email with password :password" do |email, password|
|
||||
FactoryGirl.create(:user, :email => email, :password => password)
|
||||
end
|
||||
Reference in New Issue
Block a user