This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Feature: Sign up | |
In order to use the provided service | |
As a Guest | |
I want to sign up for an user account |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Feature: Verify email address | |
In order to ensure communication to the User | |
As a Service Provider | |
I want the User to verify his email address | |
Scenario: Verify email address after sign up | |
Given I sign up as an user with: | |
| email | johndoe@example.com | | |
Then "johndoe@example.com" should receive 1 email | |
When I open the email |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def self.find_by_string (query) | |
users = User.any_of({ :username => /^#{Regexp.escape(query)}/ }, { :name => /#{Regexp.escape(query)}/ }).first | |
end | |
# returns #<User _id: 4cf4d4594dd96225fe00002d, deleted_at: nil, created_at: 2010-11-30 10:39:21 UTC, updated_at: 2010-11-30 10:39:21 UTC, name: "John Doe", username: "johndoe_44" [..] > | |
def self.find_by_string (query) | |
users = User.any_of({ :username => /^#{Regexp.escape(query)}/ }, { :name => /#{Regexp.escape(query)}/ }).all | |
end | |
# returns #<Mongoid::Criteria:0x3e1c2d0 @selector={:deleted_at=>{"$exists"=>false}, "$or"=>[{:username=>/^johndoe_44/}, {:name=>/johndoe_44/}]}, @options={}, @klass=User, @documents=[]> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# within spec_helpers.rb | |
RSpec.configure do |config| | |
config.filter_run :focus => true | |
end | |
# within specs | |
describe "GET 'some_action'", :focus => true do | |
it "should be successful" do | |
get :some_action |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# this doesn't work, because username_or_id is a string either way | |
def self.find_by_username_or_id(username_or_id) | |
User.any_of({:username => username_or_id}, {:_id => username_or_id}).first | |
# raises "illegal ObjectID format" exception | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Background: | |
Given I am signed in as a user | |
And I am on the dashboard site | |
Scenario: Change e-mail address | |
When I follow "Edit user account" | |
And I fill in "E-mail" with "new_email@example.com" | |
And I press "Update user account" | |
Then I should see a confirmation message | |
And my "E-mail" should be "new_email@example.com" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# cucumber supports selenium by default, just mark features with @selenium tag | |
@selenium | |
Feature: This feature will be executed with selenium | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# create the following step to confirm the next alert | |
When /^(?:|I )follow "([^"]*)" and I confirm the next alert$/ do |link| | |
page.evaluate_script('window.confirm = function() { return true; }') | |
When "I follow \"#{link}\"" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# spec/support/controller_spec_helper.rb | |
module ControllerSpecHelper | |
def sign_in_user(user) | |
controller.stub!(:current_user).and_return user | |
end | |
end | |
# spec/spec_helper.rb | |
RSpec.configure do |config| | |
# [..] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
steal.plugins("app/home"); |
OlderNewer