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
Given(/^We wish to enter a new product$/) do | |
visit ProductPage | |
#click_link 'New Product' | |
end | |
When(/^The following product is entered$/) do |table| | |
data = table.rows_hash | |
on(ProductPage) do |page| | |
page.title = data['title'] | |
page.description = data['description'] |
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
gem push pkg/data_magic-0.16.1.gem -V | |
HEAD http://gems.rubyforge.org/latest_specs.4.8.gz | |
301 Moved Permanently | |
HEAD https://rubygems.org/latest_specs.4.8.gz | |
302 Moved Temporarily | |
HEAD https://s3.amazonaws.com/production.s3.rubygems.org/latest_specs.4.8.gz | |
304 Not Modified | |
HEAD http://gems.github.com/latest_specs.4.8.gz | |
304 Not Modified | |
Pushing gem to https://rubygems.org... |
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
bundle update gives | |
Using rake (10.1.0) | |
Using ffi (1.9.0) | |
Using childprocess (0.3.9) | |
Using ADB (0.5.6) | |
Using brazenhead (0.4.7) | |
Using builder (3.2.2) | |
Using diff-lcs (1.2.4) | |
Using multi_json (1.7.7) | |
Using gherkin (2.12.0) |
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
After do |scenario| | |
if scenario.failed? | |
filename = "error-#{scenario.__id__}.png" | |
@current_page.save_screenshot(filename) | |
embed(filename, 'image/png') | |
end | |
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
class MyPage | |
include PageObject | |
expected_title('the title I need to look for') | |
def initialize_page | |
has_expected_title? | |
end | |
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
package com.leandog.puppies.data; | |
import java.io.IOException; | |
import java.io.InputStream; | |
import java.net.MalformedURLException; | |
import java.net.URL; | |
import android.graphics.drawable.Drawable; | |
public class ImageLoader { |
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_helper.rb | |
require 'rspec' | |
require 'watir-webdriver' | |
require 'page-object' | |
require 'page-object/page_factory' | |
require 'require_all' | |
require_all 'lib/pages' | |
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
RSpec::Matchers.define :have_element_named do |expected| | |
match do |page| | |
page.respond_to?("#{expected.to_s}_element") and page.send "#{expected.to_s}?" | |
end | |
failure_message_for_should do |page| | |
"Expected the page to have an element named '#{expected.to_s}'" | |
end | |
failure_message_for_should_not do |page| |
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
After do |scenario| | |
if scenario.failed? | |
name = "error#{Time.now}.png" | |
@current_page.save_screenshot name | |
embed name, 'image/png' | |
end | |
# do your other stuff | |
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
protected static void clearCache(RubyModule klass, RubyModule module) { | |
List<String> methodNames = new ArrayList<String>(module.getMethods().keySet()); | |
for (Iterator iter = methodNames.iterator(); iter.hasNext();) { | |
String methodName = (String) iter.next(); | |
klass.getRuntime().getCacheMap().remove(klass.searchMethod(methodName)); | |
} | |
} |
NewerOlder