This file contains hidden or 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_club.feature | |
| Scenario: Admin adds a club with valid information | |
| Given I am signed in as an admin with the email "[email protected]" | |
| And the city "Barcelona" already exists | |
| And I go to the new club page | |
| When I fill in the following: | |
| | Nombre | Ribelinos | | |
| | Calle | Avda. Diagonal | | |
| | Número | 661 | |
This file contains hidden or 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
| module UserHelper | |
| attr_accessor :current_user | |
| class Credentials < Struct.new(:email, :password) | |
| def self.parse(arg) | |
| return arg if arg.is_a?(Credentials) | |
| new(arg) | |
| end | |
| def initialize(credentials) |
This file contains hidden or 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
| RSpec::Matchers.define(:be_same_file_as) do |exected_file_path| | |
| match do |actual_file_path| | |
| expect(md5_hash(actual_file_path)).to eq(md5_hash(expected_file_path)) | |
| end | |
| def md5_hash(file_path) | |
| Digest::MD5.hexdigest(File.read(file_path)) | |
| end | |
| end |
This file contains hidden or 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
| [bar, dog, foo, { c => [rat, cat, dog] }, a, b] | |
| - bar | |
| - dog | |
| - foo | |
| - c: | |
| - rat | |
| - cat | |
| - dog | |
| - a |
This file contains hidden or 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 would be in a helper somewhere | |
| def stub_find(entity) | |
| result = mock_model(entity) | |
| entity.stub(:find).with(result.id).and_return(result) | |
| result | |
| end | |
| let(:params) do | |
| {:these => 'params'} | |
| end |
This file contains hidden or 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
| class Fruit | |
| attr_reader :colour | |
| def initialize(colour) | |
| @colour = colour | |
| end | |
| def ripe? | |
| false | |
| end |
This file contains hidden or 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
| module ImageSpec | |
| require 'open3' | |
| class Comparison | |
| def initialize(expected, actual, max_acceptable_score = 0.01) | |
| @expected, @actual = expected, actual | |
| @max_acceptable_score = max_acceptable_score | |
| end | |
| def look_similar? |
This file contains hidden or 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
| Scenario: Create an invoice | |
| Given I am an authenticated user with an admin role | |
| And a client "test client" exists with name: "test client", initials: "TTC" | |
| And a project "test project" exists with name: "test project", client: client "test client" | |
| And a ticket "test ticket" exists with project: project "test project", name: "test ticket" | |
| And a work_unit "test work unit" exists with ticket: ticket "test ticket", scheduled_at: "2010-01-01", hours: "1" | |
| And I am on the admin invoices page | |
| Then I should see "test client" | |
| And I follow "test client" | |
| And I fill in "global_invoiced" with "123" |
This file contains hidden or 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
| git log --all -M -C --name-only | grep -E '^(app|lib|spec|features)/' | uniq | sort | uniq -c | sort |
This file contains hidden or 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
| # A Ruby meta-programming puzzle for polite programmers. | |
| # The challenge is: you have a class Foo which you want to monkey-patch, but politely. | |
| require 'test/unit/assertions' | |
| include Test::Unit::Assertions | |
| # Here's the default behaviour of Foo | |
| class Foo | |
| def bar |