Created
March 11, 2010 05:51
-
-
Save anlek/328881 to your computer and use it in GitHub Desktop.
Issues with Cucumber and Subdomains when submitting a form. Found out that it was due to Capybara not playing well with subdomains
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: Admin should be able to login to any account | |
Given I login as "[email protected]" with password "1234" to subdomain "microsoft" | |
Then I should see "Signed in successfully" | |
And the subdomain should be "microsoft" |
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
When /^I login as "([^\"]*)" with password "([^\"]*)" to subdomain "([^\"]*)"$/ do |email, password, subdomain| | |
unless email.blank? | |
host! "#{subdomain}.example.com" | |
visit login_url(:subdomain => subdomain) | |
fill_in "email", :with => email | |
fill_in "Password", :with => password | |
click_button "Login to Cobra" | |
end | |
end | |
Then /^the subdomain should be "([^\"]*)"$/ do |subdomain| | |
current_url.gsub('http://', '').split('.')[0].should == subdomain | |
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
Background: # features/user_account.feature:7 | |
Given the following account records # features/step_definitions/app_steps.rb:13 | |
| name | subdomain | active | | |
| apple | apple | true | | |
| microsoft | microsoft | true | | |
| adobe | adobe | false | | |
And the following users # features/step_definitions/app_steps.rb:1 | |
| email | password | is_admin | subdomains | | |
| [email protected] | 1234 | true | apple | | |
| [email protected] | 1234 | false | apple, microsoft | | |
@wip | |
Scenario: Admin should be able to login to any account # features/user_account.feature:25 | |
Given I login as "[email protected]" with password "1234" to subdomain "microsoft" # features/step_definitions/app_steps.rb:28 | |
Then I should see "Signed in successfully" # features/step_definitions/web_steps.rb:99 | |
And the subdomain should be "microsoft" # features/step_definitions/app_steps.rb:44 | |
expected: "microsoft", | |
got: "www" (using ==) | |
Diff: | |
@@ -1,2 +1,2 @@ | |
-microsoft | |
+www | |
(Spec::Expectations::ExpectationNotMetError) | |
/usr/local/lib/ruby/gems/1.8/gems/rspec-1.3.0/lib/spec/expectations/fail_with.rb:41:in `fail_with' | |
/usr/local/lib/ruby/gems/1.8/gems/rspec-1.3.0/lib/spec/matchers/operator_matcher.rb:39:in `fail_with_message' | |
/usr/local/lib/ruby/gems/1.8/gems/rspec-1.3.0/lib/spec/matchers/operator_matcher.rb:61:in `__delegate_operator' | |
/usr/local/lib/ruby/gems/1.8/gems/rspec-1.3.0/lib/spec/matchers/operator_matcher.rb:51:in `eval_match' | |
/usr/local/lib/ruby/gems/1.8/gems/rspec-1.3.0/lib/spec/matchers/operator_matcher.rb:29:in `==' | |
/Users/andrew/rails_apps/pharmaCampaign/features/step_definitions/app_steps.rb:45 | |
/usr/local/lib/ruby/gems/1.8/gems/cucumber-0.6.3/lib/cucumber/core_ext/instance_exec.rb:48:in `instance_exec' | |
/usr/local/lib/ruby/gems/1.8/gems/cucumber-0.6.3/lib/cucumber/core_ext/instance_exec.rb:48:in `cucumber_instance_exec' | |
/usr/local/lib/ruby/gems/1.8/gems/cucumber-0.6.3/lib/cucumber/core_ext/instance_exec.rb:69:in `cucumber_run_with_backtrace_filtering' | |
/usr/local/lib/ruby/gems/1.8/gems/cucumber-0.6.3/lib/cucumber/core_ext/instance_exec.rb:36:in `cucumber_instance_exec' | |
/usr/local/lib/ruby/gems/1.8/gems/cucumber-0.6.3/lib/cucumber/rb_support/rb_step_definition.rb:55:in `invoke' | |
/usr/local/lib/ruby/gems/1.8/gems/cucumber-0.6.3/lib/cucumber/step_match.rb:24:in `invoke' | |
/usr/local/lib/ruby/gems/1.8/gems/cucumber-0.6.3/lib/cucumber/ast/step_invocation.rb:59:in `invoke' | |
/usr/local/lib/ruby/gems/1.8/gems/cucumber-0.6.3/lib/cucumber/ast/step_invocation.rb:38:in `accept' | |
/usr/local/lib/ruby/gems/1.8/gems/cucumber-0.6.3/lib/cucumber/ast/tree_walker.rb:115:in `visit_step' | |
/usr/local/lib/ruby/gems/1.8/gems/cucumber-0.6.3/lib/cucumber/ast/tree_walker.rb:180:in `broadcast' | |
/usr/local/lib/ruby/gems/1.8/gems/cucumber-0.6.3/lib/cucumber/ast/tree_walker.rb:114:in `visit_step' | |
/usr/local/lib/ruby/gems/1.8/gems/cucumber-0.6.3/lib/cucumber/ast/step_collection.rb:15:in `accept' | |
/usr/local/lib/ruby/gems/1.8/gems/cucumber-0.6.3/lib/cucumber/ast/step_collection.rb:14:in `each' | |
/usr/local/lib/ruby/gems/1.8/gems/cucumber-0.6.3/lib/cucumber/ast/step_collection.rb:14:in `accept' | |
/usr/local/lib/ruby/gems/1.8/gems/cucumber-0.6.3/lib/cucumber/ast/tree_walker.rb:109:in `visit_steps' | |
/usr/local/lib/ruby/gems/1.8/gems/cucumber-0.6.3/lib/cucumber/ast/tree_walker.rb:180:in `broadcast' | |
/usr/local/lib/ruby/gems/1.8/gems/cucumber-0.6.3/lib/cucumber/ast/tree_walker.rb:108:in `visit_steps' | |
/usr/local/lib/ruby/gems/1.8/gems/cucumber-0.6.3/lib/cucumber/ast/scenario.rb:47:in `accept' | |
/usr/local/lib/ruby/gems/1.8/gems/cucumber-0.6.3/lib/cucumber/step_mother.rb:307:in `before_and_after' | |
/usr/local/lib/ruby/gems/1.8/gems/cucumber-0.6.3/lib/cucumber/ast/scenario.rb:45:in `accept' | |
/usr/local/lib/ruby/gems/1.8/gems/cucumber-0.6.3/lib/cucumber/ast/scenario.rb:100:in `with_visitor' | |
/usr/local/lib/ruby/gems/1.8/gems/cucumber-0.6.3/lib/cucumber/ast/scenario.rb:39:in `accept' | |
/usr/local/lib/ruby/gems/1.8/gems/cucumber-0.6.3/lib/cucumber/ast/tree_walker.rb:51:in `visit_feature_element' | |
/usr/local/lib/ruby/gems/1.8/gems/cucumber-0.6.3/lib/cucumber/ast/tree_walker.rb:180:in `broadcast' | |
/usr/local/lib/ruby/gems/1.8/gems/cucumber-0.6.3/lib/cucumber/ast/tree_walker.rb:50:in `visit_feature_element' | |
/usr/local/lib/ruby/gems/1.8/gems/cucumber-0.6.3/lib/cucumber/ast/feature.rb:26:in `accept' | |
/usr/local/lib/ruby/gems/1.8/gems/cucumber-0.6.3/lib/cucumber/ast/feature.rb:25:in `each' | |
/usr/local/lib/ruby/gems/1.8/gems/cucumber-0.6.3/lib/cucumber/ast/feature.rb:25:in `accept' | |
/usr/local/lib/ruby/gems/1.8/gems/cucumber-0.6.3/lib/cucumber/ast/tree_walker.rb:20:in `visit_feature' | |
/usr/local/lib/ruby/gems/1.8/gems/cucumber-0.6.3/lib/cucumber/ast/tree_walker.rb:180:in `broadcast' | |
/usr/local/lib/ruby/gems/1.8/gems/cucumber-0.6.3/lib/cucumber/ast/tree_walker.rb:19:in `visit_feature' | |
/usr/local/lib/ruby/gems/1.8/gems/cucumber-0.6.3/lib/cucumber/ast/features.rb:29:in `accept' | |
/usr/local/lib/ruby/gems/1.8/gems/cucumber-0.6.3/lib/cucumber/ast/features.rb:17:in `each' | |
/usr/local/lib/ruby/gems/1.8/gems/cucumber-0.6.3/lib/cucumber/ast/features.rb:17:in `each' | |
/usr/local/lib/ruby/gems/1.8/gems/cucumber-0.6.3/lib/cucumber/ast/features.rb:28:in `accept' | |
/usr/local/lib/ruby/gems/1.8/gems/cucumber-0.6.3/lib/cucumber/ast/tree_walker.rb:14:in `visit_features' | |
/usr/local/lib/ruby/gems/1.8/gems/cucumber-0.6.3/lib/cucumber/ast/tree_walker.rb:180:in `broadcast' | |
/usr/local/lib/ruby/gems/1.8/gems/cucumber-0.6.3/lib/cucumber/ast/tree_walker.rb:13:in `visit_features' | |
/usr/local/lib/ruby/gems/1.8/gems/cucumber-0.6.3/lib/cucumber/cli/main.rb:61:in `execute!' | |
/usr/local/lib/ruby/gems/1.8/gems/spork-0.7.8/lib/spork/test_framework/cucumber.rb:22:in `run_tests' | |
/usr/local/lib/ruby/gems/1.8/gems/spork-0.7.8/lib/spork/run_strategy/forking.rb:13:in `run' | |
/usr/local/lib/ruby/gems/1.8/gems/spork-0.7.8/bin/../lib/spork/forker.rb:21:in `initialize' | |
/usr/local/lib/ruby/gems/1.8/gems/spork-0.7.8/bin/../lib/spork/forker.rb:18:in `fork' | |
/usr/local/lib/ruby/gems/1.8/gems/spork-0.7.8/bin/../lib/spork/forker.rb:18:in `initialize' | |
/usr/local/lib/ruby/gems/1.8/gems/spork-0.7.8/lib/spork/run_strategy/forking.rb:9:in `new' | |
/usr/local/lib/ruby/gems/1.8/gems/spork-0.7.8/lib/spork/run_strategy/forking.rb:9:in `run' | |
/usr/local/lib/ruby/gems/1.8/gems/spork-0.7.8/lib/spork/server.rb:47:in `run' | |
/usr/local/lib/ruby/1.8/drb/drb.rb:1562:in `__send__' | |
/usr/local/lib/ruby/1.8/drb/drb.rb:1562:in `perform_without_block' | |
/usr/local/lib/ruby/1.8/drb/drb.rb:1522:in `perform' | |
/usr/local/lib/ruby/1.8/drb/drb.rb:1596:in `main_loop' | |
/usr/local/lib/ruby/1.8/drb/drb.rb:1592:in `loop' | |
/usr/local/lib/ruby/1.8/drb/drb.rb:1592:in `main_loop' | |
/usr/local/lib/ruby/1.8/drb/drb.rb:1588:in `start' | |
/usr/local/lib/ruby/1.8/drb/drb.rb:1588:in `main_loop' | |
/usr/local/lib/ruby/1.8/drb/drb.rb:1437:in `run' | |
/usr/local/lib/ruby/1.8/drb/drb.rb:1434:in `start' | |
/usr/local/lib/ruby/1.8/drb/drb.rb:1434:in `run' | |
/usr/local/lib/ruby/1.8/drb/drb.rb:1354:in `initialize' | |
/usr/local/lib/ruby/1.8/drb/drb.rb:1634:in `new' | |
/usr/local/lib/ruby/1.8/drb/drb.rb:1634:in `start_service' | |
/usr/local/lib/ruby/gems/1.8/gems/spork-0.7.8/lib/spork/server.rb:29:in `listen' | |
/usr/local/lib/ruby/gems/1.8/gems/spork-0.7.8/lib/spork/server.rb:20:in `run' | |
/usr/local/lib/ruby/gems/1.8/gems/spork-0.7.8/bin/../lib/spork/runner.rb:75:in `run' | |
/usr/local/lib/ruby/gems/1.8/gems/spork-0.7.8/bin/../lib/spork/runner.rb:9:in `run' | |
/usr/local/lib/ruby/gems/1.8/gems/spork-0.7.8/bin/spork:10 | |
/usr/local/bin/spork:19:in `load' | |
/usr/local/bin/spork:19 | |
features/user_account.feature:28:in `And the subdomain should be "microsoft"' | |
Failing Scenarios: | |
cucumber features/user_account.feature:25 # Scenario: Admin should be able to login to any account |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment